This file contains hidden or 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
# imports image module from the PIL libary | |
from PIL import Image | |
# opens the favicon as an object to read the pixel values | |
im = Image.open('Favicons/InNOut.png') | |
# alphabet string to make the keys of the dictionary | |
alphabet = 'abcdefghijklmnopqrstuvwxyz' | |
# gets the frequencies of all the pixel values as an RGB tuple and stores them as a list |
This file contains hidden or 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
# Imports Natual Language Tool Kit | |
import nltk | |
# Imports CMU Pronunciation Dictionary from NLTK Corpus | |
from nltk.corpus import cmudict | |
# Imports Random | |
import random | |
full_dict = cmudict.entries()[:] |
This file contains hidden or 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
#The file python.txt contains the raw html lines that contain the word 'Python' ( scrapped from rwet.decontextualize.com ) | |
#imports the regular expression libraries | |
import re | |
file = open("python.txt","r"); #opens the text file in read mode | |
f = file.read(); #reads the text file into a string | |
t = re.sub('<[^<]+?>', '', f).replace("Python","Monty Python"); #strips the html code and replaces the word "Python" with "Monty Python" | |
t = t.replace('e','ing'); #this code replaces all occurrences of "e" with "ing" #Adds more fun when impersonated as a non-native english speaker | |
print t #prints the lines |
This file contains hidden or 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 is a comment in Python | |
import sys #imports system files | |
for line in sys.stdin: | |
line = line.strip() # Strips a string of its trailing white spaces # Tabs tell python that it is part of the loop | |
word = line.split(' ') # Makes a list of substrings by using space as as delimiter | |
s = ' '.join(word[::-1]) # [::-1] reverses the contents of a list # The syntax for join is counter intuitive, first you write the delimiter and then the list. | |
print s # Prints the string |
This file contains hidden or 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
tr 'A-Z' 'a-z'| tr 'abcdefghi' '123456789' | tr 'j' '10' | tr 'k' '11' | tr 'l' '12' | tr 'm' '13' | tr 'n' '14' | tr 'o' '15' | tr 'p' '16' | tr 'q' '17' | tr 'r' '18' | tr 's' '19' | tr 't' '20' | tr 'u' '21' | tr 'v' '22' | tr 'w' '23' | tr 'x' '24' | tr 'y' '25' | tr 'z' '26' |
This file contains hidden or 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 sys #imports system files | |
for line in sys.stdin: | |
line = line.strip() # Tabs tell python that it is part of the loop | |
word = line.split(' ') | |
s = '' | |
for i in range(1,len(word)+1): | |
s = s + word[len(word)-i] + ' ' | |
print s |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<meta charset="utf-8"> | |
<style> | |
body { | |
font: 10px sans-serif; | |
} | |
svg { |
This file contains hidden or 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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<title>Superformula</title> | |
<script src="http://d3js.org/d3.v2.min.js"></script> | |
<script src="https://raw.github.com/d3/d3-plugins/master/superformula/superformula.js"></script> | |
<style> | |
path { | |
stroke-width: 1.5px; | |
} |