Skip to content

Instantly share code, notes, and snippets.

View Aketzu's full-sized avatar

Anssi Kolehmainen Aketzu

View GitHub Profile
@Aketzu
Aketzu / gist:11281584
Last active August 29, 2015 14:00
OpenVPN DNS update script
-- openvpn config
client-connect "/etc/openvpn/update-dns add"
client-disconnect "/etc/openvpn/update-dns remove"
-- /etc/openvpn/update-dns
#!/bin/sh
#Debugging
#echo $* >> /tmp/dnsupd.txt
#capture screenshots, run in crontab
#!/bin/bash
PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
USER=akolehma
export PATH USER
cd /mnt/asm
@Aketzu
Aketzu / patlite.c
Created January 2, 2015 10:29
Patlite LU7-USB linux
#include <libusb-1.0/libusb.h>
#include <stdint.h>
#include <stdio.h>
#define PATLITE_VID 0x191A
#define PATLITE_PID 0x8003
#define PATLITE_ENDPOINT 1
static libusb_device_handle *patlite_handle = 0;
### Keybase proof
I hereby claim:
* I am aketzu on github.
* I am aketzu (https://keybase.io/aketzu) on keybase.
* I have a public key whose fingerprint is 6F3B 2BA2 5D38 5CC6 CDB8 B711 010F 6C60 7855 9C3D
To claim this, I am signing this object:
@Aketzu
Aketzu / myapp-worker.conf
Created March 6, 2016 22:12
Upstart + multiprocess Thin for Rails + nginx
description "MyApp worker"
respawn
setuid myapp
setgid myapp
chdir /srv/myapp
#Ruby 1.9, default to UTF-8 encoding on files
env RUBYOPT=-KU
@Aketzu
Aketzu / gist:54162db0d428c0cfad4fc842b416785c
Created January 6, 2018 21:55
ICU chardet ISO-8859-1 match patterns
en
a , an, be, co, fo, ha, he, in, ma, of, pr, re, sa, st, th, to, wh,aid,al ,an ,and,as ,at ,ate,ati,d a,d t,e a,e s,e t,ed ,ent,er ,es ,for,hat,he ,her,id ,in ,ing,ion,is ,n a,n t,nd ,ng ,nt ,of ,on ,or ,re ,rs ,s a,s t,sai,st ,t t,ter,tha,the,tio,to ,ts
da
af, at, de, en, er, fo, ha, i , me, og, p�, si, st, ti, vi,af ,an ,and,ar ,at ,de ,den,der,det,e s,ed ,ede,en ,end,er ,ere,es ,et ,for,ge ,gen,ger,ige,il ,ing,ke ,kke,ler,lig,lle,med,nde,ne ,ng ,nge,og ,om ,or ,p� ,r d,r e,r s,re ,ste,t s,te ,ter,til,ver
de
an, au, be, da, de, di, ei, ge, ha, in, mi, sc, se, un, ve, vo, we, zu,ber,ch ,che,cht,das,den,der,die,e d,e s,ein,eit,en ,er ,es ,gen,hen,ht ,ich,ie ,in ,ine,it ,lic,lle,n a,n d,n s,nd ,nde,ne ,ng ,nge,nte,r d,rde,rei,sch,ste,t d,te ,ten,ter,und,ung,ver
es
@Aketzu
Aketzu / irssi
Created May 16, 2018 09:07
irssi slack
https://api.slack.com/custom-integrations/legacy-tokens
/NETWORK ADD fooslack -autosendcmd "/MSG slack login xoxp-............"
/SERVER ADD -network fooslack -auto localhost 6669
/CONNECT fooslack
/NETWORK ADD barslack -autosendcmd "/MSG slack login xoxp-............"
/SERVER ADD -network barslack -auto localhost 6669
/CONNECT barslack
@Aketzu
Aketzu / macserv.c
Created July 11, 2018 16:05
Local webserver to provice MAC address
// Compile with -lmicrohttpd
#include <arpa/inet.h>
#include <errno.h>
#include <limits.h>
#include <linux/rtnetlink.h>
#include <linux/types.h>
#include <microhttpd.h>
#include <net/if.h>
#include <stdio.h>
@Aketzu
Aketzu / auth-index.php
Created January 2, 2020 06:52
PHP Azure auth
<?php
session_start();
require('vendor/autoload.php');
$provider = new TheNetworg\OAuth2\Client\Provider\Azure([
'clientId' => '12345678-1234-1234-1234-12345678abcd',
'clientSecret' => 'xxx',
'redirectUri' => 'https://example.com/auth',
'tenant' => 'example.com',
'scope' => 'openid email profile User.Read Directory.Read.All',
@Aketzu
Aketzu / main.cf
Created January 9, 2020 17:50
Postfix sender specific smtp with auth
sender_dependent_default_transport_maps = hash:/etc/postfix/sender_transport
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_use_tls = yes
smtp_sasl_security_options = noanonymous