Skip to content

Instantly share code, notes, and snippets.

View daurnimator's full-sized avatar

daurnimator

View GitHub Profile
@daurnimator
daurnimator / ThreadPool.zig
Last active January 3, 2021 18:09 — forked from kprotty/ThreadPool.zig
simple http server compatible with wrk for linux using epoll
const std = @import("std");
const system = switch (std.builtin.os.tag) {
.linux => std.os.linux,
else => std.os.system,
};
const ThreadPool = @This();
max_threads: u16,
counter: u32 = 0,
@daurnimator
daurnimator / changelog
Last active June 7, 2019 05:28 — forked from fmitha/rules
luarocks (3.1.3-1) unstable; urgency=medium
* New upstream release
-- Daurnimator <[email protected]> Fri, 07 Jun 2019 15:00:00 +1000
luarocks (2.4.2+dfsg-1) unstable; urgency=medium
* New upstream release
* Support lua 5.1, 5.2 and 5.3 via lua-any
@daurnimator
daurnimator / cursed_mandelbrot.c
Last active November 14, 2018 04:09 — forked from DavidBuchanan314/cursed_mandelbrot.c
Compile-time mandelbrot in pure C and Zig. Outputs a PGM image file to stdout.
#include <stdio.h>
#define SQ(x) (x)*(x)
#define M0(x,y) SQ(x)+SQ(y)<4?0:0xe0
#define M1(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M0(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0)):0xc0
#define M2(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M1(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0xa0
#define M3(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M2(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0x80
#define M4(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M3(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0x60
#define M5(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M4(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0x40
@daurnimator
daurnimator / test.py
Created March 18, 2018 01:56 — forked from RyanSquared/test.py
Program to migrate LDAP data to hashbang/userdb
#!/usr/bin/env python
# pylint: disable-all
# Search LDAP for all People of hashbang.sh
import json
import sys
import ldap
import ldap.resiter
import psycopg2
from jinja2.runtime import Undefined
SPECIAL_DELIM = [("[{}[".format("="*n), "]{}]".format("="*n)) for n in range(10)]
def type_of(v, *types):
return any(isinstance(v, t) for t in types)
def get_delim(s):
if '"' not in s and "\n" not in s and "\\" not in s:
return ('"', '"')
@daurnimator
daurnimator / ping.lua
Last active April 30, 2017 00:52 — forked from ober/ping.lua
function get_ping()
return p.find_first_file {
"/bin/ping" ;
"/sbin/ping" ;
}
end
import binascii
import sys
emoji = ['&#x1F427;', '&#x1F4A9;', '&#x2620;', '&#x1F357;', '&#x1F354;', '&#x1F418;', '&#x1F34D;', '&#x1F400;', '&#x1F47E;', '&#x1F4BB;']
def silly_description_checksum(desc):
cs_in = '%d' % (binascii.crc32(desc) & 0xFFFFFFFF)
cs_out = []
for c in cs_in:
-- Generalized Partial Application Implementation In Lua
-- Azer Koculu <[email protected]>
-- Mon May 24 10:33:40 UTC 2010
local function partial(fn,initialargs)
return function(...)
args = {}
if initialargs then table.foreach(initialargs,function(ind,el) table.insert(args,el) end) end
for i=0,arg['n'],1 do table.insert(args,arg[i]) end
return fn(unpack(args))
end
-- Generalized Partial Application Implementation In Lua
-- Azer Koculu <[email protected]>
-- Mon May 24 10:33:40 UTC 2010
local function partial(fn,initialargs)
return function(...)
args = {}
if initialargs then table.foreach(initialargs,function(ind,el) table.insert(args,el) end) end
for i=0,arg['n'],1 do table.insert(args,arg[i]) end
return fn(unpack(args))
end