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 urllib2,json,time,urllib2,getpass,hashlib,sys | |
from datetime import datetime | |
try: | |
f = open ("date.txt", "r") | |
date = json.load(f) | |
print "Date loaded is " +str(datetime.utcfromtimestamp(1356645899)) | |
f.close() | |
except IOError: | |
print "File not found" |
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 | |
weapon_nouns = ["Bat","Bottle","Fists","Launcher","Knife","Axe","SMG","Kukri","Syringe Gun","Flame Thrower","Sticky Launcher","Huntsman","Saw","Shotgun","Revolver"] | |
weapon_adjectives = ["Pain","Direct","Charging","Power","Eternal","Black","Crusader's","Back","Steel","Volcano","Persian","Family","Disciplinary","Atomic"] | |
hat_nouns = ["Hat","Cap","Helmet","Beanie","Fedora","Beard","Earbuds","Bucket","Mask","Head","Gasmask"] | |
hat_adjectives = ["Fancy","Mining","Football","Towering","Expensive","Detective","Splendid","Last"] | |
class Item: | |
def __init__(self): |
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
function randomChoice(array) | |
{ | |
var random = Math.random(); | |
random *= array.length; | |
random = Math.floor(random); | |
return array[random] | |
} |
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 sys,time,os | |
try: | |
file = open(sys.argv[1]) | |
except IndexError: | |
print "Error: please provide a file" | |
raw_input( "Press any key to exit") | |
print "Opened {0}".format(sys.argv[1]) | |
lines = "" |
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
//To run open a deathmatch server and run this script. Other modes work too but they sometime require a changelevel | |
game_type 3 // Setting the game to deathmatch (might need a changelevel if the server was running a non-dm mode) | |
game_mode 2 | |
//mp_damage_scale_ct_body 0.25 //Couldnt get these settings to work | |
//mp_damage_scale_ct_head 2 //(Got them from the official valve wiki) | |
mp_teamname_1 "Zombies" |
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 glob | |
import imp | |
from os.path import join, basename, splitext | |
def importModules(dir): | |
modules = [] | |
methods = [] | |
for path in glob.glob(join(dir, '[!_]*.py')): | |
name, ext = splitext(basename(path)) |
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
PlayerModels = {} | |
PlayerModels["female"] = { | |
"models/player/group01/female_01.mdl", | |
"models/player/group01/female_02.mdl", | |
"models/player/group01/female_03.mdl", | |
"models/player/group01/female_04.mdl", | |
"models/player/group01/female_05.mdl", | |
"models/player/group01/female_06.mdl", | |
"models/player/group01/female_07.mdl", | |
"models/player/group03/female_01.mdl", |
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.awt.Robot | |
import java.awt.event.{InputEvent,KeyEvent} | |
class SimpleBot extends Robot{ | |
val lmb = InputEvent.BUTTON1_MASK | |
val rmb = InputEvent.BUTTON2_MASK | |
val min_delay = 200 | |
def leftClick(){ | |
this.mousePress(lmb) |
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 mySqrt (a, precision): | |
curr_guess = a/2 | |
last_guess = curr_guess*2 | |
iterations = 1 | |
while (abs(last_guess - curr_guess) > precision): | |
last_guess = curr_guess | |
curr_guess = (a/curr_guess + curr_guess)/2 | |
iterations+=1 | |
print("Square root for {0} is {1}".format(a, curr_guess)) |
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 answer(y, x): | |
# Make sure we are always comparing the smaller list to the larger list. | |
if (sum(x) > sum(y)): | |
y,x = x,y | |
# The quotient of each one of the matching elements in an array | |
result = [b/a if a else 0 for a,b in zip(sorted(y), sorted(x))] | |
# Average percentage of increase, rounded up to one. | |
return int(100 - (sum(result) / float(len(result))) * 100) |
OlderNewer