Skip to content

Instantly share code, notes, and snippets.

View AlexLamson's full-sized avatar

Alex Lamson AlexLamson

View GitHub Profile
@AlexLamson
AlexLamson / what_to_wear.py
Last active August 29, 2015 14:21
Little python script that prints what to wear by checking the weather in your location
import json
import urllib2
import sys
def internet_on():
try:
response=urllib2.urlopen('http://173.194.204.105',timeout=1)
return True
except urllib2.URLError as err: pass
return False
@AlexLamson
AlexLamson / NiceColors.java
Created October 1, 2013 21:03
Random pleasant color generator, translated to java. Theory taken from http://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/
public class NiceColors
{
public static int colorPos = 0;
//use golden ratio to create pleasant colors
//http://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/
public static Color betterNiceColor()
{
double goldenRatioConj = (1.0 + Math.sqrt(5.0)) / 2.0;
float hue = new Random().nextFloat();
@AlexLamson
AlexLamson / Prob17.java
Last active December 21, 2015 05:28
Originally created for euler problem 17 (https://projecteuler.net/problem=17), this translates numbers to words. Ex. 37 => thirty seven Ex. 123456 => one hundred twenty three thousand four hundred fifty six The highest it can currently reach is 1 million. To do: 1. make it go higher (decillion) 2. clean up a little 3. load the number in chunks o…
import java.math.BigInteger; //http://docs.oracle.com/javase/6/docs/api/java/math/BigInteger.html
public class Prob17
{
public static BigInteger oneHundred = new BigInteger("100");
public static BigInteger oneThousand = new BigInteger("1000");
public static BigInteger tenThousand = new BigInteger("10000");
public static BigInteger oneMillion = new BigInteger("1000000");
public static void main(String[] args)