Skip to content

Instantly share code, notes, and snippets.

View pzp1997's full-sized avatar

Palmer Paul pzp1997

View GitHub Profile
@pzp1997
pzp1997 / Brainfuck.py
Created May 16, 2014 01:55
Brainfuck interpreter written in Python.
## Brainfuck.py by pzp1997 (May 11, 2014)
## Written in Python 3.4.0
def interpreter(program, userInput):
array = [0]*30000
pointer = 0
pc = 0
nest = 1
while pc < len(program):
from random import choice
i = input("Input a sentence: ")
i = i.split(" ")
length = len(i)
for x in range(length):
word = choice(i)
i.remove(word)
print(word, end=" ")
@pzp1997
pzp1997 / WikiRand.py
Last active August 29, 2015 14:02
Easily find random Wikipedia articles
#!/usr/bin/env python2.7
from urllib2 import urlopen, URLError
from json import loads
from webbrowser import open_new_tab
def getArticles():
print "Fetching articles..."
try:
wiki = urlopen("http://en.wikipedia.org/w/api.php?action=query&list="
#!/usr/bin/env python2.7
import smtplib
your_email = ""
your_passwd = ""
def auth():
try:
server = smtplib.SMTP("smtp.gmail.com", 587)
@pzp1997
pzp1997 / Followers.py
Created August 19, 2014 01:51
Python script for discovering who unfollowed you on Instagram (and unfollowing those people).
#!/usr/bin/env python2.7
"""Discovers who unfollowed you on Instagram (and unfollows those people)."""
import json
from webbrowser import open_new_tab
from urllib2 import urlopen, URLError
from urlparse import urlparse
from time import time
from os import rename
@pzp1997
pzp1997 / InstaFollowers.py
Last active August 29, 2015 14:06
Python script for discovering who unfollowed you on Instagram (and unfollowing those people).
#!/usr/bin/env python2.7
"""Discover who unfollowed you on Instagram."""
import json, webbrowser
from urllib2 import urlopen, URLError
from urlparse import urlparse
from time import time
from os import rename, remove
#!/usr/bin/env python2.7
def pig_latin(message):
vowel = ["a", "e", "i", "o", "u"]
message = message.lower().split(" ")
for word in range(len(message)):
if message[word][0] in vowel:
message[word] = message[word] + "way"
else:
i = 1
def isprime(n):
def factorial(n):
product = 1
while n > 0:
product *= n
n -= 1
return product
if n < 2:
return False
return (factorial(n-1) + 1) % n == 0
@pzp1997
pzp1997 / CaesarCipher.py
Last active August 29, 2015 14:06
Command line Python program for encoding/decoding Caesar Ciphers
#!/usr/bin/env python2.7
"""Command line script to encode/decode Caesar Ciphers"""
__author__ = "Palmer Paul"
__version__ = "1.0.0"
__email__ = "[email protected]"
def caesar(pt, n):
from string import lowercase, uppercase
@pzp1997
pzp1997 / HowToProgram.pde
Created October 31, 2014 01:57
Exemplary Processing program that all should take notes from.
int a;
float c3, l4;
String asdf;
float OVER90O0 = 9000 + 1;
int unDer9ooo = 9000 - 1;
Ball notBall;
float[] Th15154l15tNOtan4rrAy = {
2, 3
};