Skip to content

Instantly share code, notes, and snippets.

View dearing's full-sized avatar

Jacob Dearing dearing

View GitHub Profile
@dearing
dearing / modules-nftables.conf
Created October 13, 2014 01:58
/etc/modules-load.d/nftables.conf
nf_conntrack
nf_conntrack_ipv4
nf_conntrack_ipv6
nf_defrag_ipv4
nf_defrag_ipv6
nf_nat
nf_nat_ipv4
nf_tables
nf_tables_inet
nf_tables_ipv4
@dearing
dearing / nftables.conf
Created October 13, 2014 01:56
standard netfilter tables script for bootup on Arch : /etc/nftables.conf
table inet firewall {
chain incoming {
type filter hook input priority 0;
# bad tcp -> avoid network scanning:
tcp flags & (fin|syn) == (fin|syn) drop
tcp flags & (syn|rst) == (syn|rst) drop
tcp flags & (fin|syn|rst|psh|ack|urg) < (fin) drop # == 0 would be better, not supported yet.
tcp flags & (fin|syn|rst|psh|ack|urg) == (fin|psh|urg) drop
@dearing
dearing / WXR-attachment-scraper-jpeg.rb
Created April 27, 2012 02:48
WXR export attachment scraper (hard-coded for type/jpeg); checks existing CDN objects and publishes them if needed
#!/usr/bin/ruby
require 'net/http'
require 'cloudfiles'
require 'colorize'
require 'uri'
i = 0
skipto = ARGV[0].to_i
snooze = ARGV[1].to_f
@dearing
dearing / trivialweb.go
Created April 18, 2012 02:13
Trivial HTTP/HTTPS server in Go
// trivial HTTP server
package main
import (
"flag"
"fmt"
"log"
"net/http"
)
@dearing
dearing / fizzbuzz.go
Created March 22, 2012 03:55
GO, FizzBuzz as a webserver...
/*
FizzBuzz in GO, as a webserver...
*/
package main
import (
"flag"
"fmt"
"net/http"
c "strconv"
@dearing
dearing / websockets-echo-test.cs
Created February 10, 2012 07:33
RFC6455: simple echo test with websocket after handshake
/* http://tools.ietf.org/html/rfc6455#section-5.2
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-------+-+-------------+-------------------------------+
|F|R|R|R| opcode|M| Payload len | Extended payload length |
|I|S|S|S| (4) |A| (7) | (16/64) |
|N|V|V|V| |S| | (if payload len==126/127) |
| |1|2|3| |K| | |
+-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - +
| Extended payload length continued, if payload len == 127 |