Skip to content

Instantly share code, notes, and snippets.

import socket
import select
listener = socket.socket()
listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
listener.bind(('', 9001))
listener.listen(5)
running = True
conns = []
diff --git a/dist/atheme.conf.example b/dist/atheme.conf.example
index 30b7db9..7bcf611 100644
--- a/dist/atheme.conf.example
+++ b/dist/atheme.conf.example
@@ -1508,6 +1508,13 @@ botserv {
* to be assigned to that channel.
*/
min_users = 0;
+
+ /* (*)nicklen
@aji
aji / bot.c
Created April 24, 2012 02:02
libunicorn test bot (no sockets)
#include <stdio.h>
#include <string.h>
#include <mowgli.h>
#include <unicorn.h>
// no sockets are done in this file
// connecting to a server can be done with socat
// $ socat EXEC:bot TCP:general.asu.edu:9965
struct botdata {
#include <stdio.h>
#include <string.h>
#include <mowgli.h>
#include <unicorn.h>
struct botdata {
irc_hook_table_t *commands;
int hugs;
@aji
aji / MLL
Created April 24, 2012 22:07
MLL -- My Little License v1
MY LITTLE LICENSE
Version 1, April 2012
Copyright (C) 2012 Twilight Sparkle <[email protected]>
Everypony is permitted to copy and distribute verbatim or modified copies
of this license agreement, but changing it is not allowed.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
/*
* libmowgli: A collection of useful routines for programming.
* linetest.c: Testing of the linebuffer
*
* Copyright (c) 2011 William Pitcock <[email protected]>
* Copyright (c) 2012 Elizabeth J. Myers <[email protected]>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
#!/usr/bin/python
import sys
def fmtip(ip):
s = [ (ip & 0xff000000) >> 24, (ip & 0xff0000) >> 16, (ip & 0xff00) >> 8, (ip & 0xff) ]
return '.'.join([str(x) for x in s])
s = [int(x) for x in sys.argv[1].split('.')]
ip = s[3] + (s[2] << 8) + (s[1] << 16) + (s[0] << 24)
@aji
aji / gist:2802605
Created May 27, 2012 07:31
progress...
[50] alex@theta alicorn $ src/alicorn -v
[05/27/12 07:30:35] config.c:22 [a_config_hash] Loading config file etc/alicorn.conf...
[05/27/12 07:30:35] module.c:155 [a_module_conf_start] Marking all loaded modules for deletion
[05/27/12 07:30:35] config.c:39 [a_config_hash] Calling configuration hook conf.item.account
[05/27/12 07:30:35] account.c:61 [a_account_conf_account] Calling configuration hook conf.item.account.password
[05/27/12 07:30:35] account.c:61 [a_account_conf_account] Calling configuration hook conf.item.account.network
[05/27/12 07:30:35] network.c:54 [a_network_conf_network] 'Adding' network default
[05/27/12 07:30:35] account.c:61 [a_account_conf_account] Calling configuration hook conf.item.account.network
[05/27/12 07:30:35] network.c:54 [a_network_conf_network] 'Adding' network ponychat
[05/27/12 07:30:35] module.c:187 [a_module_conf_end] Deleting all marked modules
@aji
aji / weelog.awk
Created May 27, 2012 22:34
weelog -- easily convert chat logs formatted by weechat into a format more typical of IRC logs
#!/usr/bin/awk -f
BEGIN { FS="\t"; }
{
split($1, timesplit, / +/);
time = timesplit[2]
if (time == "")
time = "--:--:--";
@aji
aji / gist:2816245
Created May 27, 2012 22:36
weelog example output
From this:
2012-05-27 21:08:08 Kabaka serves*
2012-05-27 21:08:13 aji pedo -- password environment do
2012-05-27 21:08:26 Kabaka Lolz, pedo
2012-05-27 21:11:48 <-- Scootaloo ([email protected]) has quit (Read error: Connection reset by peer)
2012-05-27 21:18:07 --> Scootaloo ([email protected]) has joined #geek
2012-05-27 21:34:22 klaxa lol
2012-05-27 21:37:28 aji http://wcs.asu.edu/competition/
2012-05-27 21:37:29 Terminus-Bot Title on wcs.asu.edu: ASU's Annual Programming Competition: 2012