Skip to content

Instantly share code, notes, and snippets.

View franklin-e's full-sized avatar

Franklin franklin-e

View GitHub Profile
Verifying my Blockstack ID is secured with the address 1PUEzkFZJswBBEJnmgf4XVGP4KuYDofbeg https://explorer.blockstack.org/address/1PUEzkFZJswBBEJnmgf4XVGP4KuYDofbeg

Keybase proof

I hereby claim:

  • I am franklin-e on github.
  • I am einspruch (https://keybase.io/einspruch) on keybase.
  • I have a public key whose fingerprint is A62A 4F8A 5D62 0C4F 4658 4CFA 4B72 50AC D8FA 113E

To claim this, I am signing this object:

@franklin-e
franklin-e / ig.py
Last active August 29, 2015 14:19
make a jpeg Instagram-friendly
# Takes a jpeg by path, appends '_ig' to the basename,
# centers it on a fitted, square, white background.
# Usage:
# $ python ig.py fabulous_image.jpg
# created fabulous_image_ig.jpg
import Image, os, sys
Verifying that +einspruch is my openname (Bitcoin username). https://onename.io/einspruch
@franklin-e
franklin-e / dupes.py
Last active August 29, 2015 14:09
dupes.py: take jpeg and integers, intelligently create duplicates at indicated sizes
from __future__ import division
import os, sys
from PIL import Image
# Takes jpeg and a series of integers, intelligently creates duplicates at indicated sizes.
# Also replaces spaces with underscores and lowercases filenames.
# Usage:
# $ python dupes.py My\ Fabulous\ Image.jpg 1200 800 500
from itertools import chain
print sum([j for j in chain.from_iterable([(i*i, i*i-i+1, i*i-2*i+2, i*i-3*i+3) for i in range(3,1112,2)])]) + 1
corners = [1]
for i in range(3, 1112, 2):
new_corners = (i*i, i*i-(i-1), i*i-(2 * (i-1)), i*i-(3 * (i-1)))
for corner in new_corners:
corners.append(corner)
print sum(corners)
side = 1111
corners = [1]
stepper = (1, 2, 2, 2)
counter = 1
side -= 1
while counter <= side * side:
counter += 1
for step in stepper:
counter += step
corners.append(counter)
def vector(angle,length):
turnto(angle)
forward(length)
def lcm(values):
'''Returns the least common multiple of a list of integers.'''
values.sort()
biggest = values[-1]
multiplier = 1
while sum([(multiplier * biggest) % value for value in values]) != 0: