Skip to content

Instantly share code, notes, and snippets.

View T4cC0re's full-sized avatar

Hendrik Meyer T4cC0re

View GitHub Profile
@T4cC0re
T4cC0re / wakelock.service
Last active January 17, 2021 19:32
Lock screen after suspend with i3lock and systemd
# /etc/systemd/system/wakelock.service
[Unit]
Description=Lock the screen before suspend
Before=systemd-suspend.service
[Service]
User=t4cc0re
Type=forking
Environment=DISPLAY=:0
ExecStart=/usr/bin/i3lock -ef --image=/opt/wallpapers/lockscreen.png --color=000000
@T4cC0re
T4cC0re / initialMSYS2.sh
Last active September 23, 2017 14:45
Initial Setup of MSYS2 on Windows with appropriate home dir
#!/usr/bin/env bash
pacman -Svvyy git tar xz gzip wget curl base-devel binutils mingw-w64-x86_64-readline gawk
setx MSYS2_PATH_TYPE inherit
setx HOME "C:\\Users\\${USER}"
echo "Please restart MSYS2 now to take effect (close with X)"
while read; do
:
done
@T4cC0re
T4cC0re / gl-ci.sh
Created October 28, 2016 20:17
install gitlab-ci-multi-runner in docker mode on ubuntu based machines. Docker needs to be installed beforehand
#!/usr/bin/env bash
echo "check if gitlab-ci-multi-runner is installed..."
gitlab-ci-multi-runner &> /dev/null
if [ $? != 0 ]; then
echo "NOT installed. Installing..."
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-ci-multi-runner/script.deb.sh | sudo bash
apt-get install gitlab-ci-multi-runner
else
echo "IS installed. OK"
fi
@T4cC0re
T4cC0re / pi-flashrom.sh
Created September 29, 2016 05:06
SSH pi-flashrom v0.1 by T4cC0re - Flash images remotely via SSH/SCP
#!/usr/bin/env bash
# region SETTINGS
SPEED=3800; # safe speed for rPi. (<80sec for read, verify and download of 8MiB rom)
#SPEED=16000; # freaking fast! Should work on most rPis. (<30sec for read, verify and download of 8MiB rom)
#SPEED=32000; # insanely fast! Not guaranteed to work at all, but works for me. (~20sec for read, verify and download of 8MiB rom)
ASK=1; # Ask to flash before actually doing it
#ASK=0; # Don't ask.
# endregion
@T4cC0re
T4cC0re / installMakeMKV.sh
Created September 11, 2016 22:50
Automatically installs makemkvcon (you still need to accept the license manually)
#!/usr/bin/env bash
# Detect version from website
VERSION="$(curl --silent "http://www.makemkv.com/download/" 2>&1 | egrep -o 'MakeMKV ([^ ]*) for' | sed 's/MakeMKV //' | sed 's/ for//' | uniq)"
DIR="$(pwd)"
WRKDIR="$(mktemp -d)"
NUMPROC="$(cat /proc/cpuinfo | grep proc | wc -l)"
# Detect beta-key from forums
@T4cC0re
T4cC0re / gpg-agent.service
Created August 30, 2016 11:38
`~/.config/systemd/user/gpg-agent.service` later symlink `~/.config/systemd/user/default.target.wants/gpg-agent.service` to it.
[Unit]
Description=GnuPG private key agent
IgnoreOnIsolate=true
[Service]
Type=forking
ExecStart=/usr/bin/gpg-agent --daemon --enable-ssh-support
Restart=always
[Install]
@T4cC0re
T4cC0re / uuid4.js
Created June 19, 2016 14:17
Generate a valid UUID v4 using nodejs' CSPRNG
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
.replace(
/[xy]/g,
char => {
const rnd = parseInt(
require('crypto')
.randomBytes(1) // get one byte
.toString('hex')// encode it to hex
.slice(0, 1), // slice to one char
16
@T4cC0re
T4cC0re / fix.sh
Last active July 7, 2017 16:51
Permanently fix VMWare kernel module sources for Kernel 4.6+ and (re-)build them (can be run multiple times)
#!/usr/bin/env bash
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
KMAJ="$(uname -r | cut -d. -f1)"
KMIN="$(uname -r | cut -d. -f2)"
if [ "${KMAJ}" != "4" ]; then
echo "This script has to be run on a 4.x kernel." 1>&2
@T4cC0re
T4cC0re / yubitouch.sh
Last active May 1, 2016 23:44 — forked from a-dma/yubitouch.sh
Bash script for setting or clearing touch requirements for cryptographic operations in the OpenPGP application on a YubiKey 4.
#!/bin/bash
# Bash script for setting or clearing touch requirements for
# cryptographic operations the OpenPGP application on a YubiKey 4.
#
# Author: Alessio Di Mauro <alessio@yubico.com>
GCA=$(which gpg-connect-agent)
DO=0
UIF=0
@T4cC0re
T4cC0re / smartcard.sh
Last active May 1, 2016 20:08 — forked from michiwend/smartcard.sh
Gemalto smartcard with GnuPG under Arch Linux
#!/usr/bin/bash
# more info:
# https://wiki.archlinux.org/index.php/GnuPG#Smartcards
SHELL_CONF=~/.bashrc
sudo pacman -S --noconfirm pcsclite libusb-compat
sudo systemctl enable pcscd.service