Skip to content

Instantly share code, notes, and snippets.

View udoprog's full-sized avatar

John-John Tedro udoprog

View GitHub Profile
public class SerializerTest {
public abstract class SerializerBase<T extends SomeType> implements Serializer<T> {
private final Serializer<Integer> number;
public SerializerBase(final SerializerFramework s) {
this.number = s.fixedInteger();
}
@Override
public void serialize(SerialWriter buffer, T value) throws IOException {
@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 / 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 / sshd.rc6
Created January 3, 2014 13:06
openrc vs systemd
#!/sbin/runscript
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/openssh/files/sshd.rc6,v 1.28 2011/12/04 10:08:19 swegener Exp $
extra_commands="checkconfig gen_keys"
extra_started_commands="reload"
depend() {
use logger dns
@udoprog
udoprog / mumble-broadcast
Created August 23, 2013 20:56
Send a broadcast message to all members on a mumble server
#!/usr/bin/env python
import dbus
import collections
import sys
import os
if __name__ == "__main__":
if len(sys.argv) < 2:
print "Usage: mumble-broadcast <message>"
sys.exit(1)
@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
@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 / 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 / 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 / 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;