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 / remove-signin.js
Last active July 4, 2017 22:12
remove linkedin modal bookmarklet. select and drag the text to your bookmarks bar.
javascript:(function(){document.querySelector('#advocate-modal').remove(); document.querySelector('.advocate-modal-visible').classList.remove('advocate-modal-visible')}());
@mi-lee
mi-lee / open-in-chrome.js
Created July 12, 2017 05:55
Open a link in iOS Safari to Chrome. Bookmark for ease of access
javascript:location.href=%22googlechrome%22+location.href.substring(4)
@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);}());
@mi-lee
mi-lee / github-100vw.js
Last active March 20, 2018 23:15
Bookmarklet - Markdown files on GitHub.com: 100 viewport and no overflow
javascript:(function(){document.querySelectorAll('body *').forEach(function(obj){obj.style.maxWidth="100vw"});document.querySelector('body').style.overflowX = 'hidden'}());
@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 / 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 / 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 / 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 / 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 / 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