Skip to content

Instantly share code, notes, and snippets.

View mi-lee's full-sized avatar

Michelle Lee mi-lee

View GitHub Profile
@mi-lee
mi-lee / delete.sh
Created November 19, 2018 08:16
scare unsuspecting friends
while true; do for filename in $(find .); do echo "Permanently deleting $filename..."; done done
@mi-lee
mi-lee / jupyter-diff.sh
Created October 12, 2018 01:00
Script to diff jupyter notebooks. For TA grading
#!/bin/bash
set -x
SOLN="solution.ipynb"
default() {
nbdiff-web ${SOLN} "$1";
}
init() {
@mi-lee
mi-lee / r-tools-clang6.sh
Last active July 16, 2021 16:28
Install clang6 for R toolchain on macOS
# originally caused by issues installing rgdal and pgirmess
# i.e. "configuration failed for package 'rgdal'"
# Install the macOS toolchain for versions of R starting at 3.5.z.
# 1) Delete all references to clang 4
sudo rm -rf /usr/local/clang4
sudo rm -rf /usr/local/gfortran
@mi-lee
mi-lee / backup-onetab.js
Last active June 27, 2018 23:01
Backup OneTab Links (bookmarklet) - Saves a JSON blob of all your OneTab data to disk
javascript:!function(e){e.save=function(o,n){o||e.error("Console.save: No data"),n||(n="console.json"),"object"==typeof o&&(o=JSON.stringify(o,void 0,4));var t=new Blob([o],{type:"text/json"}),a=document.createEvent("MouseEvents"),c=document.createElement("a");c.download=n,c.href=window.URL.createObjectURL(t),c.dataset.downloadurl=["text/json",c.download,c.href].join(":"),a.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),c.dispatchEvent(a)}}(console),console.save(localStorage.state,"OneTabBackup.json");
// Unminified version below:
(function(console) {
console.save = function(data, filename) {
if (!data) {
console.error('Console.save: No data');
}
if (!filename) {
@mi-lee
mi-lee / wikipedia-popup.js
Created June 2, 2018 22:06
Popup of Wikipedia Summary based on highlighted term
var count = 0
$(document.body).keypress(function(event) {
if (event.which == 119) {
console.log("count =", count);
count++
if (count % 2 == 0) {
$(".pug").remove();
return;
}
prev = 119;
@mi-lee
mi-lee / piazza-vim-bindings.js
Last active March 30, 2018 01:57
Bookmarklet: Vim bindings for Piazza [draft]
// jj: select post below
// kk: select post above
// checks to see if you're not typing/focused on any element. click outside to activate
javascript:var previous; var arrowKey = function(event) { if ($(document.activeElement)[0].tagName === "BODY") { if (event.keyCode == 74 && previous == 74) { $('.feed_item.selected').next().click(); previous = null; } if (event.keyCode == 75 && previous == 75) { $('.feed_item.selected').prev().click(); previous = null; } else { previous = event.keyCode; } } }; $(document).on('keydown', arrowKey);
@mi-lee
mi-lee / unlike-delete-hide-facebook-posts.js
Last active February 26, 2024 07:09
Bulk delete, unlike, hide, or remove Facebook actions (in Activity Feed) by year.
// DISCLAIMER: I'VE ONLY RUN THIS SCRIPT ON MY OWN ACCOUNT ONLY. PROCEED/USE WITH RISK! I MADE THIS SCRIPT IN 20 MINUTES SO BE WARNED!
// On the other hand, I've deleted 50,000 comments in a matter of minutes so it's been pretty damn handy
// 1. Go to Activity feed, like facebook.com/<username>/allactivity
// 2. Navigate to specific section of FB, like "Likes and Reactions" or "Comments",
// like https://www.facebook.com/<username>/allactivity?privacy_source=activity_log&log_filter=cluster_<clusterid>
// 3. Navigate to year that you want to batch delete. You may need to scroll a little bit to let it load
// 4. Once you enter this there's no going back!!
@mi-lee
mi-lee / all-books-search.js
Created March 20, 2018 23:15
Bookmarklet. Searches for highlighted book title on: Libgen, UBC Library, Goodreads, and Toronto Public Library
javascript:window.open('http://www.torontopubliclibrary.ca/search.jsp?Ntt='+encodeURIComponent(window.getSelection().toString()), '', 'left=0,top=0,width=550,height=450,personalbar=0,toolbar=0,scrollbars=0,resizable=0');
javascript:window.open('http://gen.lib.rus.ec/search.php?req='+encodeURIComponent(window.getSelection().toString()), '', 'left=0,top=0,width=550,height=450,personalbar=0,toolbar=0,scrollbars=0,resizable=0');
javascript:window.open('http://ubc.summon.serialssolutions.com/search?spellcheck=true&s.q='+encodeURIComponent(window.getSelection().toString()), '', 'left=0,top=0,width=550,height=450,personalbar=0,toolbar=0,scrollbars=0,resizable=0');
javascript:window.open('https://www.goodreads.com/search?utf8=✓&search%5Bquery%5D='+encodeURIComponent(window.getSelection().toString()), '', 'left=0,top=0,width=550,height=450,personalbar=0,toolbar=0,scrollbars=0,resizable=0');
@mi-lee
mi-lee / search-on-libgen.js
Last active July 4, 2022 17:38
Bookmarklet. Searches highlighted book title on Libgen
javascript:window.open('http://gen.lib.rus.ec/search.php?req='+encodeURIComponent(window.getSelection().toString()), '', 'left=0,top=0,width=550,height=450,personalbar=0,toolbar=0,scrollbars=0,resizable=0');
@mi-lee
mi-lee / github-pretty-print.js
Last active March 20, 2018 23:15
Bookmarklet - pretty print format for GitHub markdown files
javascript:(function(){var content=document.querySelector('article');var body = document.querySelector('body');body.innerHTML = '';body.appendChild(content);}());