Skip to content

Instantly share code, notes, and snippets.

View AndrewHanes's full-sized avatar

Andrew Hanes AndrewHanes

View GitHub Profile
#!/bin/bash
USERNAME="foo"
PASSWORD="bar"
for i in `seq 0 60`; do
curl --data "username=${USERNAME}&password=${PASSWORD}" https://api.gatekeeper.csh.rit.edu/pop/4 --insecure
sleep 5
done
### Keybase proof
I hereby claim:
* I am AndrewHanes on github.
* I am ahanes (https://keybase.io/ahanes) on keybase.
* I have a public key whose fingerprint is FCB8 D980 85D7 3734 26F8 36C0 224D 9156 3C3A 22DC
To claim this, I am signing this object:
@AndrewHanes
AndrewHanes / share.py
Created September 3, 2014 22:52
Quick script to share a file over network
#!/usr/bin/python
import sys
import os
import tornado.web
import tornado.ioloop
path = ""
if len(sys.argv) != 2:
print("Usage %s file" % sys.argv[0])
exit(-1)
@AndrewHanes
AndrewHanes / rand.java
Created June 1, 2014 17:50
Random number picker
import java.util.*;
public class rand {
public static void main(String[] args) {
ArrayList<Integer> al = new ArrayList<Integer>();
for(int i = 0; i < 10; ++i) {
al.add(i);
}
Random r = new Random();
ArrayList<Integer> result = new ArrayList<Integer>();
for(int i = 0; i < 5; ++i) {
import sys
import time
from random import shuffle
from random import randint
def setup(n):
lst = []
for i in range(n):
lst.append(i)
shuffle(lst)
return lst
@AndrewHanes
AndrewHanes / prefix.py
Last active August 29, 2015 13:56
Prefix Equation Generator
#!/bin/python
from random import *
import sys
"""
Generate a prefix expr of maxlength l
"""
def generateExpression(l):
funcs = {'+': lambda a, b: a + b, '-': lambda a, b: a - b, '*': lambda a, b: a * b}
isInt = random()
if(l == 0):