Skip to content

Instantly share code, notes, and snippets.

View mniip's full-sized avatar
😼

mniip mniip

😼
View GitHub Profile
__module_name__ = "clones"
__module_version__ = "0"
__module_description__ = "Clone finder"
import xchat
clones = {}
def who_reply(w, we, u):
nick = w[7]
ident = w[4]

Keybase proof

I hereby claim:

  • I am mniip on github.
  • I am mniip (https://keybase.io/mniip) on keybase.
  • I have a public key whose fingerprint is 6066 0E9B 9F3F 4D8A 0BD1 D1D8 786E A396 C51F 00D7

To claim this, I am signing this object:

#!/usr/bin/perl
use File::Temp qw(tempfile);
opendir(D, ".");
@files = sort readdir(D);;
closedir(D);
($fh, $fn) = tempfile();
for $d(@files)
{
print $fh "$d\n";
}
@mniip
mniip / Quantum.hs
Created November 6, 2014 02:00
A true work of haskell art
import Data.Bits
import Data.List
import qualified Data.Map.Lazy as Map
import Control.Monad.Trans.State
import Control.Applicative
import Control.Monad
type EntanglementId = Int
type EntanglementState = State EntanglementId
@mniip
mniip / where.lua
Last active August 29, 2015 14:09
where.lua - traverses a lua state and finds a path to a given object or hex address.
local _G, assert, newproxy, pairs, tostring, type = _G, assert, newproxy, pairs, tostring, type
local coroutine_create = coroutine.create
local debug_getfenv, debug_gethook, debug_getinfo, debug_getlocal, debug_getmetatable, debug_getregistry, debug_getupvalue, debug_upvalueid, debug_getuservalue = debug.getfenv, debug.gethook, debug.getinfo, debug.getlocal, debug.getmetatable, debug.getregistry, debug.getupvalue, debug.upvalueid, debug.getuservalue
local string_byte, string_format, string_gsub, string_match = string.byte, string.format, string.gsub, string.match
local where = {}
-- Auxiliary functions for finding the n'th key and n'th value in a table. Note
-- that the index may be invalidated even if the table is not modified, for
-- example if the table is weak
function where.nthkey(t, n)
@mniip
mniip / ldb.h
Last active August 29, 2015 14:10
(WIP) Stackless Lua api for C++ powered by template metaprogramming
inline void dumpstack(lua_State *L)
{
int n = lua_gettop(L);
printf(" <%p> Stack dump: %d values\n", L, n);
int i;
for(int i = 1; i <= n; i++)
{
printf(" [%d] ", i);
switch(lua_type(L, i))
{
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <sys/mman.h>
#define MAX_SHIFT 24
#define REPETITIONS 10
#define ITERATIONS (1 << 20)
@mniip
mniip / timer.c
Last active December 31, 2016 05:04
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <string.h>
#include <signal.h>
#include <curses.h>
void quit()
{
endwin();
diff --git a/lua-5.2.3/src/Makefile b/lua-5.2.3/src/Makefile
index 7b4b2b7..efe504b 100644
--- a/lua-5.2.3/src/Makefile
+++ b/lua-5.2.3/src/Makefile
@@ -103,7 +103,7 @@ freebsd:
generic: $(ALL)
linux:
- $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline"
+ $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline -lpthread"
@mniip
mniip / isbanned.py
Last active November 5, 2017 03:10
A freenode-specific hexchat script that checks whether someone is banned on some channel. For irssi version see https://gist.github.com/mniip/66a16b6da65d6deda9bc
__module_name__ = "isbanned"
__module_author__ = "mniip"
__module_version__ = "0.6"
__module_description__ = "freenode-specific module that checks whether someone is banned on some channel"
"""
Commands:
/isbanned <channel> <user>
Check whether <user> is banned on <channel>
/ismuted <channel> <user>