Skip to content

Instantly share code, notes, and snippets.

View ederoyd46's full-sized avatar

Matthew Brown ederoyd46

View GitHub Profile
@ederoyd46
ederoyd46 / shell-tools.sh
Last active October 14, 2015 10:11
Useful Blacklist Functions
#Docker Tools
alias docker-container-ip="docker inspect --format '{{ .NetworkSettings.IPAddress }}'"
function docker_container_ip() { docker inspect --format '{{ .NetworkSettings.IPAddress }}' $1; }
#.htpassword file password hasher
function hash_password() { perl -le "print crypt(\"$1\", \"salt-hash\")"; }
#Firewall Tools
alias flush-blacklist='sudo bash -c "echo / > /proc/net/xt_recent/iptables_blacklist"'
alias blacklist='cat /proc/net/xt_recent/iptables_blacklist'
alias blacklist-count='blacklist | wc -l'
@ederoyd46
ederoyd46 / gist:23dc63f328a4271d455d
Last active September 3, 2015 08:06
Vagrant 2 Instances with Binary Replication using DRBD
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.synced_folder "../", "/home/vagrant/fall_manager_provisioning"
config.vm.provider "virtualbox" do |vb|
vb.gui = false
vb.memory = "4096"
@ederoyd46
ederoyd46 / GeoLocation.js
Created May 5, 2012 20:01
Javascript for finding latitude and longitude range boundaries
//Javascript for finding latitude and longitude range boundaries.
//Based on the excellent Java example by http://janmatuschek.de/LatitudeLongitudeBoundingCoordinates
var GeoLocation = GeoLocation ? GeoLocation : {
TO_RADIAN: 0.0174532925,
TO_DEGREE: 57.2957795,
EARTH_RADIUS: 6371.01,
TO_MILE: 0.621371192,
TO_KM: 1.609344,
MIN_LAT: function() { return GeoLocation.degreeToRadian(-90) },