Skip to content

Instantly share code, notes, and snippets.

View aeris's full-sized avatar

aeris aeris

View GitHub Profile
#!/bin/bash
HOST="${1}"
PORT="${2}"
[ "$PORT" ] && PORT=":${PORT}"
revoke() {
local HOST="[${1}]${PORT}"
echo "Revoking ${HOST}"
ssh-keygen -R "${HOST}"
}
#!/bin/sh
DIR=/usr/share/ca-certificates/cacert
mkdir $DIR
wget http://www.cacert.org/certs/root.crt -O $DIR/class1.crt
wget http://www.cacert.org/certs/class3.crt -O $DIR/class3.crt
dpkg-reconfigure ca-certificates
# Choose « yes » to add all new certificates automatically
# or « ask » to select manually the CACert certificates to use
@aeris
aeris / keybase.md
Created April 2, 2014 17:20
Keybase GitHub proof

Keybase proof

I hereby claim:

  • I am aeris on github.
  • I am aeris (https://keybase.io/aeris) on keybase.
  • I have a public key whose fingerprint is 6A68 B761 2629 7666 ECF4 8F03 EFB7 4277 ECE4 E222

To claim this, I am signing this object:

@aeris
aeris / rsync-snapshot.rb
Last active August 29, 2015 14:00
RSync snapshot
#!/usr/bin/env ruby
require 'fileutils'
load '/etc/rsync-snapshot.conf'
def protect
if File.exists? LOCK_FILE
print "#{$0} already running\n"
exit -1
end
@aeris
aeris / socks5.cpp
Created September 12, 2014 00:32
W.T.F.
#include <arpa/inet.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
int main() {
sockaddr_in proxyAddress;
proxyAddress.sin_family = AF_INET;
@aeris
aeris / converter.rb
Created June 24, 2015 22:19
Automatize video encoding for publication
#!/usr/bin/env ruby
# Licence : AGPLv3+
require 'nokogiri'
require 'tempfile'
require 'time'
RESOLUTION = :p576
AUDIO_FREQUENCY = 44100
ROOT_DIRECTORY = File.expand_path (ARGV[0] || '.')
@aeris
aeris / firewall.sh
Created July 24, 2015 07:59
fuck-pjlrenseignement
#!/bin/sh
iptables -t nat -N TOR
iptables -t nat -A TOR -p tcp -d 127.0.0.0/8 -j RETURN
iptables -t nat -A TOR -p tcp -d 10.0.0.0/8 -j RETURN
iptables -t nat -A TOR -p tcp -d 172.16.0.0/12 -j RETURN
iptables -t nat -A TOR -p tcp -d 192.168.0.0/16 -j RETURN
iptables -t nat -A TOR -p tcp -j REDIRECT --to-ports 9052
iptables -t nat -A OUTPUT -p tcp --syn -j TOR
iptables -t nat -A OUTPUT -p udp --dport domain -j REDIRECT --to-ports 9053
@aeris
aeris / scoping.js
Created September 2, 2015 09:46
JS scoping hell
var val = 1;
function foo() {
print(val);
val = 2;
print(val);
}
function bar() {
var val = 3;
@aeris
aeris / qrcode-backup.rb
Created March 10, 2014 22:57
Backup file into QR code
#!/usr/bin/env ruby
require 'chunky_png'
require 'rqrcode_png'
CHUNK_SIZE=4096/6 # 5462 bits, QRCode 29 = 5608 bits
IMG_SIZE = 800
IMG_PER_LINE = 2
def chunk(string, size)
string.scan /.{1,#{size}}/om
@aeris
aeris / gist:1078590
Created July 12, 2011 18:17
Firewall
### BEGIN INIT INFO
# Provides: iptables
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
#!/bin/sh