Skip to content

Instantly share code, notes, and snippets.

View csamsel's full-sized avatar

Christian Samsel csamsel

View GitHub Profile
@csamsel
csamsel / netconsole.sh
Last active December 28, 2015 12:59
script to configure and start linux netconsole to remote ip
dmesg -n debug
mount -t configfs none /sys/kernel/config
modprobe netconsole
mkdir -p /sys/kernel/config/netconsole/target1
cd /sys/kernel/config/netconsole/target1
echo eth0 > dev_name
echo 192.168.2.101 > remote_ip
echo 1 > enabled
@csamsel
csamsel / Enhanced NGINX logstash parser
Last active February 5, 2022 14:54
Enhanced NGINX logstash parser to include upstream response time and request length fields
Enhanced NGINX logstash parser:
NGINX log format:
log_format enhanced '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent $request_length "$http_referer" "$http_user_agent" $request_time $upstream_response_time';
access_log /var/log/nginx/access.log enhanced;
error_log /var/log/nginx/error.log;
logstash pattern (/opt/logstash/pattern/nginx):
@csamsel
csamsel / mp3-to-minidlna-cover.sh
Created August 21, 2015 21:10
bash one liner to create cover.jpg 's in all subdirectories (extract from first mp3 in directory)
find -type d -execdir sh -c 'cd "{}"; find . -name "*.mp3" | head -n1 | xargs --replace=FILENAME ffmpeg -loglevel quiet -i "FILENAME" cover.jpg' \;
@csamsel
csamsel / .config
Last active September 24, 2015 12:41
Linux Kernel config for 4.2.1-gentoo Gentoo/systemd Guest in Microsoft Hyper-V
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 4.2.1-gentoo Kernel Configuration
#
#
# Gentoo Linux
#
CONFIG_GENTOO_LINUX=y
CONFIG_GENTOO_LINUX_UDEV=y
by default NVIDIA Cards run with 5 GT/s (PCI Express 2 Speed) under Linux:
You can change modules options in /etc/modprobe.d/nvidia.conf:
options nvidiaNVreg_EnablePCIeGen3=1
@csamsel
csamsel / convert-to-utf8.sh
Created February 10, 2016 09:18
convert iso5596-15 filenames to utf8
convmv --notest -r -f iso8859-15 -t utf8 /directory
@csamsel
csamsel / ntp.conf
Last active September 11, 2022 21:07
multicast ntp client configuration
driftfile /var/lib/ntp/ntp.drift
leapfile /usr/share/zoneinfo/leap-seconds.list
disable auth
multicastclient 224.0.1.1
restrict -4 default ignore
restrict -6 default ignore
restrict 127.0.0.1
@csamsel
csamsel / ntp.conf
Last active September 11, 2022 13:00
GPS + multicast ntp server configuration
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help
driftfile /var/lib/ntp/ntp.drift
# Leap seconds definition provided by tzdata
leapfile /usr/share/zoneinfo/leap-seconds.list
# Enable this if you want statistics to be logged.
statsdir /var/log/ntpstats/
@csamsel
csamsel / raid5.sh
Last active April 1, 2017 20:20
create linux md raid5
# test disks
badblocks -t 0x00 -w /dev/sdb
# partition disks
parted -a optimal /dev/sdb
mklabel gpt
mkpart primary 1M 3000G
set 1 raid on
# create raid array
@csamsel
csamsel / etc conf.d net
Last active December 15, 2017 22:54
Gentoo network configuration for Draytek VigorNIC 132 in Bridge Mode for Deutsche Telekom Entertain (with OpenVPN tap device)
# Gentoo network configuration for Draytek VigorNIC 132 in Bridge Mode for Deutsche Telekom Entertain (with OpenVPN tap device)
# eth0 = VigorNIC, eth1 = unused (VM Network), eth2 = physical NIC to internal network
# tap0 = OpenVPN device, br0 = bridge for OpenVPN
#
# 192.168.2.0/24 internal network
# 192.168.200.0/24 VM network
# 192.168.1.1 VigorNIC webinterface
#
# create symlinks net.eth0, net.eth1, net.eth2, net.br0, net.ppp0, net.tap0
#