Skip to content

Instantly share code, notes, and snippets.

View mikeclarke's full-sized avatar

Mike Clarke mikeclarke

View GitHub Profile

Keybase proof

I hereby claim:

  • I am mikeclarke on github.
  • I am mikeclarke (https://keybase.io/mikeclarke) on keybase.
  • I have a public key whose fingerprint is 1F99 4D6A C1D3 771D 46AA E6C3 A597 17C3 18C9 FCDF

To claim this, I am signing this object:

@mikeclarke
mikeclarke / gist:9844487
Created March 28, 2014 22:40
Stacktrace for git caching error
Something went wrong...the Omnibus just ran off the road!
Error raised was:
Expected process to exit with [0], but received '128'
---- Begin output of git --git-dir=/var/cache/omnibus/cache/install_path/opt/st --work-tree=/opt/st add -A -f ----
STDOUT:
STDERR: fatal: Not a git repository: embedded/lib/python2.7/site-packages/sentry/static/CACHE/sentry/bootstrap/../../../../../.git/modules/src/sentry/static/sentry/bootstrap
---- End output of git --git-dir=/var/cache/omnibus/cache/install_path/opt/st --work-tree=/opt/st add -A -f ----
Ran git --git-dir=/var/cache/omnibus/cache/install_path/opt/st --work-tree=/opt/st add -A -f returned 128
@mikeclarke
mikeclarke / sentry.rb
Created March 31, 2014 20:15
sentry software config for omnibus-ruby. should be added to an omnibus project in `config/software/sentry.rb`
name "sentry"
default_version "6.4.4"
dependency "python"
dependency "pip"
build do
command "#{install_dir}/embedded/bin/pip install -I --install-option=\"--install-scripts=#{install_dir}/bin\" #{name}==#{version}"
command "rm -rf #{install_dir}/embedded/lib/python2.7/site-packages/sentry/static/CACHE/sentry/bootstrap/.git*"
command "rm -rf #{install_dir}/embedded/lib/python2.7/site-packages/sentry/static/sentry/bootstrap/.git*"
@mikeclarke
mikeclarke / migrate-sitemap.py
Created December 12, 2010 22:21
Script to use fuzzy matching to generate a new sitemap.xml
import re
from xml.dom import minidom
from difflib import get_close_matches
# The old sitemap.xml file
sourceXML = minidom.parse('sitemap-old.xml')
# sitemap.xml from the new site
targetXML = minidom.parse('sitemap-new.xml')
sourceNodes = sourceXML.getElementsByTagName('loc')
@mikeclarke
mikeclarke / Add user
Created December 12, 2010 21:39
Initial user setup on a CentOS box
# Create a new user (CentOS will create /home/admin as well)
adduser admin
# Assign the user a new password
passwd admin
# Add the user to the "wheel" group
usermod -a -G wheel admin
# Edit the /etc/sudoer file (requires knowledge of vi)
visudo
@mikeclarke
mikeclarke / package-install
Created December 12, 2010 21:42
Installing baseline packages
yum update
yum groupinstall 'Development Tools'
@mikeclarke
mikeclarke / Credit card grep
Created December 12, 2010 21:48
Locating credit card data in log files
find /var/log/application/* -name "*.log" -type f -mtime -1
-exec egrep -Hn \
'\b(?:4[0-9]{12}(?:[0-9]{3})?
|5[1-5][0-9]{14}
|6(?:011|5[0-9][0-9])[0-9]{12}
|3[47][0-9]{13}
|3(?:0[0-5]|[68][0-9])[0-9]{11}
|(?:2131|1800|35\d{3})\d{11})\b'
{} > ~/output.out \;
cd ~/src
wget http://bit.ly/6E0DNN
chmod u+x setuptools-0.6c11-py2.6.egg
./setuptools-0.6c11-py2.6.egg --prefix=/usr/local
easy_install -U pip
pip install -U virtualenv
@mikeclarke
mikeclarke / postgres-install
Created December 12, 2010 21:44
Basic PostgreSQL install
# Install the postgres packages
yum install postgresql postgresql-server
# Configure postgresql to start automatically on boot
chkconfig postgresql on
# Stat posgresql
service postgresql start
# Switch to postgres user (required to make initial connection to postgresql with default configuration)
su - postgres
# Make initial connection to the database to test connectivity
psql -d template1 -U postgres
@mikeclarke
mikeclarke / iptables
Created December 12, 2010 21:41
Initial iptables configuration
# Flush iptables rules (start with a clean slate where all traffic to all destinations is allowed)
iptables -F
# Allow loopback traffic
iptables -A INPUT -i lo -j ACCEPT
# Reject traffic destined to any port on IP address 127.0.0 through 127.0.0.7
# iptables -A INPUT -i ! lo -d 127.0.0.0/8 -j REJECT
# Allow all ESTABLISHED and RELATED connections to stay up
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allow all external hosts to be reachable from the box
iptables -A OUTPUT -j ACCEPT