Skip to content

Instantly share code, notes, and snippets.

View rolandcrosby's full-sized avatar

Roland Crosby rolandcrosby

View GitHub Profile
roland@MacBook-Air:~/Documents/tiktok/com.zhiliaoapp.musically-272016.ipa/Payload/TikTok.app$ otool -L TikTok
TikTok:
/System/Library/Frameworks/JavaScriptCore.framework/JavaScriptCore (compatibility version 1.0.0, current version 613.2.6)
@rpath/MusicallyCore.framework/MusicallyCore (compatibility version 0.0.0, current version 0.0.0)
/System/Library/Frameworks/Intents.framework/Intents (compatibility version 1.0.0, current version 1.0.0, weak)
/System/Library/Frameworks/WidgetKit.framework/WidgetKit (compatibility version 1.0.0, current version 181.16.0, weak)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1300.25.0)
/System/Library/Frameworks/Foundation.framework/Foundation (compatibility version 300.0.0, current version 1860.0.0)
/System/Library/Frameworks/UIKit.framework/UIKit (compatibility version 1.0.0, current version 5610.0.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
@rolandcrosby
rolandcrosby / qr.swift
Created May 21, 2023 21:34
Swift QR code decoder
import Foundation
import CoreImage
let arguments = CommandLine.arguments
if arguments.count < 2 {
fatalError("Usage: \(arguments[0]) filename [filename...]")
}
let context = CIContext()
guard let detector = CIDetector(ofType: CIDetectorTypeQRCode, context: context) else {
fatalError("Unable to initialize detector")
@rolandcrosby
rolandcrosby / gist:c26571bf4e263f695d2f
Last active March 27, 2023 18:34
Convert rich text on the clipboard to Markdown
if encoded=`osascript -e 'the clipboard as «class HTML»'` 2>/dev/null; then echo $encoded | perl -ne 'print chr foreach unpack("C*",pack("H*",substr($_,11,-3)))' | pandoc --no-wrap -f HTML -t markdown; else; pbpaste; fi
# for my .vimrc:
# command PasteMarkdown :read !if encoded=`osascript -e 'the clipboard as «class HTML»'` 2>/dev/null; then echo $encoded | perl -ne 'print chr foreach unpack("C*",pack("H*",substr($_,11,-3)))' | pandoc --no-wrap -f HTML -t markdown; else; pbpaste; fi
# nnoremap ,pmd :PasteMarkdown<CR>
@rolandcrosby
rolandcrosby / git-recent
Created March 1, 2022 22:31
Git “most recently used” branch listing command
#!/usr/bin/env bash
branch_file="$(mktemp)"
git branch -l --format '%(refname:lstrip=2)' > "$branch_file"
git reflog --format='%D' | sed -e 's/, /\n/g' | awk '$0 && !x[$0]++ {print}' | grep -x -F -f "$branch_file" | head -n 10 | tac
rm "$branch_file"
@rolandcrosby
rolandcrosby / ffmpeg.sh
Last active March 20, 2021 00:03
just so i have this next time i want to dub some audio with ffmpeg
# mix two audio streams together:
youtube-dl "https://www.youtube.com/watch?v=c38HJR-9vhU" -f best -o burnafterreading.mp4
youtube-dl "https://www.youtube.com/watch?v=Pqh63ca__mM" -f best -o chromatica.mp4
ffmpeg \
-ss 77.2 \ # skip first 77.2 seconds of first input
-i burnafterreading.mp4 \
-i chromatica.mp4 \
-filter_complex "[0:1][1:1] amix=inputs=2:weights=2 1" \ # mix track 1 (audio) of inputs 0 and 1, make audio 0 twice as loud as 1
-map 0:0 \ # use track 0 (video) from input 0
-c:a aac -strict -2 \ # don't think this is necessary, default encoder settings should be fine
@rolandcrosby
rolandcrosby / towns.rb
Created November 30, 2020 00:46
generate some massachusetts town names
#!/usr/bin/env ruby
class WordMarkov
def initialize(data=[])
@nexts = {}
@initials = []
data.each do |word|
chars = word.split('')
@initials << chars[0..1]
chars[0..-3].each_with_index do |char, i|
manufacturer model name width depth thickness weight screensize screenwidth screenheight
Lenovo 20KH002KUS X1 Carbon 6th Gen 12.73 8.54 0.62 2.49 14 2560 1440
Lenovo X1 Carbon 7th Gen 12.71 8.54 0.58 2.4 14 3840 2160
Apple A1466 MacBook Air 13" 2013 12.8 8.94 0.68 2.96 13.3 1440 900
Apple A1534 MacBook 12" 2017 11.04 7.74 0.52 2.03 12 2304 1440
Apple A1932 MacBook Air 13" 2018 11.97 8.36 0.61 2.75 13.3 2560 1600
Apple MacBook Air 13" 2020 11.97 8.36 0.63 2.8 13.3 2560 1600
Apple MacBook Pro 16" 2019 14.09 9.68 0.64 4.3 16 3072 1920
Dell 9380 XPS 13 2019 11.9 7.8 0.46 2.7 13.3 3840 2160
Dell XPS 13 2020 11.64 7.82 0.58 2.64 13.4 1920 1200
@rolandcrosby
rolandcrosby / flightaware-kml-merge.py
Last active September 14, 2020 01:39
merge multiple KML track files from FlightAware into a single file that can be imported into Google My Maps
from glob import glob
from lxml import etree
def xpath(el, path):
return el.xpath(path, namespaces={
'kml': 'http://www.opengis.net/kml/2.2',
'gx': 'http://www.google.com/kml/ext/2.2'
})
SELECT ?ingredient ?ingredientLabel (GROUP_CONCAT(DISTINCT ?sandwichLabel; SEPARATOR = ", ") AS ?sandwiches) WHERE {
?sandwich ((wdt:P31?)/(wdt:P279*)) wd:Q28803;
wdt:P527 ?ingredient.
MINUS { ?ingredient (wdt:P279*) wd:Q7802. }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en", "fr".
?sandwich rdfs:label ?sandwichLabel.
?ingredient rdfs:label ?ingredientLabel.
}
}
@rolandcrosby
rolandcrosby / Palme d'Or.sparql
Last active July 24, 2020 13:05
Wikidata SPARQL query to retrieve films that have won the Palme d'Or at Cannes
SELECT
?film
?title
?directors
?year
WHERE
{
SELECT
?film
?title