Skip to content

Instantly share code, notes, and snippets.

View oelna's full-sized avatar
😔
The light inside has broken, but I still work

Arno Richter oelna

😔
The light inside has broken, but I still work
View GitHub Profile
#!/bin/sh
# dfn: df normalized, or df not noisy, or df nicely, or df new
#
# Whatever you want to call it, this script makes df useful again.
# It removes read-only disks for Time Machine backups, system volumes
# that can't be modified, unbrowsable volumes, and other stuff you don't
# really care about.
#
# Instead, you get the same drives that you see on your Mac desktop in an
//
// OCXML.swift
// Created by Marco Arment on 9/23/24.
//
// Released into the public domain. Do whatever you'd like with this.
// No guarantees that it'll do anything, or do it correctly. Good luck!
//
import Foundation
@iamkirkbater
iamkirkbater / getCurrentlyPlaying.scpt
Last active November 22, 2024 15:53
Applescript - Get Currently Playing Track information from Apple Music and write to file
use scripting additions
use framework "Foundation"
-- Set Configuration Defaults
set OUTPUT_FILE to "~/now-playing.json"
-- END Configuration
on getCurrentTrack()
@pojntfx
pojntfx / main.sh
Last active November 28, 2025 20:04
Bluesky/AT Protocol: cURL API Interaction Cheatsheet
#!/bin/bash
# This script resolves a DID, retrieves an API key, fetches a user's feed,
# and posts a "Hello, world" message to the user's feed.
# Resolve DID for handle
HANDLE='felicitas.pojtinger.com'
DID_URL="https://bsky.social/xrpc/com.atproto.identity.resolveHandle"
export DID=$(curl -G \
--data-urlencode "handle=$HANDLE" \
@mahadirz
mahadirz / chatgpt.php
Created March 17, 2023 11:50
simple chatgpt prompt using php
<?php
$completion = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Your OpenAI API key
$apiKey = '';
// The message you want to send to OpenAI
$message = $_POST['message'];
@PetrusM
PetrusM / AVMetadataMachineReadableCodeObject+Binary.swift
Created October 25, 2022 06:31
AVKit : Get binary data from QRCode
import Foundation
import AVKit
// This extension is based upon https://www.thonky.com/qr-code-tutorial/data-encoding
extension AVMetadataMachineReadableCodeObject
{
var binaryValue: Data?
{
switch type
{
@marcoarment
marcoarment / S3.php
Last active July 8, 2025 17:39
A simple PHP class to perform basic operations against Amazon S3 and compatible services.
<?php
/*
A simple PHP class to perform basic operations against Amazon S3 and compatible
services. Requires modern PHP (7+, probably) with curl, dom, and iconv modules.
Copyright 2022 Marco Arment. Released under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
@oelna
oelna / shortcuts.js
Last active April 10, 2022 15:06
Quick $ and $$ wrappers for querySelector
const $ = document.querySelector.bind(document);
const $$ = document.querySelectorAll.bind(document);
@LeaVerou
LeaVerou / settings.json
Created August 3, 2021 11:24
VS Code Solarized Light that looks like Atom’s Solarized Light (WIP)
{
"workbench.colorTheme": "Solarized Light",
"editor.fontFamily": "Consolas, Menlo, Monaco, 'Courier New', monospace",
"editor.insertSpaces": false,
"editor.inlineSuggest.enabled": true,
"editor.fontSize": 14.5,
"editor.renderWhitespace": "boundary",
"editor.codeLens": false,
"editor.inlayHints.fontFamily": "Consolas, Menlo, Monaco, 'Courier New', monospace",
"diffEditor.codeLens": true,
@mholt
mholt / keypairs.js
Created June 25, 2021 20:07
Generate key pairs and PEM-encode them using vanilla JS and browser Crypto API
//
// Convert an ArrayBuffer into a string.
// From https://developers.google.com/web/updates/2012/06/How-to-convert-ArrayBuffer-to-and-from-String
function arrayBufToString(buf) {
return String.fromCharCode.apply(null, new Uint8Array(buf));
}
function pemEncode(label, data) {
const base64encoded = window.btoa(data);