I hereby claim:
- I am at1as on github.
- I am willems (https://keybase.io/willems) on keybase.
- I have a public key ASBJanSm1SKbTunlyBBTt_3BFB8mjHGMiLPmvpjFRO9Zlwo
To claim this, I am signing this object:
This tool will take an existing PDF and insert into it (at a given index) a page containing user details, then edit the metadata to match those details (such as a customer name). Finally, it will upload to file to a shared dropbox folder and return its URL. | |
Requirements: | |
* exiftool www.sno.phy.queensu.ca/~phil/exiftool/ | |
* DropBox Access Token | |
* Python 2.7 (dependencies will not work in Python 3) | |
Limitations: | |
* pyPDF2 is unreliable. Does not work on all PDFs | |
* ReportLab PDF size is not reliable - may need to be hardcoded to match document |
#!/usr/bin/env python2.7 | |
# -*- coding: utf-8 -*- | |
''' | |
Returns list of Fibanacci numbers within a given range | |
''' | |
n = [0,1,0] #placeholder: prev,curr,next fibanacci numbers | |
matches = 0 |
A visual representation of area contained within the local maximums of an array of values. Visualised as pools of water between the walls of a structure. Example below. | |
jason$ python waterfall.py | |
Define your structure (comma seperated): 5,1,6,2,4,3,4 | |
| | | | | | | | | |
| | | | | | | | | |
| | | -S- | | | | | | |
| -S- | W | -S- | | | | | | |
| -S- | W | -S- | W | -S- | W | -S- | |
import re | |
''' | |
Will sort two user inputed strings using a natural sorting algorithm (i.e., numbers are assigned their magnitudes) | |
ex. [file2, file10] or [file3abc, file10abc] | |
''' | |
filenames = raw_input("Enter two filenames (comma seperated, no space): ").split(",") | |
def naturalSort(a,b): |
Given an integer, will return a list of all factor branches from the integer to 1. Range of divisors to use can be set through maxDivisor | |
ex. using input 72, and divisors of less than 10: | |
jason$ python factorBranches.py | |
Enter a positive integer (large numbers will yield high runtime): 72 | |
[72, 8, 1] | |
[72, 9, 1] | |
[72, 12, 2, 1] | |
[72, 12, 3, 1] |
#!/bin/usr/env python2.7 | |
# -*- coding: utf-8 -*- | |
d = { '5E': 't', '5D': 'w', '5F': 'u', '5A': 'p', '5C': 'v', '5B': 'q', '48': 'b', '49': 'c', '46': 'l', '47': 'm', '44': 'n', '45': 'o', | |
'42': 'h', '43': 'i', '40': 'j', '41': 'k', '0A': ' ', '4F': 'e', '4D': 'g', '4E': 'd', '4B': 'a', '6B': 'A', '59': 's', '58': 'r', | |
'6F': 'E', '50': 'z', '53': 'y', '52': 'x', '6D' : 'G', '0B' : '!', '07' : '-', '06' : ',', '27' : '\\', '20' : 'n', '4C' : 'f', '6C' : 'F', | |
'C7' : 'í', '64' : 'N', 'C1' : 'ë' } | |
ct = '6B0A6F46484F584F5E420A6D43465E42454443C1462720594346435C584F440A5A4F44444B0A47C75843C1462720450A474F444F460A4B4D464B580A4F464F444B5E420B2720644B0749424B4F584F4E0A5A4B464B44074EC75843C1462720450A4D4B464B4E42584F474743440A4F444445584B5E420627206C4B445F43464559060A464F0A464344444B5E4245442720444F4C0A4B4F4B58060A59C70A444F4C0A4B4F4B5845440B' |
#!/usr/bin/env python2.7 | |
# -*- coding: utf-8 -*- | |
''' | |
Will return the number of carry operations performed in positive integer addition | |
''' | |
carryover, carryCount = False, 0 | |
while True: #accept positive integer values as input | |
try: |
#!/bin/bash/env python2.7 | |
from subprocess import Popen, PIPE, STDOUT | |
import re | |
import datetime | |
site = 'example.com' #enter website URL here | |
favicon = False | |
ssl_enabled = False |
# A Natural Sort Algorithm in one line | |
ITEMS = %W(item1 item2 item11 item1 item20 item3 hello other_item other_item7 item) | |
TRAILING_NUM = /[0-9]*\Z/ | |
natural_sorted = ITEMS.sort.chunk{ |y| y.gsub(TRAILING_NUM, '') }.to_a.map{ |k_v| k_v[1] }.each{ |x| x.sort_by!{ |z| z.scan(TRAILING_NUM).first.to_i }}.flatten | |
puts natural_sorted | |
# => ["hello", "item", "item1", "item1", "item2", "item3", "item11", "item20", "other_item", "other_item7"] |
I hereby claim:
To claim this, I am signing this object: