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/env python | |
""" | |
A script to query the Amazon Web Services usage reports programmatically. | |
Ideally this wouldn't exist, and Amazon would provide an API we can use | |
instead, but hey - that's life. | |
Basically takes your AWS account username and password, logs into the | |
website as you, and grabs the data out. Always gets the 'All Usage Types' |
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/env python | |
# The exercise is to make a start-able config file | |
# | |
# This file contains some settings and minimal code to make it run. | |
name = "Anonymous" | |
weight = 80 | |
size = 1.80 |
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
{ | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": "ec2:*", | |
"Resource": "*" | |
} | |
] | |
} |
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/env python | |
print "Fange an zu zaehlen..." | |
# wir starten mit einem Korn auf Feld 1 | |
koerner_auf_feld = 1 | |
# und haben am Anfang ein Korn im Sack | |
sack = 1 | |
# fuer jedes Feld nach dem ersten (also Nummer 2 bis 64) | |
for x in range(2,65): |
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
#!/bin/bash | |
# (BSD 3-Clause / "BSD New" / "BSD Simplified") | |
# Copyright (c) 2011, Hinnerk Haardt | |
# <haardt@information-control.de> All rights reserved. | |
# | |
# Redistribution and use in source and binary forms, with or | |
# without modification, are permitted provided that the following | |
# conditions are met: | |
# |
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
from random import random | |
import multiprocessing | |
from datetime import datetime | |
def run_simulation(throws=1000000): | |
hits = 0 | |
count = 0 | |
while count < throws: | |
count += 1 | |
x = 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 time | |
def test_time(): | |
collisions = 0 # number of collisions | |
dist = {} # distinct values | |
microsecond = 0.000001 | |
count = 0 | |
while count < 1000000: | |
count += 1 | |
t1 = time.time() |
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
class Event(object): | |
def __init__(self, **kwargs): | |
for k, v in kwargs.iteritems(): | |
setattr(self, k, v) | |
class Observable(object): | |
def __init__(self): | |
self.callbacks = set() |
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
#!/bin/sh | |
DEBUG="yes" | |
filename="INIT_NO_FILE" | |
TODIR="$HOME/Library/Application Support" | |
FROMDIR="`pwd`" | |
# Functions | |
debugmessage() { | |
test $DEBUG = yes && |
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 | |
value_list = [random.randint(0,0xff) for x in range(0,512)] | |
import operator | |
def mul_1(value_list): | |
""" | |
mixed | |
>>> mul_1((116, 101, 115, 116, 32, 116, 101, 115, 116, 32, 116, 101, 115, 116)) |
OlderNewer