Skip to content

Instantly share code, notes, and snippets.

View zbrasseaux's full-sized avatar

Zachary P. Brasseaux zbrasseaux

View GitHub Profile
x = "This is the string assigned to variable 'x'."
print (x)
print (x)
print (x)
x = 3
y = 4
print (x + y)
print (x - y)
print (x * y)
print (x ** y)
print (x/y)
x = 3
y = "4"
z = 3.14
float(x)
int(y)
str(z)
# This is a comment
'''This is also a comment'''
print ("comments are fun") # but you can't print this
# this comment is used for a single line
"""
but this
comment blocks
# This is a sample for loop.
for i in range (0,11):
# Each iteration prints "i = " followed by whatever i is equal to.
print ("i = " + str(i))
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
# chopping up national pokedex into each region with a bash script
echo "Chopping Kanto"
cat National\ Pokedex\ Gen\ 6\ V5.15.1.1\ -\ Pokedex.csv | head -n 1 > header
cat National\ Pokedex\ Gen\ 6\ V5.15.1.1\ -\ Pokedex.csv | head -n 152 > kantodex.csv
sleep 1
echo "Chopping Johto"
cat header > johtodex.csv
cat National\ Pokedex\ Gen\ 6\ V5.15.1.1\ -\ Pokedex.csv | tail -n 688 | head -n 100 >> johtodex.csv
@zbrasseaux
zbrasseaux / combine_csv.py
Created May 18, 2019 17:25
Python script for combining multiple csv files into one.
import pandas as pd
import sys
'''
usage:
python combine_csv.py <1.csv> <2.csv> ... <n.csv>
will write the final output to standard output
can be written to a new file with:
# usage:
# python sys_argv_demo.py <what> <ever> <you> <want>
import sys
for i in sys.argv:
print(i)
@zbrasseaux
zbrasseaux / analyze_image.py
Created June 14, 2019 05:50
simple program for reading an image, finding SURF interest points, clustering those, determining the centers of the clusters, and drawing circles around these points.
#!/usr/bin/env python3
'''
Usage:
analyze_pic [image] [mode]
modes:
0 : grayscale
1 : color