Skip to content

Instantly share code, notes, and snippets.

@cmattoon
cmattoon / .htaccess
Created March 13, 2015 00:48
InfoSecInstitute CTF - Level 2 - Content-Type Examples
# The .htaccess rewrite rule used to make "apple.php" look like "apple.png"
RewriteEngine On
RewriteBase /fakeimg/
RewriteRule ^apple.png$ apple.php
@cmattoon
cmattoon / args_error.sh
Last active August 29, 2015 14:16
Bash Script Default Parameter Demo
#!/bin/bash
# Triggers an error of params are empty.
username=${1:?"You must specify a username"}
password=${2:?"You must specify a password"}
echo "Setting password for ${username} to ${password}"
exit 0;
@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
@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 / 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 / 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 / emacs-web-mode.sh
Last active October 16, 2023 12:44
Easy install emacs web-mode
#!/bin/bash
## INSTALL:
##
## 1A) git clone <GIT_URL> web_mode_gist && cd web_mode_gist
## OR
## 1B) wget <RAW_URL>
## 2. chmod +x emacs-web-mode.sh
## 3. ./emacs-web-mode.sh
##
EMACS="${HOME}/.emacs"
@cmattoon
cmattoon / GitlabFullscreen.js
Last active May 27, 2016 11:37
Inject fullscreen button into GitLab diffs
// ==UserScript==
// @name GitLab Fullscreen Diffs
// @version 0.1
// @description Adds a 'fullscreen' button to GitLab diffs.
// @match http://*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
// @grant none
// ==/UserScript==
/**
* Be sure to change the @match param above to suit your needs.
@cmattoon
cmattoon / gist:3f55ae9f544783867adb
Created December 20, 2014 19:13
one-line webserver
python -m SimpleHTTPServer 80
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')