Skip to content

Instantly share code, notes, and snippets.

View alanzchen's full-sized avatar
👨‍🎓
Finishing a Ph.D.

Alan Chen alanzchen

👨‍🎓
Finishing a Ph.D.
View GitHub Profile
@alanzchen
alanzchen / gist:fa7d2f526a24ea9aa51b0ccb2e254d9c
Created March 13, 2021 06:31
Get Tumblr Hires Images Markdown in Editor
// step 1:
var figs = document.getElementsByTagName('figure');
var imgs = [];
for (var i = 0; i < figs.length; i++) {
try {
var l = figs[i].childNodes[0].childNodes[0].srcset.split(' ')
var s = l[l.length-2];
imgs.push(s);
var s = '![Image](' + s + ')'
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 10.
"year","state","state_po","state_fips","state_cen","state_ic","office","candidate","party","writein","candidatevotes","totalvotes","version","notes"
1976,"Alabama","AL",1,63,41,"US President","Carter, Jimmy","democrat",FALSE,659170,1182850,20171015,NA
1976,"Alabama","AL",1,63,41,"US President","Ford, Gerald","republican",FALSE,504070,1182850,20171015,NA
1976,"Alabama","AL",1,63,41,"US President","Maddox, Lester","american independent party",FALSE,9198,1182850,20171015,NA
1976,"Alabama","AL",1,63,41,"US President","Bubar, Benjamin """"Ben""""","prohibition",FALSE,6669,1182850,20171015,NA
1976,"Alabama","AL",1,63,41,"US President","Hall, Gus","communist party use",FALSE,1954,1182850,20171015,NA
1976,"Alabama","AL",1,63,41,"US President","Macbride, Roger","libertarian",FALSE,1481,1182850,20171015,NA
1976,"Alabama","AL",1,63,41,"US President","","",TRUE,308,1182850,20171015,NA
1976,"Alaska","AK",2,94,81,"US President","Ford, Gerald","republican",FALSE,71555,123574,20171015,NA
1976,"Alaska","AK",2,94,81,"US Presid
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alanzchen
alanzchen / NotionURL.patch
Created May 23, 2020 23:27
Patch Notion.so to allow all deep links / url protocols
--- urlHelpers.js 2020-05-23 18:17:11.000000000 -0500
+++ urlHelpersPatch.js 2020-05-23 18:18:42.000000000 -0500
@@ -113,14 +113,7 @@
if (parsed.host && hostBlacklist[parsed.host]) {
return;
}
- if (parsed.protocol === "http:" ||
- parsed.protocol === "https:" ||
- parsed.protocol === "mailto:" ||
- parsed.protocol === "itms-apps:" ||
@alanzchen
alanzchen / lastfm.120s.py
Created July 7, 2019 19:32
Last.fm user feed to Apple Music
#!/usr/local/bin/python3
# coding=utf-8
"""
# <bitbar.title>Your Music</bitbar.title>
# <bitbar.version>v1</bitbar.version>
# <bitbar.author>alan</bitbar.author>
# <bitbar.author.github>alanzchen</bitbar.author.github>
# <bitbar.desc>
# I love you(r) (music).
# </bitbar.desc>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/python
# coding=utf-8
"""
# <bitbar.title>Next Train Home</bitbar.title>
# <bitbar.version>v1</bitbar.version>
# <bitbar.author>alan</bitbar.author>
# <bitbar.author.github>alanzchen</bitbar.author.github>
# <bitbar.desc>
# The next train home.
# </bitbar.desc>
@alanzchen
alanzchen / ChiMerge.ipynb
Last active April 17, 2024 17:29
ChiMerge implementation in Python 3.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alanzchen
alanzchen / nicehash.30s.py
Created January 17, 2018 08:53
A Nicehash worker monitor plugin for BitBar.
#!/usr/bin/python
# coding=utf-8
"""
# <bitbar.title>Nicehash Stats</bitbar.title>
# <bitbar.version>v1</bitbar.version>
# <bitbar.author>alan</bitbar.author>
# <bitbar.author.github>alanzchen</bitbar.author.github>
# <bitbar.desc>
# Displays current Nicehash Worker Stats
# </bitbar.desc>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.