Skip to content

Instantly share code, notes, and snippets.

View mniip's full-sized avatar
😼

mniip mniip

😼
View GitHub Profile
@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,
// 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
__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