Skip to content

Instantly share code, notes, and snippets.

View pestilence669's full-sized avatar

Paul Chandler pestilence669

View GitHub Profile
@pestilence669
pestilence669 / upgrade.sh
Last active August 29, 2015 14:23
Upgrade all of my Python 2 & 3 PIP extensions
#!/usr/bin/sh
# vim: set ts=4 sw=4 noet:
# I can't wait for this to be a command-line flag
for i in 2 3; do
echo "Updating Python $i.x..."
pip$i freeze --local | grep -v '^\-e' | cut -d= -f1 | xargs pip$i install -U
done
@pestilence669
pestilence669 / main.py
Last active April 10, 2017 23:51
Boiler-plate Python 2.7 quick CLI project file
#!/usr/bin/env python
# vim: ts=4 sw=4 noet fileencoding=utf-8:
"""Boiler-plate Python 2.7 quick CLI project file"""
__author__ = 'pestilence669'
from argparse import ArgumentParser
import sys
@pestilence669
pestilence669 / get_tomcat7_version.sh
Created November 20, 2014 02:33
Get the Tomcat version(s) in Ubuntu
#!/usr/bin/bash
# vim: set ts=4 sw=4 noet:
java -cp /var/lib/tomcat*/lib/catalina.jar org.apache.catalina.util.ServerInfo
@pestilence669
pestilence669 / addLocalAlias.sh
Last active August 29, 2015 14:06
Enable 127.0.0.2 on OS X
#!/bin/bash
# vim: set ts=4 sw=4 noet:
# must add each alias individually. here's .2
sudo ifconfig lo0 alias 127.0.0.2 up
@pestilence669
pestilence669 / mongo_sequence.js
Last active November 29, 2016 09:32
Monotonic increasing sequences in MongoDB
// vim: set ts=4 sw=4 noet:
// create a collection to hold the named sequences
db.createCollection('counters');
// shell helper. initialize, if necessary, and return the next sequence
function getCounterFor(name) {
return db.counters.findAndModify({
query: { _id: name },
update: { $inc: { sequence: 1 } },
@pestilence669
pestilence669 / install_random_things.sh
Last active August 29, 2015 14:05
Random installations of various things
#!/bin/bash
# vim: set ts=4 sw=4 noet:
# install colorization & other enhancements to the stock MongoDB shell
npm install -g mongo-hacker
# command-line JSON filtering, formatting and other general awesome
npm install -g json
@pestilence669
pestilence669 / all_git_authors.sh
Last active August 29, 2015 14:04
Get all contributing author usernames in a Git project
#!/bin/bash
# vim: set ts=4 sw=4 noet:
git log | grep Author | cut -d' ' -f2 | sort -u
@pestilence669
pestilence669 / nginx.conf
Last active April 10, 2017 23:51
Nginx SSL configuration to proxy localhost:443 to localhost:80
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
@pestilence669
pestilence669 / macOS_defaults.sh
Last active April 21, 2020 00:59
macOS "defaults" customizations
#!/bin/bash
# vim: set ts=4 sw=4 noet fileencoding=utf-8:
# disable the accent menu in macOS, when you hold keys like "e"
# enable repeat / use ⌥ instead.
defaults write -g ApplePressAndHoldEnabled -bool false
# basic dock preferences
defaults write com.apple.dock orientation -string left
defaults write com.apple.dock autohide -int 1