Skip to content

Instantly share code, notes, and snippets.

View moolen's full-sized avatar
🦝

Moritz Johner moolen

🦝
View GitHub Profile
@moolen
moolen / installer.sh
Created April 13, 2018 07:15
archlinux installer
#!/bin/bash
set -ex
DIR=$(dirname $0)
echo "starting installer.."
DEVICE=${DEVICE:-/dev/sda}
DEVICE_CRYPT_PASS=${DEVICE_CRYPT_PASS:-1234}
TIMEZONE=${TIMEZONE:-Europe/Berlin}
HOSTNAME=${HOSTNAME:-archbox}
@moolen
moolen / remast-eriso.sh
Last active April 13, 2018 07:14
remaster archlinux ISO
#!/bin/bash
set -x
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
MNT=/mnt/archiso
ISO=${ISO:-/path/to/my/archlinux-2017.10.01-x86_64.iso}
TMP_DIR=/mnt/customiso
rm -rf $TMP_DIR
@moolen
moolen / find.php
Last active March 7, 2017 16:44
brute-force seed for fizzbuzz
<?php
for($i = PHP_INT_MIN; $i <= PHP_INT_MAX; $i++){
echo "$i".PHP_EOL;
srand($i);
if( magic() ){
echo "lucky number is #$i";
exit;
}
}
echo "no luck. yer' dead";
// displays a small box which shows the pressed key
// copy the content of this gist into your browser console and see it in action
//
// requires global jquery
// the keycode table is copied from http://keycode.info/
$('body').append($('<div id="kp"></div>'))
$('#kp').css('width', '100px')
$('#kp').css('height', '50px')
$('#kp').css('position', 'fixed')
@moolen
moolen / run.php
Created August 25, 2016 15:40
Advanced Custom Fields: clean orphaned values in wp_postmeta table
<?php
// this file requires a export.json in the same directory
// also define the database parameters below
// the `TARGET` has to be a flexible-content field
define('HOST', 'localhost');
define('USER', 'root');
define('PASS', '1234');
define('DATABASE', 'my_database');
define('TABLE', 'wp_postmeta');