Skip to content

Instantly share code, notes, and snippets.

View dzfranklin's full-sized avatar

Daniel Franklin dzfranklin

  • Dundee, UK
  • 18:01 (UTC +01:00)
View GitHub Profile
let pdf_viewer = document.querySelector("div[pdfng]");
let pdf_url = angular.element(pdf_viewer).scope().pdf.url;
open(pdf_url);
location.href=location.href.replace("www.jstor.org", "faculty.college-prep.org:2120")
let b, b$$;
let s = document.createElement("script");
s.src = "https://cdnjs.cloudflare.com/ajax/libs/blissfuljs/1.0.2/bliss.shy.min.js";
document.head.appendChild(s);
s.addEventListener("load", function(){
b$ = Bliss;
b$$ = Bliss.$;
console.log("Bliss Shy loaded, use b$ and b$$");
});
@dzfranklin
dzfranklin / max_z_index.py
Created October 12, 2016 22:23
When given a css spreadsheet, finds the highest z index
#! /usr/bin/env python3
""" Analyze a css stylesheet to find the highest z index possible
Usage: ./max_z_index.py [filename]
To run on every file with .css in a directory, use `for f in $(ls); do echo $f | grep .css | xargs ./max_z_index.py; done`
"""
import fileinput
import re
def find_max_z(css_text):
matches = re.findall(r"z-index:([0-9]+)", css_text)
@dzfranklin
dzfranklin / jump_to_saved_scroll.bookmarklet.js
Created October 13, 2016 03:53
Save the current scroll position, and then jump to it later
(function(w, g){
if(!g){
alert("Error: no saved scroll position");
return;
}
w.scrollX = g.pos[0];
w.scrollY = g.pos[1];
}(window, window.save_scroll_globals))
"""Computes if a credit card number is valid.
Daniel Franklin <dzfranklin@wesleyan.edu>
HW due 15 Nov 2019
"""
def normalize_input(input_str):
"""Normalize an input string into an easier to process format.
:param input_str: A string of user input in form "xxxx-xxxx-xxxx-xxxx"
@dzfranklin
dzfranklin / troubleshooting.org
Created November 24, 2019 03:36
For issue report to ob-async about issue with :var

Issue Reporting Checklist

This checklist will help you diagnose problems with your ob-async setup.

Instructions

Execute the src blocks one at a time with ctrl-c ctrl-c to ensure that ob-async-org-babel-execute-src-block is used for files

Sending...
Mark set [2 times]
Sending via mail...
gnutls.c: [1] (Emacs) connecting to host: smtp.gmail.com
gnutls.c: [1] (Emacs) allocating credentials
gnutls.c: [2] (Emacs) allocating x509 credentials
gnutls.c: [2] (Emacs) using default verification flags
gnutls.c: [1] (Emacs) setting the trustfile: /etc/ssl/certs/ca-certificates.crt
gnutls.c: [1] (Emacs) gnutls callbacks
gnutls.c: [1] (Emacs) gnutls_init
@dzfranklin
dzfranklin / btctl
Created December 31, 2019 23:20
Wrapper around bluetoothctl
#!/usr/bin/env python3
import sys
import re
import pexpect
class QuitError(Exception):
pass
@dzfranklin
dzfranklin / install.html
Last active April 19, 2020 15:27
Adds a calendar to the wesmaps planning page
<html>
<head>
<title>Add a Calendar to WesMaps</title>
<style>
body {
max-width: 600px;
margin-left: auto;
margin-right: auto;
margin-top: 80px;
margin-bottom: auto;