Skip to content

Instantly share code, notes, and snippets.

View codelitt's full-sized avatar

Cody Littlewood codelitt

View GitHub Profile
@codelitt
codelitt / traffic_sim.sh
Last active October 31, 2017 19:24
Quickly throw traffic at site
for i in `seq 1 100`; do curl $URL; done
## With basic HTTP auth
for i in `seq 1 100`; do curl -u username:password $URL; done
@codelitt
codelitt / main.go
Last active March 17, 2017 14:28
Trying to add cachebusted css file to the ExecuteTemplate method
package main
imports (
"path/filepath"
"strings"
"github.com/gorilla/mux"
)
func main() {
server_port := ":3000"
@codelitt
codelitt / csv-lovechild.sh
Last active July 27, 2016 13:16
Combine multiple csv files into one file while preserving the headers from the first csv
awk 'FNR==1 && NR!=1{next;}{print}' *.csv > newfile.csv
@codelitt
codelitt / arch.sh
Created August 7, 2015 12:09
Useful Arch commands for freeing up space
#See which files in / are taking up space
du -md1 / | sort -n
#better way to see which directories in / are taking up space.
ncdu -x /
#Clean pacman cache
pacman -Scc
@codelitt
codelitt / docker.sh
Last active August 29, 2015 14:13
Setting up docker for Go
#Build image from Dockerfile in same directory.
docker build --rm=true -t go_playground .
#Run docker image in a container with interactive shell connecting /go on my host machine to /go in docker container
# has name go-playgound and is ran from image go_playground.
sudo docker run -ti -p 9000:9000 -v /home/cody/projects/go:/go --name=go-playground go_playground /bin/bash -l
#Turns out that you don't need we don't need bin/bash. Line 52 in the dockerfile does that
#with no command at the end, it automatically uses what's in CMD in the docker file.
#Sometimes you still have to add the command on my setup for some reason though
@codelitt
codelitt / gist:90a80e582ba76ab97fdc
Last active August 29, 2015 14:08
Docker Workflow for Ruby and postgres
#create the data/volume container
docker run -v /var/lib/pgsql/data -v /home/cody/projects/warrantygenius:/var/www --name=wg_storage ubuntu true
#Build postgres image from within the dockerfile directory
docker build --rm=true -t wg_postgres .
#Create and run postgres container from the image
docker run -d --name=wg-postgres --volumes-from=wg_storage wg_postgres
#Build ruby image. rm clears cache? and -t tags it as that name
@codelitt
codelitt / gist:c47bece467e2be7352fe
Created October 15, 2014 01:48
Docker workflow
# Create ghost volume to store our data
docker run -v ghost-storage:/ghost-override --name=ghost-storage ubuntu true
# Create site volume
dockur run -v incoin.io:/var/www/incoin.io --name=site-storage ubuntu true
#Create nginx volume to store sites-enabled, logs and certs
docker run -v nginx/logs:/var/log/nginx -v certs:/etc/nginx/certs -v sites-enabled:/etc/nginx/sites-enabled --name=nginx-storage ubuntu true
# Start the ghost daemon using volume from ghost-storage

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
[codelitt@archer ubercms]$ cap deploy
* 2013-07-03 12:41:33 executing `deploy'
* 2013-07-03 12:41:33 executing `deploy:update'
** transaction: start
* 2013-07-03 12:41:33 executing `deploy:update_code'
executing locally: "git ls-remote ssh://deploy@198.211.112.227/var/www/ubercms.git master"
deploy@198.211.112.227's password:
command finished in 9435ms
* executing "git clone -b master --depth 1 ssh://deploy@198.211.112.227/var/www/ubercms.git /var/www/ubercms/releases/20130703154142 && cd /var/www/ubercms/releases/20130703154142 && git checkout -b deploy 9da296f1e0b22e446a18515b16c0705f76ff83f0 && rm -Rf /var/www/ubercms/releases/20130703154142/.git && (echo 9da296f1e0b22e446a18515b16c0705f76ff83f0 > /var/www/ubercms/releases/20130703154142/REVISION)"
servers: ["cms.codelitt.com"]
@codelitt
codelitt / xorg.conf
Created June 26, 2013 18:39
xorg.conf file for arch install on pro.
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig: version 319.23 (buildmeister@swio-display-x86-rhel47-11) Thu May 16 20:17:21 PDT 2013
# x86-input-mtrack-git package installed las wel
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"