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/ruby | |
# REQUIRES: | |
# * rooted android, as otherwise you can't read the applications private data | |
# * to display the qr code "qrencode" (http://fukuchi.org/works/qrencode/) | |
# and "display" from ImageMagick | |
# This script "decrypts" the token from the internal state of the | |
# Battle.net Mobile Authenticator on android application, converting | |
# it into an "otpauth" url (https://code.google.com/p/google-authenticator/wiki/KeyUriFormat) |
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
*.so |
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/bash | |
# quote command in ssh call to prevent remote side from expanding any arguments | |
# uses bash printf %q for quoting - no idea how compatible this is with other shells. | |
# http://stackoverflow.com/questions/6592376/prevent-ssh-from-breaking-up-shell-script-parameters | |
sshargs=() | |
while (( $# > 0 )); do | |
case "$1" in |
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 <uapi/linux/ptrace.h> | |
#include <linux/sched.h> | |
#include <linux/fcntl.h> | |
#include <linux/fs.h> | |
#include <linux/path.h> | |
#include <linux/dcache.h> | |
#include <linux/limits.h> |
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 <fcntl.h> | |
/* Usage example: bpftrace fcntl_setlk.bt podman */ | |
kretfunc:vmlinux:fcntl_setlk / $# == 0 || comm == str($1) / { | |
if (args->flock->l_type == F_UNLCK) { | |
delete(@pending_locks[pid, args->filp]) | |
} else if (retval == 0) { | |
@pending_locks[pid, args->filp] = 1 | |
} |
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
-- take all numbers from the 3rd until the second last line, multiply each | |
-- number with the associated multiplier from the list [10,5,6,7,8,9,11,13,14,15,16,2,3,17,18,19] | |
-- and sum everything up (modulo Int32) to get the checksum. | |
-- (hint: line 11, the 9th number in the list, is the cash amount) | |
-- in haskell: | |
import Data.Int | |
checksum :: [Int32] -> Int32 | |
checksum nums = sum $ zipWith (*) nums [10,5,6,7,8,9,11,13,14,15,16,2,3,17,18,19] |
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
# Find block device names for main disk, rootfs and /boot (if it is on a separate partition; usually with encrypted rootfs) | |
# your main disk isn't necessarily /dev/sda anymore; NVMe disks have names like /dev/nvme0n1 | |
# -> /dev/sda might as well be the "livecd" | |
# For UEFI boot you should also identify the EFI partition; EFI requires a gpt PTTYPE. | |
lsblk -p -o NAME,RM,SIZE,RO,PTTYPE,TYPE,FSTYPE,MOUNTPOINT,LABEL,PARTLABEL | |
# or use `lsblk -p; blkid` instead of the long lsblk command | |
# If you run mdadm raid, probably should start with that. Instructions not included (yet). | |
# If encrypted rootfs: open it | |
cryptsetup open /dev/${cryptpart} ${cryptpart}_crypt |
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
/* | |
* Build: | |
* LDFLAGS=-lcrypt make mkcrypt | |
* | |
* Usage: | |
* mkcrypt [algo [saltlen [randomsource]]] | |
* | |
* - reads password from stdin (tries to set echo off) | |
* | |
* Defaults to $6$ as algo, 16 for saltlen and /dev/random for the |
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 | |
# example config for i3 (.config/i3/config): | |
# # select window with mouse | |
# bindsym Print exec --no-startup-id scrot-xclip.sh --select --freeze | |
# # current window | |
# bindsym $mod+Print exec --no-startup-id scrot-xclip.sh --focused | |
set -e |
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
/* Batcher odd-even mergesort: http://en.wikipedia.org/wiki/Batcher_odd-even_mergesort */ | |
/* O(n * (log n) * (log n)): inplace, and could run in O( (log n) * (log n) ) on n cores in parallel */ | |
/* Most implemenations only handle power-of-two input sizes; this implementation | |
appends "virtual" infinity items at the end of input (takes no space) */ | |
#include <vector> | |
#include <cassert> |
NewerOlder