Skip to content

Instantly share code, notes, and snippets.

@johl
johl / gist:5281890
Last active December 15, 2015 15:29
λ z → z (λ s → λ z → s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s
(s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s
(s (s (s z)))))))))))))))))))))))))))))))))))))))))))) (λ z → z (λ s → λ
z → s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s
(s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s
(s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s
z))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) (λ z
→ z (λ s → λ z → s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s
(s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s
(s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s (s
Dear Princess Celestia: Letter about the great and powerful Fizzbuzz.
I learned about Fizzbuzz:
Did you know that Rainbow Dash likes 1, because she wants to be number 1 in everything?
I said Rainbow Dash!
Did you know that Pinkie Pie likes 3, because she's so random?
Did you know that Applejack likes 5, because it's a pretty down-to-earth number?
I did this while Rainbow Dash had less than 101:
Rarity made remainder of Rainbow Dash and Pinkie Pie, because she is just stylish like that!
Fluttershy made remainder of Rainbow Dash and Applejack, because even her sneezes are graceful!
@johl
johl / gist:3895222
Created October 15, 2012 20:31
BogoSort
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();
@johl
johl / nyan.php
Last active October 9, 2015 10:28
$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'];
--[[
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)
--]]
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 */
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}."
@johl
johl / lqfb.py
Created October 31, 2011 10:15
Letzte Initiativen im LiquidFeedback der Piratenpartei unter Python mit der API abrufen: So einfach geht das!
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"]
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:
# 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