Skip to content

Instantly share code, notes, and snippets.

@WFT
WFT / metadata.swift
Last active November 6, 2024 20:17
Modify CAF audio file metadata with Core Audio / AudioToolbox
import AudioToolbox
import Foundation
func check(_ status: OSStatus, line: Int = #line) {
if status != noErr {
fatalError("Error on line \(line): OSStatus \(status) - https://osstatus.com/search/results?search=\(status)")
}
}
@WFT
WFT / plist-to-json.swift
Last active September 27, 2024 20:37
Reads a plist with top-level dictionary and converts to JSON
import Foundation
// Reads a plist with top-level dictionary and converts to JSON. JSON printed to stdout.
// Run like this: `swift plist-to-json.swift myplist.plist`
guard CommandLine.arguments.count == 2 else {
let msg = "Usage: \(CommandLine.arguments[0]) <path-to-input.plist>\n"
try FileHandle.standardError.write(contentsOf: Data(msg.utf8))
exit(1)
}
@WFT
WFT / appstore_testing_support.py
Last active October 23, 2023 19:35
appstore_testing_support.py
from cryptography import x509
from cryptography.hazmat.primitives.asymmetric import ec
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.x509.oid import NameOID
import jwt
import cattrs
import datetime
from base64 import b64encode
from uuid import uuid4
@WFT
WFT / osstatus.sh
Created March 31, 2021 16:40
Search osstatus.com from command line
#!/bin/bash
if [[ $# -eq 1 ]]; then
open "https://osstatus.com/search/results?search=$1"
else
echo "Usage: osstatus NUMBER"
exit 1
fi
@WFT
WFT / Bar.swift
Last active January 13, 2018 00:00
pgdl test
public struct Bar {
public struct Foo: CustomStringConvertible {
public var description: String { return "Foo!" }
public init() { }
}
public static func food() -> Foo { return Foo() }
}
@WFT
WFT / simopen.sh
Last active December 22, 2016 19:42
Opens a file in the iOS simulator using a file URL.
#!/bin/bash
set -e
if [[ $# -eq 1 || $# -eq 2 ]]; then
url="file://$(realpath "$1" | sed 's/ /%20/g')"
xcrun simctl openurl ${2:-booted} "$url" ||
echo "$url" could not be opened
else
echo "USAGE: $0 PATH [SIM_NAME]"
@WFT
WFT / keybase.md
Created July 14, 2016 20:42
keybase.md

Keybase proof

I hereby claim:

  • I am wft on github.
  • I am willft (https://keybase.io/willft) on keybase.
  • I have a public key ASAyqXXcLCfWQ8u15BLYAXKazFg6reqWo_BUcogRSoIDFwo

To claim this, I am signing this object:

@WFT
WFT / waiwo.js
Last active August 29, 2015 14:23
What Am I Working On? (WAIWO)
// Super simple access to your most recently interacted with GitHub repo
function fetch(route, callback) {
// Ignoring old browsers...
var request = new XMLHttpRequest();
request.onreadystatechange = function() {
if (request.readyState === 4)
callback(request.responseText);
}
request.open('GET', route);
@WFT
WFT / vcs.lisp
Last active August 29, 2015 14:18
simple lisp vcs
;;; A simple VCS
;; Operation creation functions
(defmacro make-operation (position operation &rest rest)
`(list :operation ,operation :pos ,position ,@rest))
(defun insert (string position)
(make-operation position :insert :string string))
@WFT
WFT / Robot.laf
Created September 16, 2014 21:05
Robot.laf
skeleton 0 0 0 {
vary j 1 360 1 90
sphere 1 1 1 0 0 0 0 0 0
bone 3 0 0 {
cube 1.5 1 1 0 0 0 1.5 0 0
sphere 1 1 1 0 0 0 3 0 0
bone 3 3 0 {
cube 1 1.5 1 0 0 0 3 1.5 0
sphere 1 1 1 0 0 0 3 3 0
bone 3 3 3 {