Skip to content

Instantly share code, notes, and snippets.

View say4n's full-sized avatar

Sayan Goswami say4n

View GitHub Profile
kconner / macOS
Last active July 7, 2024 19:42
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

0xdevalias /
Last active May 20, 2024 00:26
Some notes on accessing / exporting Apple's Screen Time data
milesrichardson /
Created January 21, 2023 07:35
inherit environment variables from PID 1

You can inherit the environment variables from PID 1 by iterating over the list of null-terminated strings in /proc/1/environ, parsing the first characters up to the first = as the variable name, setting the remaining value as that variable, and exporting it.

The Code Snippet

This works with multiline environment variables, and environment variables with arbitrary values, like strings, including = or JSON blobs.

Paste this in your current terminal session to inherit the environment variables from PID 1:

acouvreur /
Last active May 21, 2024 14:29
Sync deleted files from Radarr/Sonarr
# Find existing files in download/complete that are not in movies or tvshows.
export DOWNLOAD_FOLDER=path/to/downloads
export MOVIES_FOLDER=path/to/movies
export TVSHOWS_FOLDER=path/to/tvshows
findExistingFile() {
file=$(find $MOVIES_FOLDER/ $TVSHOWS_FOLDER/ -samefile "$1")
moyix /
Created February 5, 2022 22:51
Script to inject an exit(0) syscall into a running process. NB: only x86_64 for now!
gdb -p "$1" -batch -ex 'set {short}$rip = 0x050f' -ex 'set $rax=231' -ex 'set $rdi=0' -ex 'cont'
riobard / tcpdump.txt
Last active August 12, 2022 08:19
Poem lines broadcast by my ISP-provided fiber optical modem
# My ISP-provided fiber optical modem broadcasts a line of a poem every ten seconds. Here's the tcpdump of the complete poem.
# The optical modem is made by Shanghai Nokia-Bell Co.,Ltd and its model number is G-140W-UD. It's provided by my ISP, China Unicom in Shenzhen.
$ tcpdump -i vlan10 ether proto 0x8300
15:59:00.720301 00:00:00:00:00:12 (oui Ethernet) > Broadcast, ethertype Unknown (0x8300), length 72:
0x0000: 0000 0000 e4ea 8386 d93c 5468 6520 6461 .........<The.da
0x0010: 7920 4920 6c6f 7374 206d 7920 7665 7279
0x0020: 2066 6972 7374 2074 6f6f 7468 2c00 0000 .first.tooth,...
0x0030: 0000 0000 0000 0000 0000 ..........
15:59:10.740778 00:00:00:00:00:12 (oui Ethernet) > Broadcast, ethertype Unknown (0x8300), length 72:
geohot /
Created December 8, 2019 19:28
Install widevine on Ungoogled Chromium
#!/bin/bash -e
curl -O
hdiutil attach googlechrome.dmg
SRC=/Volumes/Google\ Chrome/Google\\ Chrome\ Framework.framework/Libraries/WidevineCdm
DEST=/Applications/\ Framework.framework/Libraries/
cp -R "$SRC" "$DEST"
hdiutil detach /Volumes/Google\ Chrome/
christophetd / infosec-subscriptions.opml
Created March 31, 2018 07:41
My Feedly RSS subscriptions
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<title>Christophe subscriptions in feedly Cloud</title>
<outline text="Security" title="Security">
<outline type="rss" text="Schneier on Security" title="Schneier on Security" xmlUrl="" htmlUrl=""/>
<outline type="rss" text="Rhino Security Labs" title="Rhino Security Labs" xmlUrl="" htmlUrl=""/>
nickbutcher / 1_drawable_ic_hash_io16.xml
Last active June 16, 2020 19:28
Animated Stroke. The google I/O website this year ( has some funky animated lettering. I especially liked the animated stroke around the letters and wondered how you might implement that on Android. Turns out that AnimatedVectorDrawable makes this very easy! Here's how it looks:…
<?xml version="1.0" encoding="utf-8"?>
Copyright 2016 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
dlo / .tarsnaprc
Last active January 26, 2021 03:16
I guess this is a pretty good OS X tarsnap configuration.
### Recommended options
# Tarsnap cache directory
cachedir /usr/local/tarsnap-cache
# Tarsnap key file
keyfile ~/.tarsnap/tarsnap.key
# Don't archive files which have the nodump flag set