Skip to content

Instantly share code, notes, and snippets.

View themichaelyang's full-sized avatar
🌱
‾ʖ̫‾

Michael Yang themichaelyang

🌱
‾ʖ̫‾
View GitHub Profile
@themichaelyang
themichaelyang / chmod-snippets
Created February 8, 2018 18:05
chmod snippets
# from: https://superuser.com/questions/91935/how-to-chmod-all-directories-except-files-recursively
chmod -R u+rwX,go+rX,go-w /path
# from: https://unix.stackexchange.com/questions/296967/how-to-recursively-remove-execute-permissions-from-files-without-touching-folder
chmod -x+X -R *
@themichaelyang
themichaelyang / style.css
Last active February 8, 2018 18:40
for all your no frills html page needs
// for all your no frills html page needs
body {
max-width: 560px;
padding: 10px;
padding-top: 50px;
padding-bottom: 40px;
margin: 0 auto;
//font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
@themichaelyang
themichaelyang / Makefile
Last active April 30, 2018 18:04
Makefile for easy LaTex documents from Markdown
.PHONY: clean
SRC = $(wildcard *.md)
all : $(addprefix pdf/, ${SRC:.md=.pdf})
./pdf/%.pdf : %.md
pandoc $*.md --pdf-engine=pdflatex -o pdf/$*.pdf
clean :
@themichaelyang
themichaelyang / TorPrivoxyPython.md
Created June 30, 2018 05:16 — forked from DusanMadar/TorPrivoxyPython.md
A step-by-step guide how to use Python with Tor and Privoxy
# interactive rebase with theirs strat (favor current branch)
git rebase -i -s recursive -X theirs <rebase-onto-branch>
@themichaelyang
themichaelyang / check.py
Last active November 9, 2018 21:41
check( <fn_to_test> )( <fn_args> )( <expected_return> )
def check(fn):
def run_check(expected, *args):
result = fn(*args)
if result == expected:
print("Test passed: " + fn.__name__ + str(args) + ' == ' + str(expected))
else:
print("Test failed: " + fn.__name__ + str(args))
print(" - Expected: " + str(expected))
print(" - Received: " + str(result))
@themichaelyang
themichaelyang / reflect.js
Last active February 10, 2019 03:23
resolves even if rejected out
// https://stackoverflow.com/a/31424853/7971276
const reflect = p => p.then(v => ({v, status: "resolved" }),
e => ({e, status: "rejected" }));
reflect(promise).then((v => {
console.log(v.status);
});
history | sed -E 's/(^( )+[0-9]+ [0-9\:T\-]+) //'
@themichaelyang
themichaelyang / 1c.py
Last active October 26, 2021 03:16
MIT 6.0001 Problem Set 1C Solutions
# MIT OCW 6.0001
# PSET 1C
# SOLUTION
# salary
starting_annual_salary = int(input("Starting salary? "))
# starting_annual_salary = 10000
semi_annual_raise = 0.07
# investments