Skip to content

Instantly share code, notes, and snippets.

View mheap's full-sized avatar
🦋
Follow me on Bluesky @mheap.dev

Michael Heap mheap

🦋
Follow me on Bluesky @mheap.dev
View GitHub Profile
@mheap
mheap / FileDupe.py
Created April 17, 2012 10:48
Find duplicate files in a given directory
#!/usr/bin/python
"""
Find duplicate files from a given root in the directory hierarchy of a given size
"""
import os
import glob
import sys
import hashlib
import optparse
import timeit
@mheap
mheap / gist:1362663
Created November 13, 2011 20:45
Connect to a remote mySQL Server over SSH
ssh -fNg -L3310:127.0.0.1:3306 user@server.domain.ext
mysql -h127.0.0.1 -P 3310 -u user -p db_name
@mheap
mheap / newmac.sh
Created October 11, 2011 18:43
Change MAC Address OSX
NEWMAC=$1
echo $NEWMAC
INTERFACE='en0'
echo "Before:"
ifconfig $INTERFACE | grep ether
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -z
ifconfig $INTERFACE ether $NEWMAC
echo "After:"
ifconfig $INTERFACE | grep ether
@mheap
mheap / oauth.php
Last active August 30, 2021 09:24
Example of using PECL's OAuth for PHP
<?php session_start();
define('OAUTH_CONSUMER_KEY', '');
define('OAUTH_CONSUMER_SECRET', '');
define('OAUTH_REQUEST_URL', 'https://api.twitter.com/oauth/request_token');
define('OAUTH_ACCESS_URL', 'https://api.twitter.com/oauth/access_token');
define('OAUTH_AUTHORISE_URL', 'https://api.twitter.com/oauth/authorize');
define('API_URL','http://api.twitter.com/1/');
svn export http://svn.ellislab.com/CodeIgniter/trunk/ && mv trunk html && mv html/system . && mv system/application/ . && NEWHOST=`echo $PWD | awk -F"/" '{ print $4 }'` && sed -i s/example\.com/$NEWHOST/ application/config/config.php
<?php
## PHP Version of osfameron's fixed width table parser
## http://github.com/osfameron/misc-opensource/tree/7317cbb59edb0ec9a5e023049d7c6b423d453d7f/parse-table
class row{
private $_cols = array();
private $_parsed = array();
private $_params = array();