This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Dynamic library that pauses a short lived program during launch so that a | |
// debugger can attach to it. To use it, compile it on macOS: | |
// clang -dynamiclib pause4debug.c -o pause4debug.dylib | |
// On Linux: | |
// gcc -shared -fPIC pause4debug.c -o pause4debug.so | |
// To use it, make the dynamic linker inject it using DYLD_INSERT_LIBRARIES or | |
// LD_PRELOAD, depending on your platform. On macOS: | |
// DYLD_INSERT_LIBRARIES=/path/to/pause4debug.dylib debugme | |
// On Linux, | |
// LD_PRELOAD=/path/to/pause4debug.so debugme |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>DomainsWithAssociatedCredentials</key> | |
<array> | |
<array> | |
<string>comcast.net</string> | |
<string>xfinity.com</string> | |
</array> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/sbin/openrc-run | |
start() { | |
start-stop-daemon --start --chdir /share --background --exec /usr/bin/python3 -- -m http.server 80 | |
} | |
stop() { | |
start-stop-daemon --stop --chdir /share --exec /usr/bin/python3 -- -m http.server | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
let arguments = CommandLine.arguments | |
switch arguments.count { | |
case 1: | |
let moduleDict = CFPreferencesCopyAppValue("moduleDict" as CFString, "com.apple.screensaver" as CFString) | |
print(moduleDict?["moduleName"] as! String) | |
print(moduleDict?["path"] as! String) | |
case 3: | |
let moduleDict = (CFPreferencesCopyAppValue("moduleDict" as CFString, "com.apple.screensaver" as CFString) as? NSDictionary)?.mutableCopy() as? NSMutableDictionary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import json | |
import re | |
import urllib.request | |
if __name__ == "__main__": | |
comments = json.load(urllib.request.urlopen("https://hacker-news.firebaseio.com/v0/user/saagarjha.json"))["submitted"][::-1] | |
for comment in comments: | |
timestamp = json.load(urllib.request.urlopen("https://hacker-news.firebaseio.com/v0/item/" + str(comment) + ".json"))["time"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function shouldStop(startTime) { | |
return new Date().getTime() - startTime.getTime() > 300000; // 5 minutes | |
} | |
function archive() { | |
var days = 7; // How old a message must be to be archived | |
var startTime = new Date(); | |
var date = new Date(); | |
date.setDate(date.getDate() - days); | |
var label = GmailApp.getUserLabelByName("[LABEL NAME]"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _XOPEN_SOURCE 700 | |
#include <ctype.h> | |
#include <ftw.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
// djb2 because it's short | |
unsigned int hash(char *string) { | |
unsigned int hash = 5381; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Compile with clang -F/System/Library/PrivateFrameworks -framework SkyLight iterm-set-profile.m | |
#import <Foundation/Foundation.h> | |
BOOL SLSGetAppearanceThemeLegacy(void); | |
int main() { | |
if (SLSGetAppearanceThemeLegacy()) { | |
printf("\033]50;SetProfile=Solarized Dark\a"); | |
} else { | |
printf("\033]50;SetProfile=Solarized Light\a"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 com.apple.iWork.Keynote | |
18 com.apple.iWork.Pages | |
16 com.apple.iWork.Numbers | |
15 com.apple.iPhoto | |
13 com.microsoft.Powerpoint | |
9 com.microsoft.Excel | |
9 com.apple.logic.pro | |
9 com.adobe.Photoshop | |
8 com.microsoft.Outlook | |
7 com.microsoft.Word |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import getpass | |
import json | |
import pathlib | |
import sys | |
import urllib.parse | |
import urllib.request | |