Skip to content

Instantly share code, notes, and snippets.

View klange's full-sized avatar
🤔
Contemplative.

K Lange klange

🤔
Contemplative.
View GitHub Profile
@klange
klange / pecho.sh
Created February 18, 2012 06:18
Improved Parallel Echo for Screen
#!/bin/bash
if [ "$1" == "" ]; then
echo 'Usage: pecho [window_number [window_number [...]]]'
return 1
fi
echo -e "\e[1m[echoing in parallel on screens $@]\e[0m"
stty -echo
while IFS= read -r -s -n1 c; do
for screen in $@; do
@klange
klange / sdf.m
Created April 14, 2012 07:22
Symmetric Doolittle Factorization
function [L,D] = sdf(A)
% L * D * L' = A
[n,garbage] = size(A)
for i = 1:n
for j = 1:n
D(i,j) = 0;
end
$ e2fsck toaruos-disk.img
e2fsck 1.41.14 (22-Dec-2010)
Filesystem did not have a UUID; generating one.
toaruos-disk.img contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Deleted inode 11 has zero dtime. Fix<y>? yes
Inode 3080, i_size is 1044, should be 2048. Fix<y>? yes
@klange
klange / .gitconfig
Created May 10, 2012 00:48
git attackclone
[alias]
attackclone = !cowsay -f vader.cow `git clone $@`
@klange
klange / acoustics.ini
Created June 21, 2012 21:45
Acoustics INI file
players=default,extra
webroot=/amp/
extensions=LastFM::Scrobbler
[database]
data_source=dbi:SQLite:dbname=/home/klange/Music/amp.sqlite
[scanner]
require_prefix=
[player.default]
@klange
klange / vulnerability.md
Created August 23, 2012 06:58
Rack session secret vulnerability in Level 5 and Level 6 of Stripe CTF 2.0
$ openssl s_client -connect level06-2.stripe-ctf.com:443
CONNECTED(00000003)
depth=2 C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert High Assurance EV Root CA
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
0 s:/C=US/ST=California/L=San Francisco/O=Stripe, Inc./OU=Security Department/CN=*.stripe-ctf.com
i:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance CA-3
1 s:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance CA-3
@klange
klange / wacom-switch-display.sh
Last active October 9, 2015 17:37
Switch the display your Wacom tablet is bound to with ease
#!/bin/bash
let DISPLAY_COUNT=3
let DISPLAY_WIDTH=1920
let DISPLAY_HEIGHT=1080
if [[ ! -f ~/.wacom-switcher-display ]]; then
echo "hmf"
echo "0" > ~/.wacom-switcher-display
fi
@klange
klange / gist:3556869
Created August 31, 2012 18:19
xrandr output on luka
$ DISPLAY=:0 xrandr
Screen 0: minimum 8 x 8, current 5760 x 1080, maximum 16384 x 16384
DVI-I-0 disconnected (normal left inverted right x axis y axis)
DVI-I-1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 509mm x 286mm
1920x1080 60.0*+
1680x1050 60.0
1440x900 59.9
1280x1024 75.0 60.0
1280x960 60.0
1280x800 59.8
@klange
klange / strlen.c
Created September 18, 2012 22:25
strlen with no conditionals
#include <stdio.h>
typedef int (*strlen_f)(char *);
int plus_one(char *);
int ret_zero(char *);
int _strlen(char *);
strlen_f funcs[2] = {ret_zero, plus_one};
int plus_one(char * c) {
! bang
" double quote
# pound or she (if followed by bang)
$ dollar
% percent (usually sans-sign)
& ampersand (or "bitwise-and" (a & SOME_FLAG), or "address of" (&foo), or "and" (&&))
' Depends on context, it's an apostrophe here, but 'single quotes' here.
() open/close parens
[] open/close brackets
{} open/close braces