Skip to content

Instantly share code, notes, and snippets.

Avatar

Patrick Fuller patrickfuller

View GitHub Profile
@patrickfuller
patrickfuller / github_issues_to_csv.py
Last active Nov 30, 2022 — forked from unbracketed/export_repo_issues_to_csv.py
Export Issues from Github repo to CSV (API v3)
View github_issues_to_csv.py
"""
Exports issues from a list of repositories to individual csv files.
Uses basic authentication (Github username + password) to retrieve issues
from a repository that username has access to. Supports Github API v3.
Forked from: unbracketed/export_repo_issues_to_csv.py
"""
import argparse
import csv
from getpass import getpass
import requests
@patrickfuller
patrickfuller / alias_dns.py
Last active Jul 30, 2022
Enables local DNS resolution of Unifi aliases
View alias_dns.py
"""
When run in cron, automatically adds compliant alias names to local DNS.
Use at your own risk.
Patrick Fuller, 25 June 17
"""
import re
import paramiko
import pymongo
@patrickfuller
patrickfuller / mcmaster_in_to_mm.js
Last active Apr 6, 2020
Converts inches to mm on McMaster's website.
View mcmaster_in_to_mm.js
$('.dx').each((i, el) => {
let val = $(el).html();
if (val.slice(-1) === '"') {
$(el).html((parseFloat(val.slice(0, -1)) * 25.4).toFixed(1) + ' mm');
}
});
@patrickfuller
patrickfuller / pre-commit
Last active Sep 18, 2019
SCSS compilation pre-commit hook
View pre-commit
#!/bin/bash
# When SCSS is changed in a commit, this compiles and commits the affected css.
# This script assumes a project directory of the form:
# main.scss
# main.css
# scss
# | file_1.scss
# | ...
# | file_n.scss
@patrickfuller
patrickfuller / github_traversal.py
Created Dec 27, 2013
A basic graph traversal script using the Github API. Starting from a specified root-node Github user, this will traverse everyone they are following. This repeats in a breadth-first pattern until a threshold is reached.
View github_traversal.py
import requests
import getpass
import sys
import json
import Queue
# This is a script, let's be lazy. We'll fill up this global and print it.
g = {"nodes": {}, "edges": []}
# And here's the cutoff criterion
MAX_NODES = 1000
View grid_maker.py
"""
Create a custom grid-paper design as a minified vector image.
This uses a unique adaptation of "stroke-dasharray" to create the grid
pattern in a very small svg.
Usage:
python grid_maker.py > grid.svg
python grid_mater.py --help
@patrickfuller
patrickfuller / comparison.py
Last active May 21, 2017
Compares tornado.auth.GoogleMixin with tornado.auth.GoogleOAuth2Mixin. The latter is required after google's OAuth updates.
View comparison.py
"""
A webserver to test Google OAuth in a couple of scenarios.
"""
import argparse
import time
import tornado.ioloop
import tornado.web
import tornado.auth
import tornado.gen
@patrickfuller
patrickfuller / Fe-MIL-100.cif
Last active Jan 4, 2016
A really large P1 crystal.
View Fe-MIL-100.cif
# CIF file generated by openbabel 2.3.90, see http://openbabel.sf.net
data_I
_chemical_name_common ''
_cell_length_a 73.3402
_cell_length_b 73.3402
_cell_length_c 73.3402
_cell_angle_alpha 90
_cell_angle_beta 90
_cell_angle_gamma 90
_space_group_name_H-M_alt 'P 1'
@patrickfuller
patrickfuller / texter.py
Created Jan 12, 2014
Texting from your computer in Python.
View texter.py
import smtplib
from email.mime.text import MIMEText
# Message to be sent
message = MIMEText("Hello, texting!")
# Sending email username/password and receiving phone number
email_username = ""
email_password = ""
phone_number = ""
View CoMOF74.cif
#######################################################################
#
# Cambridge Crystallographic Data Centre
# CCDC
#
#######################################################################
#
# If this CIF has been generated directly or indirectly from an entry in the
# Cambridge Structural Database, then it will include bibliographic, chemical,