Skip to content

Instantly share code, notes, and snippets.

View jyn514's full-sized avatar
💭
don't ping me about rust-lang/ issues

jyn jyn514

💭
don't ping me about rust-lang/ issues
View GitHub Profile
@jyn514
jyn514 / openpgp.txt
Created September 29, 2017 01:18
OpenKeychain Linked Identity
This Gist confirms the Linked Identity in my OpenPGP key, and links it to this GitHub account.
Token for proof:
[Verifying my OpenPGP key: openpgp4fpr:a833b01b44bdda1ee80e261ce655823d8d8b1088]

Keybase proof

I hereby claim:

  • I am jyn514 on github.
  • I am jyn514 (https://keybase.io/jyn514) on keybase.
  • I have a public key ASAJLDA1HPK5tztr_F7ctK81bys12aiquglO91xmEX1Tcgo

To claim this, I am signing this object:

-----BEGIN PGP MESSAGE-----
hQIMAyxhjqrO4XvZAQ//bZWISUxqCzqHBf+RJyhqtAWGXaLEYa6O2MYwwfdRAiFy
DxK6ZpqGjScl9EVghk15lRg0IeuSJEKZ5aLEP5rv7xhTxxTJu55DwFT9C9Pw7o5w
dYnw1EpIFjNx0g8tQvvFTmNIpXSj0kF/7Mo5t4Hd1e+EOmdXCkf0Px10cuxtbdUI
6AKIVgrFSn7Ci+ViHVW+9l5mGPNJCvCcsk1CTS5IBh1pJtP8T+ng3dW3ZJIEuegQ
zzmtAAR5Dk1hFE0/x2bnPmjmi9Qm2dRuv+lEFYR610ozm1c4AbAsBUlERba/xeCa
Eymy666P/oVw64IRA+zRZg567a0Rdr8uCY3Gh/xeMgu5tQqHo8tiZYSWsFELqRTT
snyqw4JUi7CJi964j3G606GfRDPw9qPLad/nQrnKcfXypGi5wxn1i2LchdN9Rb/8
S+MORUPIC4IMLYwGHLAvpdDXhquPuEuAmgxMIn/CxlM/eCVzNo0MTPLILgNEFhPU
@jyn514
jyn514 / hanoi_visual.sh.asc
Last active March 13, 2018 18:00
Tower of Hanoi in bash
Note this could be done in pure `sh` by replacing $((n - 1)) with `echo n - 1 | bc`;
I chose to assume `bc` was not installed so as to prevent errors.
-----BEGIN PGP MESSAGE-----
hQIMAyxhjqrO4XvZAQ/9EgNOiSRuQS58Uy4RLw2ldt5LHa3zndn/bJ9qxpyfS+f+
OtLCOD8SwUvwiFuFECX2gCZpQKyteGMT7n2ohvBRWZ69Ijmgl63nwbWxPh62KYpW
3SYgtA3WkIHEz84Pr0QIEStBt1GAZkHvuYDAeIzlTNC9kxsr/zOzOIWU3f7hv7On
oSHLtdR3Q43JT+0J+bhEiT1RD2lYf87dYFCz/dS0QtXKx45QSFF5fFtI/wNsI37m
HUEdVs7SLoFim/WOp23fQOxGhw5RwTK1owoAYoDOVMyPmu63BQWlcRiIup0SxhY8
@jyn514
jyn514 / first_app.py.asc
Last active March 13, 2018 00:26
Hello World in TKinter
-----BEGIN PGP MESSAGE-----
hQIMAyxhjqrO4XvZAQ//aA+DJwZ5G1T08+Ynh6v3L/c+/tbeDhT1vg8DV2gne2QP
5DPv3vktSIRyXe2iJrLPCMNX/y3lLAkOiifRoNmCUD2edUSu3T+euSMYUbQnJ/vO
S98yosssIX96i1WbHd4ShyeCamSsXRgyVK+fU5WOqfPGWZa1oJtNlKC+SNcoURgm
vI2nZfN5JlmsZKKUblcKUGwHvGTFQ8u06HF/J233riNXKXI33Hzx/yyRnUsbDufV
n0HVZLGDEXk3/fWMfX3gqpeVzRdYTS+310HbZgWf687AG+0mb41fuABuq+Y7QRso
/up36iakYzjK5woY7M83Z4cJtIWzMQkiX1OpnpfZlrtbGEfSZ0XtRjWRlWoxu0ER
fwzzh4UqODY5P50hkb/6ibXFKnIuqJr0CSnjNWtTOEbvZqG8/Efr+Iykqctbu6v7
c+UI2YeQxyryowvyT5PQSHagzDIJ3rsyD/v0TZhDRnU41yeo3wDMxE+jYjNG0m3n
@jyn514
jyn514 / recipies.txt
Created June 28, 2018 21:23
make recipies for gradeforge
% make -n --always-make| tee output.txt
mkdir webpages
python -m gradeforge download catalog > webpages/catalog.html
if grep '404 page not found' webpages/catalog.html; then echo file "'webpages/catalog.html'" gave a 404 not found; rm -f webpages/catalog.html; exit 999; fi
sed -i 's/\s\+$//' webpages/catalog.html
python -m gradeforge parse catalog --department-output catalog.departments.csv webpages/catalog.html catalog.csv
mkdir grades
python -m gradeforge download \
--season `echo grades/Fall-2008-Columbia.pdf | cut -d. -f1 | cut -d/ -f2 | cut -d- -f1` \
--year `echo grades/Fall-2008-Columbia.pdf | cut -d. -f1 | cut -d- -f2` \
@jyn514
jyn514 / protobuf-notes.md
Created July 5, 2019 15:46
Experiments with protobuf decoders

Protobuf Notes

@jyn514
jyn514 / try_max_by_key.rs
Last active August 14, 2019 12:43
try_max_by_key
/// short-circuiting version of iter.max_by_key
///
/// partially taken from https://doc.rust-lang.org/src/core/iter/traits/iterator.rs.html#2591
///
/// Example:
///
/// ```
/// let list = [[1, 2, 3], [5, 4, 3], [1, 1, 4]];
/// assert_eq!(try_max_by_key(list.into_iter(), |vec| vec.last().ok_or(())), Some(Ok(&[1, 1, 4])));
///
@jyn514
jyn514 / discrete.py
Last active October 4, 2019 03:01
CLI helper for discrete math formulas
#!/usr/bin/env python
from functools import reduce
from math import e, factorial
from operator import mul
from os.path import basename
from sys import argv
# https://stackoverflow.com/a/4941932
def ncr(n, r):
@jyn514
jyn514 / fib.rs
Created September 25, 2019 21:52
Fibonacci using a thread_local cache
use std::cell::RefCell;
use std::io::{stdin, stdout, Write};
fn main() {
loop {
print!("Enter a positive integer: ");
stdout().flush().expect("could not flush buffer");
let mut input = String::new();
let read = stdin().read_line(&mut input).expect("failed to read line");