Skip to content

Instantly share code, notes, and snippets.

View colegleason's full-sized avatar

Cole Gleason colegleason

View GitHub Profile
@colegleason
colegleason / rockpaperscissors.py
Created October 8, 2010 04:39
Aw, first code. So cute.
#Rock Paper Scissors
import random
repeat = True
continue_game = True
while(repeat):
total_rounds = input("What is the maximum number of rounds that you wish to play? ")
curr_round = 1
wins = 0
losses = 0
draws = 0
@colegleason
colegleason / greplin1.py
Created October 8, 2010 19:14
what is this i don't even
text = open('gettysburg.txt','r').read()
for x in reversed(range(len(text))):
print "Now on length " + str(x)
done = False
substring = text[0:x]
for i in range((len(text) + 1) - x):
print "Now on position " + str(i)
if x+i <= len(text):
substring = text[0+i:x+i]
if substring == substring[::-1]:
def isPrime(n):
if n < 2: return False
elif n == 2: return True
else:
for x in range(2, int(n**0.5)+1):
if n % x == 0:
return False
return True
def factor(n):
import csv
import itertools
def findsubsets(S,m):
return list(itertools.combinations(S, m))
#numlist = (1, 2, 3, 4, 6)
csvreader = csv.reader(open('numbers.csv','rb'), skipinitialspace=True)
numlist = [int(x) for x in csvreader.next()]
answer = 0
possibles = []
@colegleason
colegleason / working xorg.conf
Created December 26, 2010 21:05
This works with the left and middle monitor on one video card.
Section "ServerLayout"
Identifier "amdcccle Layout"
Screen 0 "amdcccle-Screen[1]-0" 0 0
EndSection
Section "InputDevice"
# generated from default
Identifier "Mouse0"
Driver "mouse"
@colegleason
colegleason / New xorg.conf
Created December 26, 2010 21:07
This is what I am trying to make work.
Section "ServerLayout"
Identifier "DefaultLayout"
Screen 0 "LeftScreen" 0 0
# Screen "RightScreen" RightOf "LeftScreen"
EndSection
Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
@colegleason
colegleason / xorg.conf
Created June 4, 2011 19:11
My current xorg.conf file
Section "ServerLayout"
Identifier "aticonfig Layout"
Screen 0 "aticonfig-Screen[0]-0" 0 0
Screen "aticonfig-Screen[0]-1" RightOf "aticonfig-Screen[0]-0"
Screen "aticonfig-Screen[1]-0" RightOf "aticonfig-Screen[0]-1"
EndSection
Section "Module"
EndSection
@colegleason
colegleason / xorg.conf
Created June 4, 2011 22:14
double double head xorg.conf
Section "ServerLayout"
Identifier "aticonfig Layout"
Screen 0 "aticonfig-Screen[0]-0" 0 0
Screen "aticonfig-Screen[0]-1" RightOf "aticonfig-Screen[0]-0"
Screen "aticonfig-Screen[1]-0" RightOf "aticonfig-Screen[0]-1"
Screen "aticonfig-Screen[1]-1" RightOf "aticonfig-Screen[1]-0"
EndSection
Section "Module"
EndSection
@colegleason
colegleason / hashmap.c
Created September 13, 2011 06:59
Hashmap
#include <stdio.h>
#include <string.h>
#define MAX_KEY 50
#define MAX_HASH 10
typedef struct node {
char key[MAX_KEY];
int value;
struct node *next;
@colegleason
colegleason / .zshrc
Created April 11, 2012 13:17
davesdots meets robbseaton
# .zshrc mashup of davesdots and robbseaton
# "compile slow, run fast." - family motto
export CFLAGS="-O3 -funsafe-loop-optimizations -ffast-math -march=native -pipe"
export CXXFLAGS=${CFLAGS}
# export LDFLAGS=${CFLAGS}
# I think I speak for everyone when I say "fuck gcc"
alias cc="clang -Wall -Wextra -Werror"