Skip to content

Instantly share code, notes, and snippets.

View gronke's full-sized avatar
👾
¯\_(ツ)_/¯

Stefan Grönke gronke

👾
¯\_(ツ)_/¯
View GitHub Profile
@gronke
gronke / demo.sh
Created October 8, 2018 06:55
libiocage from Ruby with pycall
pkg install -y ruby24-gems
gem install pycall
export PYTHON=/usr/local/bin/python3
ruby ./iocage-from-ruby.rb
@gronke
gronke / debootstrap-debian-hetzner.sh
Created November 12, 2017 13:38
Provision Debian for libvirt with debootstrap on a Hetzner host
#!/bin/bash
# - expects ZFS on the target host
# - expects ZFS on the target host
# Usage Example
#
# ./debootstrap-debian-hetzner.sh www \
# <ADDITIONAL_IP4_ADDR> \
# <IP4_ADDR_HOST> \
@gronke
gronke / generate_sha512-crypt.py
Last active November 22, 2023 23:34
Generate SHA512-CRYPT with Python 3
#!/usr/bin/env python3
import os
import secrets
import passlib.hash
import sys
def generateHash(password, salt_len=10, iterations=65000):
result = passlib.hash.sha512_crypt(salt=secrets.token_hex(salt_len), rounds=iterations).hash(password)
return '{SHA512-CRYPT}' + result
@gronke
gronke / format-pseudo-random.sh
Created May 10, 2017 23:26
Format a disk with pseudo-randon data using /dev/null encrypted with a random number
#!/bin/sh
# Format a disk with pseudo-randon data using /dev/null encrypted with a random number
# Dependencies
# - base64
# - openssl
# - pv
DISK="$1"
UNAME=$(uname)
@gronke
gronke / encrypt-disk.md
Last active January 12, 2018 05:59
Encrypt Disk on FreeBSD or Linux

Encrypt a disk on FreeBSD or Linux using the device serial as identifier for a random generated key.

  • Keys are stored in /root/encryption/$hostname/$serial
  • Encryption Algorithm AES-XTS 256

Usage

# Encrypt sda and ask for confirmation
./encryption sda
@gronke
gronke / LICENSE
Last active September 9, 2022 07:40
Mailman 2.1.23 helper to re-generate virtual-mailman
Copyright (C) 2001-2016 by the Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@gronke
gronke / index.html
Created May 20, 2015 11:37
Ist heute Maschinendeck Treffen? // source http://jsbin.com/coheve
<!DOCTYPE html>
<html>
<head>
<title>Ist heute Maschinendeck Treffen?</title>
<style>
body {
text-align: center;
font-family: Helvetica;
}
#state {
@gronke
gronke / init.d-dovecot-xaps-daemon
Created January 12, 2015 17:47
init.d script for dovecot-xaps-daemon
#!/bin/sh -e
### BEGIN INIT INFO
# Provides: xapsd
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start or stop pyload.
### END INIT INFO
@gronke
gronke / master.rb
Created August 28, 2014 22:38
control-bash-from-ruby
require 'pty'
require 'expect'
str = "RUBY_VERSION"
PTY.spawn("./slave.sh") do |reader, writer|
reader.expect('Hello')
answer = reader.gets
puts "stdout: #{answer}"
// Original code from http://www.blog.highub.com/mobile-2/a-fix-for-iphone-viewport-scale-bug/
var metas = document.getElementsByTagName('meta');
var i;
if (navigator.userAgent.match(/iPhone/i)) {
for (i=0; i<metas.length; i++) {
if (metas[i].name == "viewport") {
metas[i].content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0";
}
}