Skip to content

Instantly share code, notes, and snippets.

View daurnimator's full-sized avatar

daurnimator

View GitHub Profile
@insin
insin / srsly.js
Last active August 29, 2015 14:01
function new_(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z) {
switch (arguments.length) {
case 0: return new this
case 1: return new this(a)
case 2: return new this(a, b)
case 3: return new this(a, b, c)
case 4: return new this(a, b, c, d)
case 5: return new this(a, b, c, d, e)
case 6: return new this(a, b, c, d, e, f)
case 7: return new this(a, b, c, d, e, f, g)
@daurnimator
daurnimator / gist:a61d223df1f83da8b72a
Created March 14, 2015 21:05
TamperMonkey script - Better dimensions for Glowing Bear
// ==UserScript==
// @name Better dimensions for Glowing Bear
// @namespace http://daurnimator.com
// @version 0.1
// @description Glowing Bear sidebar dimensions
// @author Daurnimator
// @match http://www.glowing-bear.org/
// @grant GM_addStyle
// ==/UserScript==
@daurnimator
daurnimator / .bash_prompt.lua
Last active December 10, 2015 19:58
My bash prompt
local ret_code , n_jobs = ...
ret_code = tonumber ( ret_code )
n_jobs = tonumber ( n_jobs ) or 0
local ffi = require "ffi"
ffi.cdef [[
typedef uint32_t uid_t;
uid_t geteuid(void);
int gethostname(char *name, size_t namelen);
char *getcwd(char *buf, size_t size);
@pims
pims / riakshell.go
Last active December 27, 2015 03:09
// tim$ go install
// tim$ cat logs | riakshell
package main
import (
"bufio"
"github.com/mrb/riakpbc"
"io"
"log"
@daurnimator
daurnimator / sandbox.lua
Last active April 5, 2016 12:56
Sandbox using ljsyscall
local ffi = require "ffi"
local S = require "syscall"
local c = S.c
local t = S.types.t
local util = S.util
local nr = require "syscall.linux.nr"
local lfs = require "syscall.lfs"
-- Returns an iterator over open fds
local function open_fds(pid)
@daurnimator
daurnimator / ec.lua
Created November 22, 2011 03:56
A replacement for lua errors; based on coroutines.
local select = select
local error = error
local cocreate , coresume , corunning , costatus , coyield = coroutine.create , coroutine.resume , coroutine.running , coroutine.status , coroutine.yield
local getinfo = debug.getinfo
local err_signifier = { }
local ec = { }
local function xpcall_resume ( co , hand , ok , ... )
from pylab import *
from numpy import *
from numpy.linalg import solve
from scipy.integrate import odeint
from scipy.stats import norm, uniform, beta
from scipy.special import jacobi
a = 0.0
@daurnimator
daurnimator / app.lua
Created September 14, 2012 10:11
Sinatra like clone for lua
if not sinatra.incoming ( ngx.req.get_method() , ngx.var.uri ) then
return ngx.exit ( 404 )
end
@lukego
lukego / 0readme.md
Created August 16, 2015 16:25
Performance counter access with inline assembler in Lua
@katlogic
katlogic / poll.c
Created September 18, 2016 00:48
#include <sys/epoll.h>
#include <sys/socket.h>
#include <stdio.h>
int main()
{
struct epoll_event ev = {
.data.fd = 1
};
int efd = epoll_create(1);
ev.events = EPOLLIN|EPOLLET;