Skip to content

Instantly share code, notes, and snippets.

View zorael's full-sized avatar

JR zorael

  • Sweden
  • 16:35 (UTC +02:00)
View GitHub Profile
void main()
{
string[][string] ignore;
deserialise(string.init, ignore);
}
void deserialise(Range, Things...)(Range range, Things things)
{
foreach (rawline; range)
{
@zorael
zorael / typecons_extra.d
Created January 28, 2022 14:16
access wrapper template mixin
// GenerateMutator
/++
FIXME
+/
enum GenerateMutator;
// GenerateAccessor
/++
FIXME
@zorael
zorael / qemu-access-limits.sh
Created July 31, 2021 13:56
iptables script to rate-limit the access to a QEMU RDP port open to the world (just use `iptables-save`)
#!/bin/bash
set -e
if [[ $UID -gt 0 ]]; then
echo "sudo ${0##*/} $@"
sudo $0 "$@"
exit $?
fi
@zorael
zorael / tolower
Created June 22, 2019 17:51
Recursively changes the names of all files and directories to lowercase (no support for symlinks)
#!/bin/sh
rename_twice() {
local IFS
local from="$1"
local to="$2"
[ "$from" = "$to" ] && return
mv "$from" "${from}_"
mv "${from}_" "$to"
@zorael
zorael / segfault.d
Created September 4, 2018 19:28
gdc internal compiler error
module segfault;
struct Foo {}
struct Bar
{
string configFile;
}
Bar settings;
@zorael
zorael / numreplies.yaml
Created November 11, 2017 22:02 — forked from proxypoke/numreplies.yaml
IRC Numeric Replies in YAML
# This file is a transcription of RFC 1459 section 6 into YAML, so that
# programs written in any language may utilize it. It describes the
# various numeric replies an IRC server may send, their canonical name,
# number and a short description, if available.
#
# Copywrong (c) 2012 slowpoke (Proxy) < proxypoke at lavabit dot com >
# This file is licensed under the terms of the WTFPL v2.
#
#
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@zorael
zorael / initctl.systemd
Last active August 29, 2015 13:56
systemctl wrapper around initctl
#!/bin/bash
# systemctl wrapper around upstart's CLI service management tool /sbin/initctl
# This script will try to emulate initctl behavior and output within reason.
# 1. Save this as initctl.systemd someplace
# /opt or /usr/local/bin will do if you don't want to pollute /sbin
# 2. Rename /sbin/initctl to /sbin/initctl.upstart (hardcoded line 16)
# 3. Symlink this script to /sbin/initctl
# 4. Redo upon upstart package upgrade