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:
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] |
I hereby claim:
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 |
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 |
-----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 |
% 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` \ |
/// 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]))); | |
/// |
#!/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): |
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"); |