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 os, sys | |
from time import gmtime, strftime | |
from stat import * | |
def walktree(top, callback): | |
for f in os.listdir(top): | |
pathname = os.path.join(top, f) | |
mode = os.stat(pathname)[ST_MODE] | |
if S_ISDIR(mode): | |
# It's a directory, recurse into it |
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
current_datetime = datetime.datetime.now(ustimezones.pacific()) # What time is it in California? | |
delta = str(current_datetime.replace(tzinfo=None) - date_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
# The famous @johlcat script, generated as a birthday present for @johl. | |
# The script requires the following gems: twitter and lolspeak. | |
# It reads all tweets tweeted in the last hour and retweets them to | |
# another twitter account, but in lolspeak. | |
# | |
# Have phun! | |
# | |
# Author: Svenja Schroeder | |
# github: http://github.com/svenja | |
# twitter: http://www.twitter.com/sv |
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 re | |
from github2.client import Github | |
def get_last_commit(): | |
last_commits = [] | |
github = Github(username="xxx", api_token="xxx") | |
for repo in github.repos.list() + github.repos.pushable(): | |
for branch in github.repos.branches(repo.project): | |
commits = github.commits.list(repo.project, branch) | |
for commit in commits: |
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 requests, json # ggf. requests (http://docs.python-requests.org/en/latest/index.html) installieren mit 'pip install requests' | |
base_url = "https://lqfb.piratenpartei.de/pp/" # oder einen anderen Basis-URL für eine andere LQFB-Instanz | |
key = "xxxxxxx" # Zu finden unter https://lqfb.piratenpartei.de/pp/member/developer_settings.html | |
r = requests.get(base_url + "/api/initiative.html?key=" + key + "&api_engine=json") | |
initiatives = json.loads(r.content) | |
print "Letzte Initiativen: " | |
for initiative in initiatives: | |
print initiative["name"] |
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
BITCOIN_EXECUTABLE = '/Applications/Bitcoin.app/Contents/MacOS/bitcoin' and require 'bitcoin' | |
require 'json' | |
require 'rest_client' | |
currency = 'EUR' | |
balance = Bitcoin::Client.getinfo()['balance'] | |
balanceCUR = JSON.parse(RestClient.get "https://mtgox.com/api/0/data/ticker.php?Currency=#{currency}".to_str)['ticker']['avg'] * balance | |
puts "You have #{balance} BTC, which is currently #{balanceCUR} #{currency}." |
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
f = fopen (filename, "ab"); /* reopen in binary append mode */ | |
for (y = height - 1; y >= 0; y--) | |
{ | |
for (x = 0; x < width; x++) | |
{ | |
i = (y * width + x) * 4; | |
printf ("i is now: %i\n", i); | |
if (ptr != 0) | |
{ | |
fputc (ptr[i + 2], f); /* write blue */ |
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
--[[ | |
A module to generate a random curry recipe. Uses some functional programming techniques to archieve | |
an incredibly trivial goal, but you might learn a thing or two about Lua. | |
Invoke it like this: | |
{{#invoke:Curry.lua|curry|{{CURRENTTIMESTAMP}}|}} | |
Jens Ohlig 17:47, 2 June 2012 (UTC) | |
--]] |
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
$nyan = array(); | |
$nyan['nyan'] =& $nyan; | |
$nyan['cat'] = 'nyan'; | |
echo $nyan['nyan']['nyan']['nyan']['nyan']['nyan']['nyan']['nyan']['nyan']['nyan']['nyan']['nyan']['nyan']['nyan']['nyan']['nyan']['nyan']['nyan']['nyan']['nyan']['nyan']['cat']; |
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.Random; | |
import java.util.Arrays; | |
public class BogoSort { | |
public static int[] array = {2,5,6,3,1,73,46}; | |
public static int[] shuffle(int[] a) { | |
int n = a.length; | |
Random random = new Random(); |
OlderNewer