Skip to content

Instantly share code, notes, and snippets.

@aji
aji / unicorn.py
Created January 8, 2013 15:45
libunicorn ported to python
#!/usr/bin/env python3
from collections import namedtuple
IRC_Source = namedtuple('IRC_Source', 'nick ident host')
IRC_Message = namedtuple('IRC_Message', 'source command args')
def message_source_parse(spec):
spec, _, host = spec.partition('@')
nick, _, ident = spec.partition('!')
@aji
aji / .vimrc
Created January 13, 2013 20:41
autocmd!
set title
set wildmenu
syntax on
set noexpandtab
set softtabstop=8
set shiftwidth=8
@aji
aji / msgsay.py
Last active March 19, 2018 07:36
WeeChat script to run private messages through a text to speech program, though theoretically other uses are possible
import weechat
hist = {}
histlen = 32
# [head, ..., tail]
queue = []
def enqueue(msg):
global queue
if msg is None:
[11:00:27] --> ultamatum ([email protected]) has joined #minecraftforge
[11:01:21] <ultamatum> can someone help please 2013-02-14 17:57:54 [INFO] [ForgeModLoader] Forge Mod Loader version 4.7.4.520 for Minecraft 1.4.7 loading
[11:01:22] <ultamatum> 2013-02-14 17:58:06 [INFO] [STDOUT] 27 achievements
[11:01:22] <ultamatum> 2013-02-14 17:58:06 [INFO] [STDOUT] 210 recipes
[11:01:22] <ultamatum> 2013-02-14 17:58:07 [INFO] [STDOUT] Setting user: Player992, -
[11:01:22] <ultamatum> 2013-02-14 17:58:07 [INFO] [STDERR] Client asked for parameter: server
[11:01:23] <ultamatum> 2013-02-14 17:58:08 [INFO] [STDOUT] LWJGL Version: 2.4.2
[11:01:25] <ultamatum> 2013-02-14 17:58:11 [INFO] [ForgeModLoader] Attempting early MinecraftForge initialization
[11:01:27] <ultamatum> 2013-02-14 17:58:11 [INFO] [STDOUT] MinecraftForge v6.6.0.497 Initialized
[11:01:28] <`3ICE> stop that!
@aji
aji / ed.c
Created March 12, 2013 21:46
4.3 BSD ed
#ifndef lint
static char sccsid[] = "@(#)ed.c 4.5 (Berkeley) 8/12/86";
#endif
/*
* Editor
*/
#define CRYPT
#include <signal.h>
? f(n)=if(n==0,1,2^f(n-1))
%4 = (n)->if(n==0,1,2^f(n-1))
? f(2)
%5 = 4
? f(3)
%6 = 16
? f(4)
%7 = 65536
? f(5)
%8 = 20035299304068464649790723515602557504478254755697514192650169737108940595563114530895061308809333481010382343429072631818229493821188126688695063647615470291650418719163515879663472194429309279820843091048559905701593189596395248633723672030029169695921561087649488892540908059114570376752085002066715637023661263597471448071117748158809141357427209671901518362825606180914588526998261414250301233911082736038437678764490432059603791244909057075603140350761625624760318637931264847037437829549756137709816046144133086921181024859591523801953310302921628001605686701056516467505680387415294638422448452925373614425336143737290883037946012747249584148649159306472520151556939226281806916507963810641322753072671439981585088112926289011342377827055674210800700652839633221550778312142885516755540733451072131124273995629827197691500548839052238043570458481979563931578535100189920000241419637068135598404640394
@aji
aji / nc.c
Created March 27, 2013 23:44
netcat clone hacked together in 30 minutes
#include <stdio.h>
#include <sys/socket.h>
#include <netdb.h>
#include <stdarg.h>
#include <string.h>
#include <arpa/inet.h>
#include <sys/select.h>
#define LG_SEVERE 0
#define LG_ERROR 1
class linebuf:
def __init__(self):
self.s = ['']
def data(self, data):
self.s[-1:] = (self.s[-1] + data).split('\r\n')
lines, self.s = self.s[:-1], self.s[-1:]
return lines
@aji
aji / ajibot.py
Last active December 16, 2015 02:09
import sys, socket, shlex
from random import choice, randint
class linebuf:
def __init__(self):
self.s = ['']
def data(self, data):
self.s[-1:] = (self.s[-1] + data).split('\r\n')
lines, self.s = self.s[:-1], self.s[-1:]
return lines
import weechat as w
import re
weechat = w
SCRIPT_NAME = "welshify"
SCRIPT_AUTHOR = "aji"
SCRIPT_VERSION = "0.1"
SCRIPT_LICENSE = "GPL3"
SCRIPT_DESC = "Transform all your input to welsh, based on uppercase.py"