Skip to content

Instantly share code, notes, and snippets.

View mhammonds's full-sized avatar

Mark Hammonds mhammonds

View GitHub Profile
# Play the "Submarine" audio clip once a minute
while true; do
/usr/bin/afplay /System/Library/Sounds/Morse.aiff
sleep 60
done
cat users.csv | cut -f 3 -d "|" | sort | uniq -d | xargs -n 1 -I {} sed -i '/{}/d' ./users.csv
import "runtime"
// Generate a Stack Trace
buf := make([]byte, 1<<16)
runtime.Stack(buf, true)
n := bytes.Index(buf, []byte{0})
stackTrace := string(buf[:n])
@mhammonds
mhammonds / vmware_fusion_fedora_shares.sh
Created May 26, 2015 16:27
Enable VMWare Fusion 7 Shared Folders on Fedora 21
#!/usr/bin/bash
# Before running this script, select "Reinstall VMware Tools" for
# the guest VM and then mount the vmware tools CD.
# Install the proper kernel headers for the OS
sudo yum install "kernel-devel-uname-r == $(uname -r)"
# Place the tools into a working directory and unmount the CD
cp "/run/media/$USER/VMware Tools/VMwareTools-9.9.2-2496486.tar.gz" ~/.
cd ~
@mhammonds
mhammonds / gist:ef7d828f7857755e9ac3
Created March 22, 2015 22:06
Detect the URL of parent iFrame
if( window.self !== window.top )
{
alert(document.referrer);
}
@mhammonds
mhammonds / user_kill.sh
Created June 3, 2014 14:52
Lockout user and kill processes
#/bin/bash
passwd -l username
pkill -KILL -u username
@mhammonds
mhammonds / mac_cores.sh
Last active August 29, 2015 14:02
Mac Core Finder
# Return the number of cores on a Mac OS machine
sysctl -n hw.ncpu
# This also works
sysctl hw.ncpu | awk '{print $2}'
@mhammonds
mhammonds / recent_rpms.sh
Created May 28, 2014 01:27
List recently installed RPM packages
rpm -qa --qf '%{INSTALLTIME} (%{INSTALLTIME:date}): %{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n'
@mhammonds
mhammonds / ansible_selinux_check.yml
Created May 27, 2014 16:50
Ansible: SELinux Check
- name: Check if SELinux is running
command: getenforce
register: sestatus
changed_when: false
tags: selinux
" My ~/.vimrc is quite minimal as everything
" is inherited from Vim Boilerplate.
" Enable Vim Boilerplate Shortcuts
autocmd VimEnter * :call VBPShortcuts()