Skip to content

Instantly share code, notes, and snippets.

@jabb
jabb / auth.py
Last active May 12, 2022 22:21
GrueBot: A Very Simply IRC Bot Written in Python
from gruebot import Plugin
import hashlib
class auth(Plugin):
def is_authed(self):
return self.get_user() in self.authed
@jabb
jabb / tree.h
Created November 19, 2012 08:07
OpenBSD sys/tree.h
/* $OpenBSD: tree.h,v 1.13 2011/07/09 00:19:45 pirofti Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
@jabb
jabb / jc.c
Created November 19, 2012 05:39
JSON in C source file.
/* Copyright (c) 2012, Michael Patraw
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
@jabb
jabb / jc.h
Created November 19, 2012 05:39
JSON in C header file.
/* Copyright (c) 2012, Michael Patraw
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
@jabb
jabb / point_set.lua
Created March 31, 2012 05:40
Manages set of 2D points.
#!/usr/bin/luajit
local point_set_mt = {}
function point_set_mt:has_point(x, y)
return self._points[x .. ',' .. y] ~= nil
end
function point_set_mt:add_point(x, y)
if not self:has_point(x, y) then
@jabb
jabb / layer.lua
Created March 31, 2012 05:37
Simple 2D layer for games.
#!/usr/bin/luajit
local ffi = require 'ffi'
local layer_mt = {}
function layer_mt:top_left(x, y)
self._x1, self._y1 = x - 1, y - 1
end