Skip to content

Instantly share code, notes, and snippets.

View maxclark's full-sized avatar

Max Clark maxclark

View GitHub Profile
@maxclark
maxclark / Open Safari URL in Google Chrome.scpt
Created July 18, 2011 22:42
Open Safari URL in Google Chrome
tell application "Safari" to set currentURL to URL of current tab of window 1
tell application "Google Chrome"
activate
if (exists window 1) and (URL of active tab of window 1 is "chrome://newtab/") then
tell window 1 to set URL of active tab to currentURL
else
open location currentURL
end if
end tell
@maxclark
maxclark / admin.lua
Created August 2, 2013 20:20
The illusive read/write splitting lua for the mysql-proxy. Includes connection pooling and read load balancing.
--[[
Copyright 2008, 2010, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@maxclark
maxclark / PythonInstall.md
Last active December 22, 2015 18:39
Install Python 2.7 (homebrew + pip + virtualenv) on Mac OS X Lion

Install Python

$ brew install readline sqlite gdbm
$ brew install python --universal --framework
$ python --version
Python 2.7

Symlinks...

@maxclark
maxclark / README.md
Last active December 30, 2015 10:29
PowerDNS tinydns backend support for FreeBSD

PowerDNS tinydns backend support for FreeBSD

Notes:

FreeBSD's tinycdb port is missing pkg-config data and targest to compile shared objects. For the time being I found it easier to compile and install tinycdb using the following flags:

make all shared piclib
make install install-sharedlib install-piclib

Grab the libcdb.pc file and place it in /usr/local/libdata/pkgconfig/libcdb.pc

@maxclark
maxclark / gist:7816389
Created December 6, 2013 00:01
Remove empty lines and lines starting with a "#" comment.
egrep -v '^#|^$' <file>
/*
This widget shows Recent Posts on your Tumblr blog.
Its dependency is jQuery.
Usage:
1) Add html:
<div id="recent-posts"></div>
2) Add code into the <head>:
@maxclark
maxclark / gist:11258216
Created April 24, 2014 15:09
Ping a range of IPs without using NMAP
# In BASH shell
for i in {1..254}; do
ping -c 1 -W 1 10.1.1.$i
done
# In TCSH
foreach number ( `jot 254` )
do ping -c 1 -W 1 10.1.1.$i
@maxclark
maxclark / range.sql
Last active August 29, 2015 14:01
Repeat a query inserting a range of numbers
INSERT into orig_route_cos_dest (orig_route_id, priority, class_dest, final)
SELECT gs.i, '1', 'bg:14', 't' f
FROM generate_series(417, 437) gs(i);

Keybase proof

I hereby claim:

  • I am maxclark on github.
  • I am maxclark (https://keybase.io/maxclark) on keybase.
  • I have a public key whose fingerprint is B984 3C33 4A9D 2094 B29D 936C 7565 2AA3 9705 A61A

To claim this, I am signing this object:

@maxclark
maxclark / dedupe.pl
Created June 16, 2014 21:27
Removes duplicates from the input file (first parameter on command line) and saves clean/dupe files to separate files
#!/usr/bin/perl
# removes duplicates from the input file (first parameter on command line) and saves clean/dupe files to separate files
$file = $ARGV[0];
open (FILE, $file);
open (CLEAN, ">clean.txt");
open (DUPES, ">dupes.txt");
#undef $/;