Skip to content

Instantly share code, notes, and snippets.

View cfra's full-sized avatar
🚀

Christian Franke cfra

🚀
View GitHub Profile
Prozess A Prozess B
f = open('/var/mail/foo')
mv /var/mail/foo /var/mail/bar
cat /var/mail/bar >> /var/mail/baz
f.write(important_mail)
f.close()
rm /var/mail/bar
@cfra
cfra / gist:4054987
Created November 11, 2012 14:06
tty fun
[root@hermes nihilus]# su - dropoff # <- This is the only line ever entered on a keyboard
exit
echo "Running exploit as $(whoami)"
[dropoff@hermes ~]$ exit
logout
[root@hermes nihilus]# echo "Running exploit as $(whoami)"
Running exploit as root
[root@hermes nihilus]#
@cfra
cfra / enter_chroot.sh
Created September 16, 2015 14:16
Wrapper script around chroot
#!/bin/sh
set -e
if [ x"$1" = x"" -o ! -d "/var/chroot/$1" ]; then
echo "Usage: $0 <chroot>" >&2
exit 1
fi
cd /var/chroot/$1
from PIL import Image
img = Image.open(image_path)
if orientation == 2:
img = img.transpose(Image.FLIP_LEFT_RIGHT)
elif orientation == 3:
img = img.transpose(Image.ROTATE_180)
elif orientation == 4:
img = img.transpose(Image.FLIP_TOP_BOTTOM)
elif orientation == 5:
find . -type f -exec grep -l debian-installer/ {} + | xargs -n 1 sed -i -e 's_debian-installer/_netboot/debian-jessie/_g'
@cfra
cfra / sendmsg.gcom
Last active May 6, 2020 21:52
comgt/gcom script to send textmessage/SMS with umts stick
#
# export DEST as E164 number and MSG as text message content
# then call:
#
# comgt -v -d /dev/ttyUSB2 /etc/gcom/sendmsg.gcom
#
# where /dev/ttyUSB2 is the console of your UMTS modem
#
opengt
set com 115200n81
@cfra
cfra / freenas-iohyve.md
Last active February 14, 2018 05:23
A short description on how to use iohyve on FreeNAS 9.10

Introduction

FreeNAS 9.10 is based on FreeBSD 10.3 and as such, supports the BSD hypervisor bhyve. There are different frontends for bhyve, one of them is iohyve which is included in FreeNAS 9.10. This document describes how to setup iohyve for operation on FreeNAS 9.10 and basic VM management tasks.

Setting up Iohyve

Iohyve is already installed in FreeNAS 9.10, so it only needs to be enabled. This is done by adding the following lines to /conf/base/etc/rc.conf:

iohyve_enable="YES"

iohyve_flags="kmod=1 net=igb0 pool=storage-volume"

@cfra
cfra / slow-serial.md
Last active November 11, 2017 01:36
Automate slow Device over Serial

Automate slow Device over Serial

This describes how to push data to a device which doesn't react kindly when flooded with input.

It uses screen.

It is a hack.

It could be used for provisioning switches with config.

@cfra
cfra / dockerdrop.md
Last active September 26, 2022 07:13
How to setup Docker CE at Digitalocean with btrfs

Dropping the Docker

Based on this guide

We differ from the official docs by creating the btrfs before installing docker-ce.

Also we assume this is done as root.

Apperently, we can save ourself the effort to shuffle stuff around afterwards and have docker use the btrfs as intended, immediately after installation.

@cfra
cfra / memtest-flashdrive.md
Last active March 26, 2021 07:40
Memtest from USB flash drive

Memtest on USB flash drive

Using Memtest86 Free Edition

At the time of writing, this installed V7.4 for UEFI and V4 for BIOS boot.

Caution: you have to use the correct device name for your flashdrive

wget https://www.memtest86.com/downloads/memtest86-usb.tar.gz