Skip to content

Instantly share code, notes, and snippets.

[Unit]
Description=WPA supplicant daemon (interface- and wext driver-specific version)
Requires=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device
Before=network.target
Wants=network.target
# NetworkManager users will probably want the dbus version instead.
[Service]
@redxef
redxef / anno4c2.py
Last active November 23, 2020 15:24
Calculate consumption rates and needed production buildings for Anno 1404.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
##
# @file ann4c2.py
# @author redxef
# @since 2019-02-19
#
# @brief Calculate consumption rates and needed production buildings for Anno 1404
# This program has no hard-coded values and relies solely on game files of
# Anno 1404, it has been written for IAAM and should be easy enough to adapt
#!/usr/bin/env python3
##
# @file epub-edit.py
# @author redxef
# @since 2019-01-04
#
# @brief Edit metadata of epubs like i like it.
##
# Copy this function into your ~/.bashrc file to make the clipboard work in the WSL.
# This is not beautiful or encouraged, but gets the job done.
pass() {
if [[ "$1" = '-c' ]] || [[ "$1" = '--clip' ]]; then
$(which pass) "$2" | head -n1 | clip.exe
[[ -f ~/.pass-clr-pid ]] && kill "$(cat ~/.pass-clr-pid)"
((sleep 45 && echo '' | clip.exe) && rm ~/.pass-clr-pid) &
local pid=$!
echo "$pid" > ~/.pass-clr-pid
else
@redxef
redxef / tortoggle.sh
Created July 20, 2018 10:26
Switches between a tor network service in macOS and other services, while simultaniously starting tor.
#!/usr/bin/env python3
import sys
import subprocess
import getopt
import shlex
import time
# known issues:
brew install shntool cuetools
shnsplit -o flac -f *.cue *.flac

cuetag .cue split-track.flac

@redxef
redxef / makefile
Created April 12, 2018 06:05
A makefile for single file libraries in c. The filename is the name of the library and its c source file without any extensions or prefixes.
BUILDTYPE ?= debug
TARGET ?= linux
FILENAME := FILLTHISIN
LIBNAME := lib$(FILENAME).so
CC := clang
CDFLAGS := -g -Wall -Wpedantic -Wextra
CRFLAGS := -Wall -Wpedantic -Wextra -O3
ifeq ($(BUILDTYPE), debug)
root = true
[**]
end_of_line = lf
inser_final_newline = true
charset = utf-8
indent_style = space
indent_size = 8
trim_trailing_whitespace = true
max_line_length = 72
CC := gcc
LD := gcc
CFLGS := -g -Wall
LFLGS :=
FILEN := main
# LDIRS ... directories which contain library files
# IDIRS ... include directories (header locations)
# LIBS ... libraries to link against
# PKGS ... include dirs, library dirs and libraries which should be resolved via pkg-config
@redxef
redxef / windows-install-instructions.md
Last active September 10, 2017 17:26
This document contains instructions on how to install windows on an external drive, when no other windows version is available. This document is not complete and may contain errors.