This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def parse(msg): | |
prefix, trailing = None, None | |
if msg[0] == ':': | |
prefix, msg = msg[1:].split(' ', 1) | |
if msg.find(' :') != -1: | |
msg, trailing = msg.split(' :', 1) | |
args = msg.split() | |
if trailing != None: | |
args.append(trailing) | |
return prefix, args.pop(0), args |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function parse(line) | |
local prefix | |
if line:sub(1,1) == ":" then | |
local space = line:find(" ") | |
prefix = line:sub(2, space-1) | |
line = line:sub(space) | |
end | |
local colonsplit = line:find(":") | |
local last |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "gl.h" | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdbool.h> | |
void sgl_check_gl_error(const char *func, const char *file, int line) | |
{ | |
GLenum error = glGetError(); | |
bool had_error = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local pairs = pairs | |
local setmetatable = setmetatable | |
local unpack = unpack | |
module 'irc.client' | |
local meta = {} | |
meta.__index = meta | |
function meta:add_handler(command, callback) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "task" | |
function dothebox( ) | |
local makeReadOnly = function( t ) | |
proxy = {} | |
mt = {} | |
mt.__metatable = "None of your business!" | |
mt.__index = t | |
mt.__newindex = function( t, k, v ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# encoding: utf-8 | |
# Joshua Simmons 2010 | |
def configure(conf): | |
pass | |
def build(bld): | |
pong = bld( | |
features = 'c cprogram', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local chat_demo = Handler { | |
send_spec = 'tcp://127.0.0.1:9999'; | |
send_ident = '8b7c7833-0932-4d9a-92c3-3b8c06d9b855'; | |
recv_spec = 'tcp://127.0.0.1:9998'; | |
recv_ident = ''; | |
} | |
local chat_demo_dir = Dir { | |
base = 'static/chatdemo/'; | |
index_file = 'index.html'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
josh@josh-laptop:~/Projects/rirc$ ./build/tests/rirc-tests | |
/ringbuffer/new free: OK | |
/ringbuffer/read write: OK | |
/ringbuffer/stream: OK | |
/ringbuffer/wrap around: OK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ring-buffer.h" | |
#include <stdlib.h> | |
#include <string.h> | |
#include <assert.h> | |
RingBuffer *rb_new(size_t size) | |
{ | |
RingBuffer *buf = malloc(sizeof(*buf)); | |
assert(buf != NULL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <errno.h> | |
#include <unistd.h> | |
#include <glib.h> | |
#include <jansson.h> | |
#include <zmq.h> | |
#include <lumberjack.h> | |
#include "timer.h" |
OlderNewer