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/local/bin/python | |
base = int(input('Find Factors of: ')) | |
FACTORS = [] | |
for i in range(1,base+1): | |
if base %i == 0: | |
FACTORS.append(i) | |
print 'Possible Factors: {} = {}'.format(base, FACTORS) | |
for factor in FACTORS: | |
print factor,'x',base/factor |
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
#!/user/local/bin | |
# filename: nocomma.py | |
namesinalist = "jack,myra,Darwin,Daryl,Christine" | |
namesinalist = namesinalist.split(",") | |
print "----with final comma--------------------" | |
for name in namesinalist: | |
#with final comma | |
print name+',', | |
text = """ |
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 numpy as np | |
import matplotlib.pyplot as plt | |
""" | |
Divides a single column of a numpy array | |
in odd and even rows. Then graphs the odd | |
rows and the even rows seperatley | |
""" | |
# Numpy array - single column | |
sc = np.load("s-Numy-plot.npy") | |
# Odd numbers of the single column |
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
# Find Source of SymLinks | |
""" | |
Usage: | |
In this case I am using - /user/bin however you may use any directory that is a /bin | |
If a symlink exists it will print the source in the following fowmat: | |
jack@jack-desktop:~/char-rnn$ python fs.py | |
('Ardour5', '->', '/opt/Ardour-5.5.0/bin/ardour5') | |
('LightTable', '->', '/home/jack/Desktop/desktop/pycode/lighttable-0.8.1-linux/LightTable') | |
('MODULES', '->', '/home/jack/Desktop/MODULES') | |
('WHATZUP', '->', '/home/jack/Desktop/WHATZUP') |
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 random | |
def main(): | |
a = "A,The" | |
b = "dog,cat,little kid,elephant,mouse,ugly neighbor kid,princess,clown,chimp,priest" | |
c = "ran,cried,ate,made noise,jumped,slept,stepped on a spider" | |
d = "and said `hello` to the gerbil,and then ate the fish,with the turtle" | |
e = "without stopping,and called for his mother,along side his friend " | |
f = "didn't get to go to the zoo for crying., had to go home to eat.\ | |
,loved to eat pizza for breakfast.,just like a little piggy - cried all the way home" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
""" | |
Usage: python remove_output.py notebook.ipynb [ > without_output.ipynb ] | |
Modified from remove_output by Minrk | |
""" | |
import sys | |
import io | |
import os | |
from IPython.nbformat.current import read, write |
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 is the error I got: | |
def join_path(self, template, parent): | |
\n in template() | |
\nTemplateAssertionError: no filter named 'tojson'\n | |
I tried different versions of jinja2, but the error remained. | |
ref: | |
https://github.com/pallets/jinja/pull/456/commits/7b4393dc86f17d67e1711cd9aa02ff40366519b4 |
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/local/bin/python | |
import sys | |
import sqlite3 | |
conn = sqlite3.connect("WHATZUP.db") | |
c = conn.cursor() | |
if len(sys.argv) < 3: | |
print "\n*****************************************" | |
print "Not enough options were passed." | |
print "WHATZUP requires 2 arguments. the first -H , -R , -I , -D or -S .\nThe second can be a period." | |
print "If wanting to read all entries use -R . (use the period)" |
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
from collections import Counter | |
from random import choice | |
import re | |
class Cup: | |
""" A class defining a cup that will hold the words that we will pull out """ | |
def __init__(self): | |
self.next_word = Counter() # will keep track of how many times a word appears in a cup |