This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2.7 | |
''' | |
This program will add a number to its reverse until a palindrome is found | |
It will try up to 1000 iterations (configurable), or else notify the user a palindrome was not found | |
''' | |
count, maxIterations, currentValue = 1, 1000, '' | |
#Accept integers in range(1,100) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2.7 | |
''' | |
Return the count of zeros contained in the numbers within a specified range | |
''' | |
index, increment, count = 1, 2, 0 | |
ceiling = int(raw_input("\nCeiling: ")) | |
oddEven = raw_input("Search through:\nOdd numbers \t- 1 \nEven numbers \t- 2 \nOdd & Even \t- 3\n\nInput(1,2,3)? ") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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- | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
OlderNewer