Skip to content

Instantly share code, notes, and snippets.

View sxlijin's full-sized avatar
🎯
doing things

Samuel Lijin sxlijin

🎯
doing things
View GitHub Profile
@sxlijin
sxlijin / protect_branches_with_gh_api.py
Created October 1, 2016 22:34
Demo of how to access the protected branches API (currently in preview) with Python.
#!/usr/bin/env python
"""
Demo of how to access the protected branches API, currently in preview.
See https://developer.github.com/changes/2016-06-27-protected-branches-api-update/
Note that you get a 404 if you attempt to get the protection of a branch on a
repo that your token actually works for (it's not well-defined behavior, but
it's what happens).
Note that for this to work on non-unix systems, AUTH_TOKEN must be set.
"""
@sxlijin
sxlijin / CMakeLists.txt
Last active October 14, 2016 21:36
Example CMakeLists.txt for CS3251 Assignment3a
cmake_minimum_required(VERSION 3.2)
project(3a)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
set(SOURCE_FILES
main.cpp)
add_executable(3a ${SOURCE_FILES})
@sxlijin
sxlijin / .travis.yml
Last active October 24, 2016 21:40
Example .travis.yml for CS3251
language: cpp
sudo: false
matrix:
include:
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
@sxlijin
sxlijin / scrape-voice-survey-data.bash
Created December 7, 2016 09:10
Scrapes the VOICE survey data submitted by students.
#!/usr/bin/bash
VUNETID="put your vunetid here"
VUNETPW="put your vunetid password here"
# login
curl https://www.sds.vanderbilt.edu/perl/voiceview.pl \
-X POST \
-d VSASM_ASVBlock=425457605464733D246C743F77706A6466776A66782F716D3D2477743F425457604E6675693D246C743F4D4D4542513D2477743F42545760516275693D246C743F7878782F7465742F77626F656673636A6D752F666576307166736D3077706A6466776A66782F716D3D2477743F425457605476634E6675693D246C743F45464742564D553D2477743F42545760544A513D246C743F31423533453132473D2477743F425457604271713D246C743F57504A44463D2477743F425457605477733D246C743F54455432 \
-d VSASM_user="${VUNETID}" \
@sxlijin
sxlijin / parse_voice_data.py
Created December 7, 2016 09:14
Parse scraped VOICE data into CSVs for analysis.
#!/usr/bin/env python3
from glob import glob as ls
import statistics
import itertools as it
import re
def expand(field):
field = ((index + 1, freq)
for (index, (_, freq))
@sxlijin
sxlijin / repeat-command-while-dir-changes.bash
Created December 25, 2016 20:30
monitor a directory tree with inotifywait, repeat a command when anything in the tree changes
#!/bin/bash
WATCH_DIR="app/"
REPEAT_ON_CHANGES="./node_modules/.bin/webpack --progress"
inotifywait -m --exclude '\..*.swp' -e MODIFY -r $WATCH_DIR | \
while true
do
sleep 0.1
(e=false; while read -t 0.1 d; do echo $d; export e=true ; done; $e) \
@sxlijin
sxlijin / init.sh
Last active February 2, 2017 19:11
Bring up an Arch system from live disk.
#!/bin/bash
set -e
sfdisk /dev/sda <<EOF
/dev/sda1 : start=2048, size=2048, type= 4, bootable
/dev/sda2 : start=4096, type=20
EOF
mkfs.ext4 /dev/sda2
@sxlijin
sxlijin / lighting_setup.md
Last active December 12, 2019 00:05
Portable nighttime sports field lighting setup

Portable outdoor nighttime sports field lighting setup

Ocean Beach pickup ultimate in SF uses the below described setup for nighttime beach frisbee games.

Regulation fields are 150' x 90', ours is probably slightly smaller.

We get 90+ min (probably 2h+) of playtime out of this setup (batteries can be upgraded if you want more time).

Bill of Materials (v2)

@sxlijin
sxlijin / utf8_examples.md
Last active November 16, 2019 05:15
UTF8 Examples
Helsingør, Espergærde, Humlebæk, Nivå, Vedbæk, Østerport, Nørreport, København H

Jan Łukasiewicz, Wacław Sierpiński, Paul Erdős, Évariste Galois

Andrey Nikolaevich Kolmogorov (Russian: Андрей Николаевич Колмогоров)
Pafnuty Lvovich Chebyshev (Russian: Пафну́тий Льво́вич Чебышёв)
Aleksandr Mikhailovich Lyapunov (Russian: Алекса́ндр Миха́йлович Ляпуно́в)
Grigori Yakovlevich Perelman (Russian: Григо́рий Я́ковлевич Перельма́н)
Georgy Feodosevich Voronoy (Ukrainian: Георгій Феодосійович Вороний)
@sxlijin
sxlijin / gist:c7a7147afc11bf23c10198db5c101c39
Created June 11, 2023 02:22
sofle_choc qmk build errors
sxlijin@sxlijin-debian:2023-06-10T19:21:16-0700:~/repos/blow-qmk (choc2) [0]
$ g lgn
++ 2023-06-10T19:21:21-0700 ++ git lgn
42f7458b04 (8 weeks ago) - (HEAD -> choc2, origin/choc2) Fix photo url of sofle choc
871e067678 (8 weeks ago) - Apply tri layer handling for sofle choc.
4217deafeb (8 weeks ago) - Add default encoder behaviour.
11a7c61569 (8 weeks ago) - Replace deprecated RGB_DI_PIN.
8ab84c008a (8 weeks ago) - Merge remote-tracking branch 'upstream/master' into choc2
6d965d486c (8 weeks ago) - Add hardware information momokai keyboards (#20434)
ce417226b2 (8 weeks ago) - 4pplet/eagle_viper_rep/rev_a Layout Macro Conversion and Additions (#20414)