Skip to content

Instantly share code, notes, and snippets.

View patrickfuller's full-sized avatar

Patrick Fuller patrickfuller

View GitHub Profile
@patrickfuller
patrickfuller / image_stacker.py
Created March 30, 2014 21:15
Combines multiple images of the same size into a composite image.
"""
Combine multiple images of the same size vertically. Usage:
python image_stacker.py path/to/img_1.jpg path/to/img_2.jpg ... img_n.jpg
"""
import sys
from PIL import Image
size = (1920, 1080 * len(sys.argv[1:]))
output = Image.new('RGB', size)
for i, image in enumerate(sys.argv[1:]):
@patrickfuller
patrickfuller / sample_output.txt
Created January 7, 2015 21:06
Modbus Holding Register Scanner
40001: 0000110000000001
40002: 0000100000000001
40003: 0000000000000000
40004: 0000000000000000
40005: 0000000000000000
40006: 0000000000000000
40007: 0000000100000010
40008: 0000000000011100
40009: 0100001010001011
40010: 0101100111101011
@patrickfuller
patrickfuller / regex.md
Created June 27, 2015 16:56
Python single quote replacement

The goal is to replace individual double quotes " with single quotes ' without affecting docstring triple double quotes """.

%s/([^"])"([^"])/$1'$2/g
@patrickfuller
patrickfuller / zn_bdc_dabco.cif
Created July 23, 2015 23:04
Zn-BDC-DABCO Conformers
#######################################################################
#
# This file contains crystal structure data downloaded from the
# Cambridge Structural Database (CSD) hosted by the Cambridge
# Crystallographic Data Centre (CCDC).
#
# Full information about CCDC data access policies and citation
# guidelines are available at http://www.ccdc.cam.ac.uk/access/V1
#
# Audit and citation data items may have been added by the CCDC.
@patrickfuller
patrickfuller / CoMOF74.cif
Created September 3, 2013 03:27
Test MOFs
#######################################################################
#
# 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,
@patrickfuller
patrickfuller / texter.py
Created January 12, 2014 21:24
Texting from your computer in Python.
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 = ""
@patrickfuller
patrickfuller / Fe-MIL-100.cif
Last active January 4, 2016 04:39
A really large P1 crystal.
# 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 / comparison.py
Last active May 21, 2017 17:39
Compares tornado.auth.GoogleMixin with tornado.auth.GoogleOAuth2Mixin. The latter is required after google's OAuth updates.
"""
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 / grid_maker.py
Last active October 10, 2018 13:40
Grid Maker
"""
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 / github_traversal.py
Created December 27, 2013 06:19
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.
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