Skip to content

Instantly share code, notes, and snippets.

View cmattoon's full-sized avatar

Curtis Mattoon cmattoon

View GitHub Profile
@cmattoon
cmattoon / gist:a63e75075e9bb4ccd50b
Created August 26, 2015 13:51
Most common errors in apache log
# Relies on log format:
# [Wed Aug 26 00:00:00 2015] [error] [client 123.45.67.8] Error message here
cat /var/log/apache2/error.log | awk '{out=$9;for(i=9;i<=NF;i++){out=out" "$i}; print out}' | sed s/,\ referer.*// | sort | uniq -c | sort -nr
@cmattoon
cmattoon / FontAwesome SASS-SCSS Variable List
Created March 7, 2014 15:11
FontAwesome SASS-SCSS Variable Declarations
/* FontAwesome Variable List
*
* Usage:
* .input.username {
* &:before {
* font-family: $icon-font;
* content: $fa-user;
* }
* }
*/
@cmattoon
cmattoon / FontAwesome Content Grabber
Created March 7, 2014 15:13
Script to pull FontAwesome "content" values.
var icons = {};
var ignore = ['fa-lg', 'fa-fw', 'fa'];
$('.container i.fa').each(function() {
var val, icon_name, icon_value, i;
val = window.getComputedStyle($(this).get(0), ':before').getPropertyValue('content');
icon_name = $(this).attr('class').split(' ')[1];
console.log(icon_name);
charcode = val.charCodeAt(0).toString(16);
icons[icon_name] = charcode;
#!/bin/bash
if [ ! -z "$1" ]; then
if [ ! -d "$1" ]; then
mkdir "$1"
mkdir "$1/bin"
mkdir "$1/docs"
mkdir "$1/tests"
mkdir "$1/$1"
touch "$1/README.md"
from fabric.api import *
env.roledefs = {}
env.passwords = {}
def patch_ssl():
sudo('apt-get update')
sudo('apt-get install openssl1.0.0 -y')
sudo('/etc/init.d/apache2 restart')
@cmattoon
cmattoon / gist:3f55ae9f544783867adb
Created December 20, 2014 19:13
one-line webserver
python -m SimpleHTTPServer 80
@cmattoon
cmattoon / dot-screenrc
Created February 10, 2015 18:36
~/.screenrc file
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W\}%c %{g}]'
@cmattoon
cmattoon / phpunit_install.sh
Last active August 29, 2015 14:16
PHPUnit Install Script
#!/bin/bash
if [ "$EUID" != "0" ]; then
echo "You must be root"
exit 1;
fi
wget https://phar.phpunit.de/phpunit.phar -O /usr/local/bin/phpunit && chmod +x /usr/local/bin/phpunit
echo "$(which phpunit)"
@cmattoon
cmattoon / After
Last active August 29, 2015 14:16
Removing commit #5 with git rebase
a2971b1 (HEAD, master) Commit # {10} [Curtis Mattoon]
0 0 file_10
feb3de8 Commit # {9} [Curtis Mattoon]
0 0 file_9
cc74178 Commit # {8} [Curtis Mattoon]
0 0 file_8
bfcbc72 Commit # {7} [Curtis Mattoon]
@cmattoon
cmattoon / command.sh
Last active August 29, 2015 14:16
Extract a table from mysql dump
# The basic command that gets run
sed -n '/CREATE TABLE.*table/,/UNLOCK TABLES/p' full_database_backup.sql > table.sql