Skip to content

Instantly share code, notes, and snippets.

View udoprog's full-sized avatar

John-John Tedro udoprog

View GitHub Profile
@udoprog
udoprog / output
Last active August 29, 2015 14:04
; entry := [] [[:+, 10, [:hello, 33]]]
LDC 10
LDC 33
LDF 10
AP 1 ; hello
ADD
RTN
; __let1 := [:f] [[:+, :f, :foo]]
LD 0 0 ; f
LD 1 0 ; foo
@udoprog
udoprog / foo_test.clj
Last active August 29, 2015 14:04
Example lyceum test cases
(use-fixtures :each (rule-fixture spotify.rules.foo))
(deftest test-monitoring-hooks
(testing "Critical hooks should notify through e-mail and pagerduty"
(send-events
{:event-base {:host :host1 :tags ["hook"] :service "some-service"}}
[{:time 0 :state "critical"}
{:time 10 :state "ok"}
{:time 20 :state "ok"}])
(check-externals
@udoprog
udoprog / morse.py
Created May 7, 2011 19:28
A morse code transscriber
import sys
lookup_map={
'A': ".-",
'B': "-...",
'C': "-.-.",
'D': "-..",
'E': ".",
'F': "..-.",
'G': "--.",
@udoprog
udoprog / bashin.sh
Created January 9, 2012 17:52
bashin implemented in bash
#!/bin/bash
FILE=$1
[[ ! -f $FILE ]] && exit 1
function create_args() {
while [[ $# -gt 1 ]]; do
shift
echo -n " \"$1\""
done
@udoprog
udoprog / consumer.py
Last active December 10, 2015 20:28
Celery and Distribution using routing_keys
import logging
from celery import Celery
from kombu import Exchange
from kombu import Queue
# modify this to select which routing_key to consume.
SITE = 'sto'
celery = Celery()
@udoprog
udoprog / line_client.cpp
Created February 3, 2013 20:56
Example of a boost::asio line reader/writer. Compile with: g++ line_client.cpp -lboost_thread -lboost_system -o line_client
#include <cstdlib>
#include <deque>
#include <iostream>
#include <string>
#include <boost/array.hpp>
#include <boost/bind.hpp>
#include <boost/asio.hpp>
#include <boost/thread.hpp>
using boost::asio::ip::tcp;
@udoprog
udoprog / main.lua
Last active December 12, 2015 04:59
example network support in love
-- code for love.network can be found at https://bitbucket.org/udoprog/love-network
function socketError(s, reason)
print("socket error: " .. reason)
end
function socketRead(s, data)
print("socket read: " .. data)
end
@udoprog
udoprog / error.txt
Last active December 16, 2015 17:19
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
@udoprog
udoprog / hiera-update-git.sh
Last active December 17, 2015 11:29
Git Hook
#!/bin/bash
#
# Hook suitable for maintaining hiera directories.
#
# --- Command line
refname="$1"
oldrev="$2"
newrev="$3"
@udoprog
udoprog / torrentcleanup
Last active December 21, 2015 14:59
Script to cleanup stale torrents, and or stale files depending on a list of source directories containing *.torrent files
#!/usr/bin/env python
import itertools
import bencode
import glob
import sys
import os
import shutil