Skip to content

Instantly share code, notes, and snippets.

Hans Duedal duedal

Block or report user

Report or block duedal

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
duedal / race.go
Last active Aug 28, 2019
libheif segfault reproduce script
View race.go
package main
import (
duedal / gatewayapi.php
Last active Apr 7, 2017
WHMCSnow integration with
View gatewayapi.php
// This is untested code
class smsGateway_gatewayapi {
public $apifields = array(
'apitoken' => array("FriendlyName" => "API Token", "Type" => "text", "Size" => "64", ),
'senderid' => array("FriendlyName" => "Sender ID", "Type" => "text", "Size" => "15", ),
function sendSMSMessage() {
set -eux
sudo apt-get update
packages="postgresql-$PGVERSION postgresql-server-dev-$PGVERSION postgresql-common"
# bug:
sudo update-alternatives --remove-all postmaster.1.gz
duedal /
Last active Dec 13, 2015
Workaround mosh wrapper
#!/usr/bin/env python3
import subprocess
import argparse
import re
import os
parser = argparse.ArgumentParser(description='Mosh connection tool.')
parser.add_argument('target', metavar='target', type=str, help='the SSH target')
parser.add_argument('--port', type=int, default=22, help='the SSH port')
parser.add_argument('--new', help='Open a new session', action='store_true')
duedal / pf.conf
Created Oct 14, 2015
NPF Firewall Config
View pf.conf
# Max 3 mio states
set limit states 3000000
# Adaptive state timeouts
set timeout { adaptive.start 400000, adaptive.end 3000000 }
# Own Traffic (front net does not route)
nat on ix0 from -> round-robin
# NAT NPF traffic with source hashing
# Use a static random hash to keep public IP across firewall changes/reloads
duedal / norm.shar
Created Jun 25, 2015
norm FreeBSD port
View norm.shar
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
# This archive contains:
# norm
# norm/distinfo
# norm/Makefile
duedal / protoSocket.diff
Created Jun 25, 2015
Patches for protolib
View protoSocket.diff
--- protolib/src/common/protoSocket.cpp.orig 2015-06-25 13:43:52 UTC
+++ protolib/src/common/protoSocket.cpp
@@ -6,6 +6,7 @@
#ifdef MACOSX
#include <arpa/nameser.h>
#endif // MACOSX
+#include <netinet/in.h>
#include <resolv.h>
#endif // HAVE_IPV6
#include <sys/ioctl.h>
duedal /
Created May 28, 2015
Trim a CIDR string to make it compatible with inet_net_pton
#ifdef __FreeBSD__
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <algorithm> // find, find_if_not, reverse_copy, for_each
#include <functional> // bind1st, std::equal_to
#include <string> // string
#include <iostream> // cout
duedal /
Last active Aug 29, 2015
Sample code to count number of chars in a SMS
#include <cassert> // cassert
#include <cmath> // ceil
#include <iostream> // cout
#include <cstring> // memset, memcpy
// Given a UTF-8 encoded string, calculate the length of the resulting GSM
// 03.38 converted string.
// It assumes the input is valid UTF-8 and UTF-8 chars that can not be
// represented will be replaced with a single ? char.
// High optimized code, runs best with clang and optimizations (-O) enabled.
duedal / Makefile.diff
Created Apr 16, 2015
Modified uWSGI Makefile to support multiple python version in same binary
View Makefile.diff
diff -u /var/portshaker/freebsd/www/uwsgi/Makefile /var/portshaker/ocrepo/www/uwsgi/Makefile
--- /var/portshaker/freebsd/www/uwsgi/Makefile 2015-03-17 12:00:14.000000000 +0100
+++ /var/portshaker/ocrepo/www/uwsgi/Makefile 2015-04-16 19:47:51.000000000 +0200
@@ -12,20 +12,36 @@
-USES= python
+USES= python:2.7
USE_RC_SUBR= uwsgi
You can’t perform that action at this time.