Skip to content

Instantly share code, notes, and snippets.

View udoprog's full-sized avatar

John-John Tedro udoprog

View GitHub Profile
@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
@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 / 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