This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from getpass import getpass | |
from bcrypt import gensalt, hashpw | |
from argparse import ArgumentParser | |
parser = ArgumentParser() | |
parser.add_argument('-r', '--rounds', type=int, default=12) | |
parser.add_argument('-p', '--prefix', default='2b') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <unistd.h> | |
#include <sys/stat.h> | |
#include <nvml.h> | |
#include <time.h> | |
#define MAXINFO 32 | |
#define MAXCBUF 64 | |
// compile with: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
COL_FMT = '\x1b[48;2;%d;%d;%dm\x1b[38;2;%d;%d;%dm' | |
COL_CLR = '\x1b[0m' | |
def im2str(im): | |
if not isinstance(im, np.ndarray) or (im.dtype != np.uint8): | |
raise TypeError('Input has to be a numpy array with dtype uint8!') | |
rows = [''.join([COL_FMT%tuple(top.tolist() + bot.tolist()) + '▄' for top, bot in zip(*drow)]) for drow in zip(im[0::2], im[1::2])] | |
imstr = ((COL_CLR + '\n').join(rows)) + COL_CLR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from base64 import b64encode | |
import sys | |
raw = sys.stdin.buffer.read() | |
def kpngprint(raw): | |
FRMT = "\x1b_G{control};{payload}\x1b\\" | |
bcode = b64encode(raw).decode('ascii') | |
payloads = [bcode[i:i+4096] for i in range(0, len(bcode), 4096)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import numpy as np | |
import sounddevice as sd | |
from datetime import datetime, timedelta | |
from time import sleep | |
from scipy.signal import sawtooth, square | |
from argparse import ArgumentParser | |
wform = sawtooth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size(50cm,50cm); | |
unitsize(1cm); | |
real blocks[] = {0,1,1,2,3,5,8,13,21,34,55}; | |
//string cont[] = {"","DE","AD","BE","EF","C0","FF","EE","DE","FE","C7"}; | |
string cont[] = {"0","1","1","2","3","5","8","13","21","34","55"}; | |
pen p = linewidth(0.1cm); | |
pair base = (0,0); | |
for (int i=1;i<blocks.length;++i){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import torch | |
def fwd_grad(outputs, inputs, grad_outputs=None, retain_graph=None, create_graph=False, only_inputs=True, allow_unused=False): | |
if isinstance(outputs, torch.Tensor): | |
outputs = (outputs,) | |
if isinstance(inputs, torch.Tensor): | |
inputs = (inputs,) | |
v = [torch.ones_like(out, requires_grad=True) for out in outputs] | |
u = [torch.ones_like(inp) for inp in inputs] if grad_outputs is None else grad_outputs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env -S bash -c 'sed -e "/^#\\|^\$/d" "$0"|while read V;do ln -sfT "$HOME/.config/$V" "$HOME/.$V";done' | |
#ssh directory | |
ssh | |
gitconfig | |
tmux.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
iptables -A FORWARD -i tap0 -o tap0 -j ACCEPT | |
# dhcp at 1067 | |
iptables -t nat -A PREROUTING -i tap0 -p udp -m udp --dport 67 -j DNAT --to-destination :1067 | |
iptables -t nat -A POSTROUTING -o tap0 -p udp -m udp --sport 1067 -j SNAT --to-source :67 | |
iptables -A UDP -p udp -m udp --dport 1067 -j ACCEPT | |
# DNS at 1053 | |
iptables -t nat -A PREROUTING -i tap0 -p udp -m udp --dport 53 -j DNAT --to-destination :1053 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
BWROOT="${1:?"Root not specified!"}" | |
shift | |
env -i bwrap \ | |
--bind "$BWROOT" / \ | |
--unshare-user \ | |
--unshare-cgroup \ | |
--unshare-ipc \ | |
--unshare-pid \ |
OlderNewer