Skip to content

Instantly share code, notes, and snippets.

View sirgatez's full-sized avatar

Joshua Briefman sirgatez

  • ByteDance
  • San Jose, CA
  • 02:04 (UTC -07:00)
View GitHub Profile
@dduan
dduan / bird.swift
Created November 14, 2020 22:16
Flappy bird as a CLI app written in Swift.
// This is the code for the Flappy Bird game running in a Unix terminal.
// Demo: https://twitter.com/daniel_duan/status/1327735679657250816?s=21
// To run it, simply do "swift bird.swift" in a Unix command line.
#if canImport(Darwin)
import Darwin
#else
import Glibc
#endif
enum RawModeError: Error {
@dduan
dduan / runInRawMode.swift
Last active February 3, 2023 00:49
Put terminal in raw mode, clear the screen, run some code. Reset the terminal to original mode when the code finish running.
#if canImport(Darwin)
import Darwin
#else
import Glibc
#endif
enum RawModeError: Error {
case notATerminal
case failedToGetTerminalSetting
case failedToSetTerminalSetting
@pjobson
pjobson / apple_install_dates.md
Last active May 14, 2024 18:20
OSX Install Dates

Various Versions of macOS/OSX will fail on install for various reasons. You can fix them by disconnecting from your wifi or network or resetting your NVRAM. Booting from your USB stick, opening terminal and doing: date ########## where the # nubers are below. Format is: MMDDhhmmYY

10.16 - 0.5 Leopard   - date 0101010121 <- Currently not needed
10.15 - Catalina      - date 0101010120 <- Currently not needed
10.14 - Mojave        - date 0101010119 <- Currently not needed
10.13 - High Sierra   - date 0101010118

10.12 - Sierra - date 0101010117

@argp
argp / sandbox_i6s_13.3.1_profiles_vs_sandbox_iX_12.4_profiles.txt
Created February 7, 2020 16:43
iOS 13.3.1 vs iOS 12.4 sandbox profiles
$ diff -q sandbox_i6s_13.3.1_profiles/ sandbox_iX_12.4_profiles/ | /bin/grep Only
Only in sandbox_i6s_13.3.1_profiles/: adservicesd.sb
Only in sandbox_i6s_13.3.1_profiles/: akd.sb
Only in sandbox_i6s_13.3.1_profiles/: appsso.sb
Only in sandbox_i6s_13.3.1_profiles/: ArchiveService.sb
Only in sandbox_i6s_13.3.1_profiles/: asd.sb
Only in sandbox_iX_12.4_profiles/: assertiond.sb
Only in sandbox_i6s_13.3.1_profiles/: businesschatd.sb
Only in sandbox_i6s_13.3.1_profiles/: callservicesd.sb
Only in sandbox_i6s_13.3.1_profiles/: cfprefsd.sb
@qskwood
qskwood / wget-warc-generator
Last active May 1, 2024 17:21
This script uses wget to generate a WARC that can be read by a player like OpenWayback and places it into a directory. It also handles creation and use of CDX indexes for de-duplication.
#!/bin/bash
if [[ $# -ne 2 ]]; then
echo "Must only have two arguments, the URL and the collection" >&2
exit 1
fi
if [[ ! -d "/var/spool/openwayback/files2/${2}" ]]; then
mkdir "/var/spool/openwayback/files2/${2}"
fi
@bored-engineer
bored-engineer / 0_usage.md
Last active February 13, 2019 14:34
A jq script to generate strongly typed golang structures based on results from a GraphQL introspection query

Usage (using get-graphql-schema to fetch the schema):

get-graphql-schema https://hackerone.com/graphql --json | jq -rf graphql.jq

Supports Union types, Enum types, Interfaces, Input Objects and regular Objects.

See bored-engineer/hackeroni-ql for an example library generated with this script.

@sinclairtarget
sinclairtarget / bernoulli.c
Created August 17, 2018 20:22
Lovelace's Note G Program in C
#include <stdio.h>
/*
* Calculates what Ada Lovelace labeled "B7", which today we would call the 8th
* Bernoulli number.
*/
int main(int argc, char* argv[])
{
// ------------------------------------------------------------------------
// Data
@haircut
haircut / tcc-reset.py
Last active April 5, 2024 11:27
Completely reset TCC services database in macOS
#!/usr/bin/python
"""
Completely reset TCC services database in macOS
Note: Both the system and individual users have TCC databases; run the script as both
a user and as root to completely reset TCC decisions at all levels.
2018-08-15: Resetting the 'Location' service fails; unknown cause
2018-08-16: Confirmed the 'All' service does not really reset _all_
services, so individual calls to each service is necessary.
@gopsmith
gopsmith / disable.sh
Last active September 21, 2023 14:39
Disable bunch of #$!@ in High Sierra
#!/bin/bash
# NOTE: This script must be run from Terminal within RECOVERY MODE. This version is for macOS High Sierra.
# There is no need to disable SIP (via csrutil), because recovery mode is not constrained by SIP.
# WARNING: It might enable things that you may not like. Please double check the services in the TODISABLE vars.
#
# For OSes newer than High Sierra, see comments in the original gist author's Catalina version, at
# https://gist.github.com/pwnsdx/1217727ca57de2dd2a372afdd7a0fc21
# (see the "Note about Big Sur" at the top, and there are comments about Monterey further down).
#
@ayubmalik
ayubmalik / gpg-encrypt.go
Last active May 10, 2024 20:08
Golang encrypt file using GPG openpgp. Use standard go libs.
package main
/**
Example hack to encrypt a file using a GPG encryption key. Works with GPG v2.x.
The encrypted file e.g. /tmp/data.txt.gpg can then be decrypted using the standard command
gpg /tmp/data.txt.gpg
Assumes you have **created** an encryption key and exported armored version.
You have to read the armored key directly as Go cannot read pubring.kbx (yet).