Skip to content

Instantly share code, notes, and snippets.

View samgaw's full-sized avatar
🇪🇺
¯\_(ツ)_/¯

Sam Gaw samgaw

🇪🇺
¯\_(ツ)_/¯
View GitHub Profile
@samgaw
samgaw / meraki-init.sh
Created June 29, 2020 15:19 — forked from lukas2511/meraki-init.sh
Meraki MS220-8P config without cloud bullshit
#!/bin/sh
# This script configures a meraki ms220-8p switch completely from scratch
# See https://leo.leung.xyz/wiki/Meraki_MS220-8P for rooting instructions
# You can keep config and config.local completely empty, but i'd recommend to add a configuration
# which isolates all ports from each other.
# Without that you might have switching loops on bootup (unlikely since STP keeps longer to initialize
# than it takes this script to take over, but it just feels cleaner).
@samgaw
samgaw / lua.md
Created January 31, 2018 23:50 — forked from ahupowerdns/lua.md
The LUA record type for Lua-powered DNS records

LUA Record Type for Lua-powered DNS records for standards based fail-over and geographical load balancing

GitHub branch -> https://github.com/ahupowerdns/pdns/tree/luarec

Recently, many zone owners could not migrate away from Dyn since they were benefiting from non-standardised DNS-based failover and geographical loadbalancing features. What you see below is an attempt to get standards based but flexible equivalents of these currently proprietary features. Here is a zone:

$TTL 60
lua.br. IN      SOA     a.lua.br. nstld.verisign-grs.com. (
        2016032300      ; Serial
        14400           ; Refresh
@samgaw
samgaw / postsql.sql
Created August 23, 2012 01:38 — forked from tobyhede/postsql.sql
PostgreSQL as JSON Document Store
-- PostgreSQL 9.2 beta (for the new JSON datatype)
-- You can actually use an earlier version and a TEXT type too
-- PL/V8 http://code.google.com/p/plv8js/wiki/PLV8
-- Inspired by
-- http://people.planetpostgresql.org/andrew/index.php?/archives/249-Using-PLV8-to-index-JSON.html
-- http://ssql-pgaustin.herokuapp.com/#1
-- JSON Types need to be mapped into corresponding PG types
--
import re
# http://atomboy.isa-geek.com/plone/Members/acoil/programing/double-metaphone
from metaphone import dm as double_metaphone
# get the Redis connection
from jellybean.core import redis
import models
# Words which should not be indexed
sudo apt-get update
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:pitti/postgresql
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install -y postgresql-9.0 postgresql-server-dev-9.0 postgresql-contrib-9.0 proj libgeos-3.2.2 libgeos-c1 libgeos-dev libgdal1-1.7.0 libgdal1-dev build-essential libxml2 libxml2-dev checkinstall
psql --version