Skip to content

Instantly share code, notes, and snippets.

View pldubouilh's full-sized avatar

Pierre Dubouilh pldubouilh

View GitHub Profile
@pldubouilh
pldubouilh / emoji.js
Last active January 19, 2016 16:29 — forked from windytan/emoji.pl
Visualize SSH public key fingerprints using Unicode emoji
// Taken from Oona Räisänen 2013 / http://windytan.com
// Adapted to work well with b64 encoded keys
// ssh-keygen -lf ~/.ssh/id.pub | node emoji.js
var glyphs = [ '🌀','🌂','🌅','🌈','🌙','🌞','🌟','🌠','🌰','🌱','🌲','🌳','🌴','🌵','🌷','🌸',
'🌹','🌺','🌻','🌼','🌽','🌾','🌿','🍀','🍁','🍂','🍃','🍄','🍅','🍆','🍇','🍈',
'🍉','🍊','🍋','🍌','🍍','🍎','🍏','🍐','🍑','🍒','🍓','🍔','🍕','🍖','🍗','🍘',
'🍜','🍝','🍞','🍟','🍠','🍡','🍢','🍣','🍤','🍥','🍦','🍧','🍨','🍩','🍪','🍫',
'🍬','🍭','🍮','🍯','🍰','🍱','🍲','🍳','🍴','🍵','🍶','🍷','🍸','🍹','🍺','🍻',
@pldubouilh
pldubouilh / howto.md
Last active March 5, 2018 15:02
Linux packet preprocessing using netfilters
@pldubouilh
pldubouilh / up.sh
Created July 17, 2016 13:18
Bind openvpn to one local IP
#!/bin/sh
# From https://snikt.net/blog/2013/10/10/how-to-force-program-to-use-vpn-tunnel/
# Execute first :
# echo "10 custom_table" >> /etc/iproute2/rt_tables
# Put this in opvpn config :
# route-noexec
# route-up /home/p/route_up.sh
@pldubouilh
pldubouilh / channel.yml
Last active July 17, 2016 15:03
Get your podcasts ready right after their broadcast 👍
# Needs to be in /var/www/html/channel.yml
:title: 'All About Everything'
:description: 'A show about everything'
:url: 'https://www.server.com/data'
@pldubouilh
pldubouilh / setup.md
Last active July 31, 2016 16:47
Multi protocol/port openvpn

Prep conf files

cp server.conf udp.conf
cp udp.conf tcp.conf

Amend udp.conf

proto udp
port 1194
@pldubouilh
pldubouilh / backup.sh
Created January 23, 2017 19:37
Simple raid like backup using rsync
#!/bin/bash
# Super simple raid like copy of 2 disks - Designed to be cron'd and forgotten
# Made so that the "external" disk can be removed at all times
# appart from when it's being used, but the backups should be fast (ran at night).
# "internal" disk is at /media/raid
# "external" disk is at /media/ext
if [ -e /dev/disk/by-label/EXT ]; then
set-option -g status
set-option -g status-position bottom
set-window-option -g xterm-keys on
bind-key -n S-Left previous-window
bind-key -n S-Right next-window
unbind C-b
set -g prefix C-z
@pldubouilh
pldubouilh / hexDump.c
Last active September 20, 2018 13:52 — forked from leonid-ed/hexDump.c
This function prints hex dump of memory specified as a pointer
/*
* This function prints hex dump of memory specified as a pointer.
* Reference: http://stackoverflow.com/questions/7775991/how-to-get-hexdump-of-a-structure-data
*/
#include <stdio.h>
void hexdump(void *addr, int len)
{
int i;
unsigned char buff[17];
@pldubouilh
pldubouilh / emitter.c
Created May 30, 2018 09:39
Pass & received signals with arguments (SIGUSR2)
#include <stdio.h>
#include <signal.h>
int main(int argc, char *argv[]) {
int pid = atoi(argv[1]);
union sigval value;
value.sival_int = atoi(argv[2]);
// value.sival_ptr = (void*) strdup(argv[3]);
@pldubouilh
pldubouilh / .tmux.conf
Last active April 21, 2020 13:10
same-config-on-multiple-sessions kind of tmux
set-hook -g after-new-session 'if -F "#{==:#{session_name},home}" "source ~/.tmux.home" "source ~/.tmux.server"'
set-hook -g client-session-changed 'if -F "#{==:#{session_name},home}" "source ~/.tmux.home" "source ~/.tmux.server"'