Skip to content

Instantly share code, notes, and snippets.

View udp2ws.js
// Bridging upd datagrams to websockets using a nodejs app
// Listening on udp://
// Broadcasting on ws://
// ->
var WebSocketServer = require('ws').Server;
var dgram = require("dgram");
var ServerWS = new WebSocketServer({port: 8080});
gboddin / HttpJsonClient.php
Last active Aug 29, 2015
Http JSON client class for REST API (like elasticsearch)
View HttpJsonClient.php
class HttpJsonClient {
static function GET($url,$body=null) {
return self::request('GET',$url,$body);
static function PUT($url,$body=null) {
return self::request('PUT',$url,$body);
static function DELETE($url,$body=null) {
gboddin /
Last active Aug 29, 2015
git subtree subdirectory without index clashes
git remote add -f upstream_lib1 /repo.source.git
git fetch upstream_lib1
git remote add -f upstream_lib2 /repo.source.git
git fetch upstream_lib2
git remote add -f upstream_sites /repo.source.git
git fetch upstream_sites
git checkout -b upstream_lib1 upstream_lib1/master # now on upstream branch
git subtree split --prefix=lib1 --annotate="[lib1]" --rejoin -b subtrees/lib1
gboddin / time
Created Dec 24, 2014
Some time routine ... I got bored :)
View time
$year = 0;
$month = 1;
$day = 0;
while(true) {
$year = str_pad($year,4,"0",STR_PAD_LEFT);
$date = $year.'-'.$month.'-'.$day;
echo $date.' '.date('r',strtotime($date)).PHP_EOL;
gboddin / mysql_community_latest_debian_salt.sls
Last active Aug 29, 2015
Install a configured mysql community edition server directly from mysql repos on Debian Stable
View mysql_community_latest_debian_salt.sls
- name: mysql-apt-config
- data:
'mysql-apt-config/select-server': {'type': 'string', 'value': 'mysql-5.6'}
'mysql-apt-config/select-utilities': {'type': 'string', 'value': 'utilities-1.5'}
'mysql-apt-config/select-connector-python': {'type': 'string', 'value': 'connector-python-2.0'}
- require:
gboddin /
Last active Aug 29, 2015
net corruption test
#quick nt wrapper thanks V****** Franck
[ -z "$1" ] && echo "First arg is <server/client>"&&exit 1
if [ "$1" = "server" ]; then
[ -z "$2" ] && echo "Second arg is listening port"&&exit 1
while /bin/true; do
nc -lp $2 2>/dev/null > /tmp/tcptest || nc -l $2 2> /dev/null > /tmp/tcptest
md5sum /tmp/tcptest
sleep 1
gboddin /
Last active Aug 29, 2015
An comfortable shell is a good beginning :) ...
# from the work of :
git clone ~/.bash_it
# say n none none none
. ~/.bash_it/
for e in bash-it defaults drush git git_flow ssh virtualbox ; do bash-it enable completion $e; done
for e in base battery browser dirs extract fasd git history python ssh tmux ; do bash-it enable plugin $e; done
for e in general git vim ; do bash-it enable alias $e; done
#logout/login now
View reprepro-distributions
Origin: Vagrant mirror repo
Label: Same
Codename: deb
Architectures: i386 amd64
Components: main
Description: Apt repository for project vagrant
#SignWith: 5269DE62
gboddin / -etc-tor-torrc
Created Mar 10, 2015
Avoid silent block from stupid ISPs with tor
View -etc-tor-torrc
AutomapHostsOnResolve 1
TransPort 9040
DNSPort 53535