Skip to content

Instantly share code, notes, and snippets.

@poggenpower
poggenpower / default-duid.md
Last active August 27, 2022 19:38
Convert default-duid from dhclient6.leases to hex for DHCP Server assigments

DUID reset and conversion

Using DHCPv6 in ipv6 you don't assign setting per MAC but per DUID. On many linux flavours you will find the DUID in the firtst line of /var/lib/dhcp/dhclient6.XXXX.leases as default-duid where XXXX is the name of the interface. e.g. default-duid "\000\001\000\001'\305H\356\016\265<\373[\372"; a string with octal escaped bytes if it is not a printable ACSI charakter.

converting the DUID

Almost all DHCPv6 servers expect the DUID in hex notation. Following python3 script will convert it:

duid = "\000\001\000\001'\305H\356\016\265&lt;\373[\372"
#!/usr/bin/env sh
if [ "$1" != "" ]; then
sBatchList=""
sBatchMessage="$3"
while IFS=, read col1 col2
do
sBatchList="$sBatchList $col1"

Transparent Git Encryption

This document has been modified from its [original format][m1], which was written by Ning Shang (geek@cerias.net). It has been updated and reformatted into a [Markdown][m2] document by [Woody Gilk][m3] and [republished][m4].

Description

When working with a remote git repository which is hosted on a third-party storage server, data confidentiality sometimes becomes

@Alvarus
Alvarus / nginx.kolab3.conf
Last active January 17, 2019 14:17
A sample nginx + php-fpm pool config for Kolab 3. Roundcube web client will be accessible from "https://mail.example.net", Kolab web administration from "https://mail.example.net/kolab-webadmin". Attempt to set all php variables using "fastcgi_param PHP_VALUE" resulted in strange behaviour, so they're set in php-fpm pools. Please note that sligh…
# http part, may want to move that to nginx.conf, but will work here also
fastcgi_cache_path /var/lib/nginx/fastcgi/ levels=1:2 keys_zone=kolab3.example.net:16m max_size=256m inactive=1d;
fastcgi_temp_path /var/lib/nginx/fastcgi/temp 1 2;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_use_stale error timeout invalid_header http_500;
server {
listen 80;
server_name kolab3.example.net;
rewrite ^ https://$server_name$request_uri permanent; # enforce https
@amitchhajer
amitchhajer / Count Code lines
Created January 5, 2013 11:08
Count number of code lines in git repository per user
git ls-files -z | xargs -0n1 git blame -w | perl -n -e '/^.*\((.*?)\s*[\d]{4}/; print $1,"\n"' | sort -f | uniq -c | sort -n
@jirutka
jirutka / rules-both.iptables
Created September 18, 2012 12:42
Basic iptables template for ordinary servers (both IPv4 and IPv6)
###############################################################################
# The MIT License
#
# Copyright 2012-2014 Jakub Jirutka <jakub@jirutka.cz>.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is