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 java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Collections; | |
import java.util.List; | |
import java.util.Random; | |
/** | |
* A static utility class for generating random maps for a dungeon-crawler. | |
* | |
* @author Eric |
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
_={_=_G}for--[[]]__--[[]]in(next),_["_"]do(_)[_]=(__)_[#_[_]],_[_[_]:byte(-#"#" | |
)+#_[_]-(#{}+#"(#''"*#"*#*#*"*#"_[_[]]")]=_[_],_[_]end(_)[_]=_._[_[#""]]{[_._[_ | |
[#""]]]=_}_[""]=_._[_._[_[#[=[=#=]=]*-((#[=[#[=]#]=]))]](_._[_[-#[[_[-#[#_[_]]] | |
](_))]_[";"]=_._[_[#"#"+(#")#^")^#"#^"]]_["'"]=[[sub]]_['"']=_[""][_["'"]]_["/" | |
]=[[/_)=.,[#"('*:^;+]]_["'"]=_[""][_['"'](_[-#[[=[=]=]]],-#",_",-#"..").._["'"] | |
]_["["]=_['"'](_[-#"#-]_"],#",",#{_}).._['"'](_[-#"-"],#",",#"#").._['"'](_[-(# | |
"^#^")^#"^#"],#"-",#"(").._['"'](_[#_[-#"#"]*-#"[#"],#_[-#"#"],#_[-#"#"]).._['' | |
..'"'](_[-#[[=[]=]]],#_["/"]/#_["/"],#"/").._['"'](_[-(#"#)-")^#[[""]]],-#"-,", | |
-#[=[[]]=])_["]"]=_['"'](_[-#_[-#"-"]],#",",#"#").._[";"](_["["]..[=[('\]=]..(# | |
'#).'*#',..]]'*#'",#"#",'-#'(').."')")().._['"'](_[-#_[-#"-"]],-#_[-#"-"]-#"-", |
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
/Library/ | |
/Temp/ | |
*.blend* | |
!*.blend | |
!*.meta |
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
"bash rotate_display flip" | |
m:0x0 + c:161 | |
NoSymbol |
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
def avalanche(sequence, print_all=False): | |
states = ['1', '2'] | |
emissions = {} | |
emissions[('1', 'C')] = .1 | |
emissions[('1', 'C#')] = .1 | |
emissions[('1', 'D')] = .4 | |
emissions[('1', 'D#')] = .4 | |
emissions[('2', 'C')] = .4 |
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/bin/python | |
# -*- coding: utf-8 -*- | |
# [SNIPPET_NAME: Screen Rotate] | |
# [SNIPPET_DESCRIPTION: Shows a widget to rotate screen] | |
# [SNIPPET_AUTHOR: Eric Fruchter <[email protected]>] | |
# [SNIPPET_LICENSE: GPL] | |
# | |
import gtk |
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
package test; | |
import static org.junit.Assert.assertFalse; | |
import static org.junit.Assert.assertTrue; | |
import org.junit.Test; | |
/** | |
* A not-very-efficient hashmap with an array as a base. | |
* |
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 time | |
import json | |
import urllib2 | |
import csv | |
def geocode(a): | |
h = a.replace(' ', '+') | |
req = 'http://maps.googleapis.com/maps/api/geocode/json?address=' + h + '&sensor=false' | |
data = json.load(urllib2.urlopen(req)) | |
ploc = data['results'] |
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
#python 2.7 | |
from __future__ import division | |
padding = '|' | |
cipher_key = 'abcdefghijklmnopqrstuvwxyz ' | |
cipher_key_length = len(cipher_key) | |
# A shift cipher. Can also use a key, turning it into a vernam cipher. | |
# text = the text | |
# key = the key. Can be a number or a string. |
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 | |
# This method randomly picks a single choice from a collection of choices. | |
# freq_tuples: List of tuples of the form: (choice, count) | |
# Returns a choice, or None if empty list. | |
def weighted_random_selection(freq_tuples): | |
if len(freq_tuples) == 1: | |
return freq_tuples[0][0] | |
sorted_freq_tuples = sorted(freq_tuples, key = lambda tup : tup[1], reverse=True) | |
total = sum([count for gram, count in freq_tuples]) * random.random() |
OlderNewer