Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am wulfgarpro on github.
  • I am wulfgarpro (https://keybase.io/wulfgarpro) on keybase.
  • I have a public key ASC8ENkegPmPXmvdtPn9D7MLtZLEmUW4JLAErh-1Zn0p2Ao

To claim this, I am signing this object:

@wulfgarpro
wulfgarpro / slowloris.js
Last active May 23, 2017 06:58
Slowloris example against apache2 on Ubuntu 16.10 (yakkety) "2.4.18-2ubuntu4.1"
'use strict';
const net = require('net');
const maxConnections = 200; // Max connections
const host = '127.0.0.1';
const port = 80;
let connections= [];
function Connection(h, p) {
@wulfgarpro
wulfgarpro / Makefile
Last active January 23, 2017 02:29
makefile header dependency target
SRCS = a.c
depend: .depend
.depend: $(SRCS)
rm -f ./.depend
$(CC) $(CFLAGS) -MM $^ -MF ./.depend;
include .depend
@wulfgarpro
wulfgarpro / CMakeLists.txt
Last active July 14, 2016 07:38
Example cmake file with gtest
cmake_minimum_required (VERSION 2.6)
option (test "Build all tests." ON)
project (Tutorial)
set (CMAKE_CXX_FLAGS "-g -Wall")
#add_subdirectory (src/tutorial)
# The version number.
@wulfgarpro
wulfgarpro / generate.py
Last active February 21, 2016 04:59
cgi script in python to generate kml LineString with LineStyle
#!/usr/bin/python
import random
lat_a = random.randrange(35, 40)
lon_a = random.randrange(-120, -112)
lat_b = random.randrange(35, 40)
lon_b = random.randrange(-120, -112)
kml = (
@wulfgarpro
wulfgarpro / cgi-kml.kml
Last active February 21, 2016 05:00
Example kml to load cgi script using NetworkLink with flyToView/refreshInterval enabled
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Folder>
<name>Network Links</name>
<visibility>0</visibility>
<open>0</open>
<description>Network link example 1</description>
<NetworkLink>
<name>Random Placemark</name>
<visibility>0</visibility>
@wulfgarpro
wulfgarpro / docker_rm_all.sh
Created December 1, 2015 05:20
Single line to remove all containers from docker
docker ps -a | awk '{ print $1 }' | xargs -I {} docker rm -f {}
@wulfgarpro
wulfgarpro / gist:5889382
Last active December 19, 2015 03:19
Board generation code
private def setupBoard() {
// generate board based on observed patterns (see readme)
(1..4).each( {
if(it == 1) {
(minX..maxX).each( {
if(it == minX) {
board.put("${it},${minY}", ["NORTH":true,"SOUTH":false,"EAST":true,"WEST":false])
} else if(it == maxX) {
board.put("${it},${minY}", ["NORTH":true,"SOUTH":false,"EAST":false,"WEST":true])
} else
@wulfgarpro
wulfgarpro / gist:4257841
Created December 11, 2012 11:11
Javascript prototypes, constructors, and inheritence
​var Person = function(name) {
if(name) this.name = name;
};
Person.prototype.name = 'No name';
Person.prototype.setName = function(name) {
this.name = name;
};
Person.prototype.getName = function() {
return this.name;
};
@wulfgarpro
wulfgarpro / gist:4202874
Created December 4, 2012 11:28
Shell script to route my wlan0 via eth0
#!/bin/bash
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain
iptables --table nat --append POSTROUTING --out-interface wlan0 -j MASQUERADE
iptables --append FORWARD --in-interface eth0 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward