Skip to content

Instantly share code, notes, and snippets.

View W4RH4WK's full-sized avatar
🔱
A demon, killing demons

Alex Hirsch W4RH4WK

🔱
A demon, killing demons
View GitHub Profile
@W4RH4WK
W4RH4WK / bit_case.scad
Last active August 29, 2015 13:56
3D printed case for bits
module hexagon(size, height) {
boxWidth = size/1.75;
for (r = [-60, 0, 60])
rotate([0,0,r])
cube([boxWidth, size, height], true);
}
module combs(x_count, y_count, hex_size, wall_size, height) {
function x_pos(x, y) = (hex_size + wall_size) * x + ((y % 2 == 0) ? 0 : (hex_size + wall_size) / 2);
function y_pos(x, y) = (hex_size) * y;
@W4RH4WK
W4RH4WK / client.go
Created November 20, 2014 10:44
Challenge Response in Go
package main
import (
"bufio"
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
"log"
"net"
"strings"
@W4RH4WK
W4RH4WK / hijack.c
Created November 22, 2014 22:27
Basic Idea of Function Hijacking
#include <stdio.h>
#include <stdint.h>
#include <sys/mman.h>
void func1(void) {
printf("func1\n");
}
void func2(void) {
printf("func2\n");
@W4RH4WK
W4RH4WK / insert.scad
Last active August 29, 2015 14:10
parameterized OpenSCAD file for small containers
module insert(xcount, ycount, hspacer=0, vspacer=0, feet=true, side=47.55,
height=23, wall=1, cornerradius=4) {
x_space = side * xcount + 2 * (xcount - 1);
y_space = side * ycount + 2 * (ycount - 1);
x_corner = [
cornerradius,
x_space - cornerradius
syn keyword asmRegRax %rax rax
syn keyword asmRegEax %eax eax
syn keyword asmRegAx %ax ax
syn keyword asmRegAh %ah ah
syn keyword asmRegAl %al al
syn keyword asmRegRbx %rbx rbx
syn keyword asmRegEbx %ebx ebx
syn keyword asmRegBx %bx bx
syn keyword asmRegBh %bh bh
syn keyword asmRegBl %bl bl
@W4RH4WK
W4RH4WK / screen_rotate.sh
Created May 19, 2015 09:43
rotate screen every second
#!/bin/bash
while true; do
x=$(date "+%s")
x=$(( $x % 360 ))
pi=`echo "4*a(1)" | bc -l`
xrad=`echo "$x*($pi/180)" | bc -l`
sinx=`echo "s($xrad)" | bc -l`
sinx2=`echo "- s($xrad)" | bc -l`
cosx=`echo "c($xrad)" | bc -l`
#include <iostream>
using namespace std;
class A {
protected:
int count;
@W4RH4WK
W4RH4WK / register.py
Last active September 1, 2015 13:04
Automated UIBK Course Registering Script
#/usr/bin/env python2
# packages:
# $ sudo pip install -U requests
# $ sudo pip install -U pyquery
import requests
from pyquery import PyQuery
@W4RH4WK
W4RH4WK / worker.py
Created September 15, 2015 15:17
WorkerThread paradigm
from time import sleep
class Worker(object):
def do_stuff(self):
print 'working'
def loop(self):
while True:
@W4RH4WK
W4RH4WK / tile
Last active November 26, 2015 10:13
Tmux run program in parallel
#!/bin/bash
# requires:
# set-option -ga update-environment ' TILE_NUM'
SESSION="$(date +%Y-%m-%d-%H-%M-%S)"
TILES="$1"
re='^[0-9]+$'
if [[ ! $TILES =~ $re ]]; then