Skip to content

Instantly share code, notes, and snippets.

View mikesmullin's full-sized avatar
🛴
woot!

Mike Smullin mikesmullin

🛴
woot!
View GitHub Profile
@mikesmullin
mikesmullin / config-php-w-xdebug.sh
Last active July 15, 2018 16:59
HOWTO: Configure PHP with Xdebug plugin
# Setup debugging with Xdebug
# apt wont install for php5.2, so build
cd /tmp
wget http://xdebug.org/files/xdebug-2.1.4.tgz
tar zxvf xdebug-2.1.4.tgz
cd xdebug-2.1.4/
sudo apt-get install php5-dev
phpize
./configure
make
@mikesmullin
mikesmullin / mysql_find_unused_indicies.sql
Last active July 15, 2018 16:59
Finds unused indexes in a MySQL database so you can remove them.
use information_schema;
select
tables.table_name,
statistics.index_name,
statistics.cardinality,
tables.table_rows
from tables
join statistics
on (statistics.table_name = tables.table_name
and statistics.table_schema = '<YOUR DATABASE NAME HERE>'
@mikesmullin
mikesmullin / msmtp.sh
Last active March 4, 2021 21:12
install msmtp gmail, a localhost sendmail alternative
# setup msmtp for sending out email
# as an alternative to sendmail
# i prefer this because it is easier to install and configure than sendmail
# especially when using Gmail smtp servers
sudo -i
apt-get install msmtp
ln -s /usr/bin/msmtp /usr/sbin/sendmail
touch /var/log/msmtprc && chmod 666 /var/log/msmtprc
vim /etc/msmtprc
# config options: http://msmtp.sourceforge.net/doc/msmtp.html#A-user-configuration-file
@mikesmullin
mikesmullin / .sh
Created April 13, 2011 12:56
Install Ubuntu Server in VirtualBox
# download an ISO of Ubuntu 10.4 LTS Server
# NOTE: If your pc is 64-bit and can emulate 64-bit VMs get that one. If not, use the i386/32-bit iso
# http://releases.ubuntu.com/lucid/ubuntu-10.04-server-amd64.iso
# http://releases.ubuntu.com/lucid/ubuntu-10.04-server-i386.iso
# download and install latest VirtualBox (3.2.4 r62467)
# http://www.virtualbox.org/wiki/Downloads
# run VirtualBox
# click Machine > New (Ctrl+N)
# click Next
@mikesmullin
mikesmullin / install-pgsql-ubuntu.sh
Last active July 15, 2018 16:54
Install PostgreSQL 8.4 on Ubuntu server
# setup db
sudo -i
apt-get install postgresql-8.4
vim /etc/postgresql/8.4/main/pg_hba.conf
# change line 82 to read:
local all all md5
# insert after line 84, replacing with your actual LAN ip outside the vm:
host all all 10.1.10.65/32 md5
:wq
vim /etc/postgresql/8.4/main/postgresql.conf
@mikesmullin
mikesmullin / stream-mysqldump-import-over-ssh.sh
Last active July 15, 2018 16:48
Import remote MySQL database by streaming a compressed dump over SSH
ssh REMOTE-SERVER.COM "mysqldump -uroot -p REMOTE_DB | gzip -c" | gunzip | mysql -uroot LOCAL_DB
@mikesmullin
mikesmullin / chromedriver.sh
Created May 8, 2012 16:08
easily install chromedriver on linux/osx
sudo apt-get install unzip;
wget -O /tmp/chromedriver.zip http://chromedriver.googlecode.com/files/chromedriver_linux64_19.0.1068.0.zip && sudo unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/;
@mikesmullin
mikesmullin / toggle-pulseaudio.sh
Last active September 23, 2020 10:51
linux pulseaudio headphone speaker toggle switch
#!/bin/bash
# see original thread discussion:
# http://ubuntuforums.org/showthread.php?t=1370383
declare -i sinks=(`pacmd list-sinks | sed -n -e 's/\**[[:space:]]index:[[:space:]]\([[:digit:]]\)/\1/p'`)
declare -i sinks_count=${#sinks[*]}
declare -i active_sink_index=`pacmd list-sinks | sed -n -e 's/\*[[:space:]]index:[[:space:]]\([[:digit:]]\)/\1/p'`
declare -i next_sink_index=${sinks[0]}
@mikesmullin
mikesmullin / install-ejabberd.sh
Created July 10, 2012 02:07
install ejabberd server on Ubuntu
sudo apt-get install ejabberd
sudo vim /etc/ejabberd/ejabberd.cfg
# may optionally want to set the hostname and acl admin user, otherwise not required
sudo /etc/init.d/ejabberd start
ejabberdctl register mikesmullin localhost PaSsWoRD
tail -f /var/log/ejabberd/*.log
@mikesmullin
mikesmullin / fixing-a-software-bug.md
Last active July 15, 2018 16:38
Process of fixing a software bug

Process of fixing a software bug:

A Guide for the Impatient Line Manager

(and how its interesting that only half of the time is estimatable

in a poorly run / bottom-dollar organization)

  1. Reproduce; verify problem
    (not estimatable; can only set a maximum cut-off time based on pain/worth)

    in other words, if you could capture errors at the moment they happen (client-side error reporting),
    as well as the steps that led up to them (user behavior analytics, determinism, demo recording),