Skip to content

Instantly share code, notes, and snippets.

View mniip's full-sized avatar
😼

mniip mniip

😼
View GitHub Profile
--[=[
example:
#define mv{#} tonumber(%1)>0 and(">"):rep(%1)or("<"):rep(-(%1))
#define add{#} "mv{%1}[-mv{-(%1)}+mv{%1}]mv{-(%1)}"
,>,>,<<add{2}add{1}.
preprocession:
,>,>,<<mv{2}[-mv{-2}+mv{2}]mv{-2}mv{1}[-mv{-1}+mv{1}]mv{-1}.
@mniip
mniip / flood.js
Last active December 16, 2015 05:19
var code="\n\
var btn=document.createElement('a')\n\
document.getElementById('brush-2').parentNode.appendChild(btn)\n\
btn.href='#'\n\
btn.id='brush-flood'\n\
btn.className='brushPicker'\n\
btn.innerHTML=\"fill\"\n\
btn.onclick=function(){drawApp.setSize('flood')}\n\
var md=drawApp.onCanvasMouseDown()\n\
// hey, that was clever, but unfortunately not enough\n\
@mniip
mniip / bizrmap.lua
Last active December 26, 2015 11:49
return {
[0x000000]={0,0,0,0,0},
[0xF97CBB]={4,0,2,0,3},
[0xC3C3C3]={5,0,5,0,5},
[0xEA4EFF]={9,0,1,2,9},
[0xBBD0D0]={8,1,6,3,7},
[0x7171FF]={2,0,2,0,6},
[0x38C6FF]={2,0,4,3,9},
[0xFF008A]={6,0,0,0,2},
[0xC7FF7C]={6,2,6,3,2},
@mniip
mniip / Patterns.hs
Last active August 29, 2015 13:57
A regex-like pattern matcher operating on arbitrary data types.
module Patterns
(
captures, match, residue,
maybeCaptures, maybeMatch, gsub,
capture, captureMap, captureGuard, captureEq, lookAhead, lookAheadNot,
attach, orElse, tryOne, greedySome, lazySome, greedyMany, lazyMany,
times,
always, never, end, anything, value, notValue, range, anyOf, noneOf, lambda,
list, balanced,
numeric, hexadecimal, lowercase, uppercase, alpha, alphanumeric, ascii,
@mniip
mniip / tracer.c
Last active August 31, 2016 18:23
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <stdint.h>
#include <stddef.h>
#include <signal.h>
#include <limits.h>
#include <errno.h>
#include <pthread.h>
// extern void md5(char *digest, const char *data, size_t length)
.global md5
.type md5 @function
md5:
pushq %rbx
pushq %r12
pushq %r13
pushq %r14
pushq %r15
push %rbp
@mniip
mniip / md5.S
Last active August 29, 2015 14:01
8-at-a-time MD5 hasher using AVX2
# extern void block_round_8(const unsigned int (*data)[8]);
# __m256i A register("ymm0");
# __m256i B register("ymm1");
# __m256i C register("ymm2");
# __m256i D register("ymm3");
.global block_round_8
.type block_round_8 @function
block_round_8:
pushq %rbp
movq %rsp, %rbp
#!/bin/bash
# Ever wanted to spawn a process in X from a VT?
# This little tool spawns a shell whose environment is copied from a specified PID.
# Example: ./copyenv.sh $(pidof mate-session)
# That will launch a shell with $DISPLAY, $XAUTORITY, and others set to appropriate values and thus you'll be able to spawn your process
xargs -0 -a <(cat "/proc/$1/environ";echo -n $SHELL;echo -ne "\0-i") env
use strict;
use Coro;
use Xchat;
Xchat::register("op helper", "0.0");
{
package Promise;
if [ $EUID != 0 ]; then
su -c $0
exit
fi
for i in /tmp/.X11-unix/X*; do
ln -f $i $(sed 's:^/::' <<< "$i")
done
xauth extract - $DISPLAY | xauth -f root/.Xauthority merge -
export XAUTHORITY=/root/.Xauthority