Skip to content

Instantly share code, notes, and snippets.

View mikemackintosh's full-sized avatar
🍏
Working on the next big thing

Mike Mackintosh mikemackintosh

🍏
Working on the next big thing
View GitHub Profile
# Copyright (c) 1999-2011, Juniper Networks Inc.
# All rights reserved.
# Author: Jeremy Schulman
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# Copyright (c) 1999-2011, Juniper Networks Inc.
# All rights reserved.
# Author: Jeremy Schulman
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
@mikemackintosh
mikemackintosh / gist:8476734
Created January 17, 2014 16:46
bash tool to auto pull current branch when entering a directory and set your rock runtime if you have a .rock.yml file
env_mgr() {
if [ "$PWD" != "$OLDPWD" ]; then
OLDPWD="$PWD";
if [ -d .git ]; then
git pull
if [ -e ".rock.yml" ]; then
ROCK_RUNTIME=$(cat .rock.yml |grep runtime |cut -d" " -f2)
eval $(rock --runtime=${ROCK_RUNTIME} env)
#!/bin/bash
additional_strace_args="$1"
MASTER_PID=$(ps auwx | grep php-fpm | grep -v grep | grep 'master process' | cut -d ' ' -f 6)
while read -r pid;
do
if [[ $pid != $MASTER_PID ]]; then
nohup strace -r -p "$pid" $additional_strace_args >"$pid.trc" 2>&1 &
@mikemackintosh
mikemackintosh / gist:9494166
Last active March 27, 2023 06:25
ip2nic.txt
1.0.0.0/8,apnic
2.0.0.0/8,ripe
3.0.0.0/8,arin
4.0.0.0/8,arin
5.0.0.0/8,ripe
6.0.0.0/8,arin
7.0.0.0/8,arin
8.0.0.0/8,arin
9.0.0.0/8,arin
10.0.0.0/8,rfc1918
@mikemackintosh
mikemackintosh / gist:9590558
Created March 16, 2014 22:08
git branch check
ROCKET_GIT_BRANCH=$(git branch 2>/dev/null|sed 's/* //');if [[ -n $ROCKET_GIT_BRANCH ]]; then echo $ROCKET_GIT_BRANCH; fi
### Keybase proof
I hereby claim:
* I am mikemackintosh on github.
* I am loves2splug (https://keybase.io/loves2splug) on keybase.
* I have a public key whose fingerprint is CC33 800C C1DE 112D 6DC9 FB14 CEE7 9D3F 9255 989E
To claim this, I am signing this object:
@mikemackintosh
mikemackintosh / firewall-start
Last active March 30, 2022 22:56
Asus Router Firewall
#!/bin/sh
##################################################################################################
## 01/01/2015 --- RT-AC56U / RT-ACRT66U / RT-AC68U Firewall Addition v0.7.6 #
##################################################################################################
### ----- Make Sure To Edit The Following Files ----- #
### /jffs/scripts/firewall <-- Blacklists IP's From /tmp/home/root/ipset.txt #
### /jffs/scripts/ipset.txt <-- Banned IP List/IPSet Rules #
##################################################################################################
##############################
@mikemackintosh
mikemackintosh / bash
Created February 2, 2015 14:59
Python Pygments and colored cat output
sudo easy_install Pygments
alias cat='pygmentize -O console256 -g'
@mikemackintosh
mikemackintosh / create_keys
Created February 2, 2015 15:40
Used to generate max-length SSH keys for TMate
#!/bin/bash
gen_key() {
bits=4096
keytype=$1
ks="${keytype}_"
key="keys/ssh_host_${ks}key"
if [ ! -e "${key}" ] ; then
if [ "${keytype}" = 'dsa' ] ; then
bits=1024
elif [ "${keytype}" = 'ecdsa' ] ; then