Skip to content

Instantly share code, notes, and snippets.

@powellc
powellc / setup.sh
Created August 3, 2016 15:59 — forked from six519/setup.sh
Install node/npm/nvm Bash Script In FreeBSD 10.2
#!/usr/bin/env bash
#just want to post something!!!!!! :D
sudo pkg install node www/npm git gmake wget
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash
@powellc
powellc / build-changelog.py
Last active May 12, 2016 18:14
Build a changelog from git commits
import re
import os
import git
semver_pattern = '(?:(\d+)\.)(?:(\d+)\.)(?:(\d+))'
BASE_DIR = os.getcwd()
g = git.cmd.Git(BASE_DIR)
commits = list(filter(None, g.log("--format=%B").splitlines()))
@powellc
powellc / heron-overscanning-fix.sh
Created February 11, 2016 19:12
Fixes overscanning on Heron, my TV computer
xrandr --output HDMI-0 --rate 60 --mode 1360x768 --fb 1360x768 --panning 1360x768* --output HDMI-0 --mode 1360x768 --same-as VGA-0
xrandr --output HDMI-0 --set underscan on
xrandr --output HDMI-0 --set "underscan hborder" 40 --set "underscan vborder" 25
@powellc
powellc / bashrc
Last active February 10, 2016 17:21
A bash configuration file
#!/usr/bin/env bash
# Path to the bash it configuration
export BASH_IT="/home/powellc/.bash_it"
# Lock and Load a custom theme file
# location /.bash_it/themes/
export BASH_IT_THEME='powerline'
# Your place for hosting Git repos. I use this for private repos.
@powellc
powellc / zshrc
Last active February 10, 2016 17:22
My zshrc file
# Path to your oh-my-zsh installation.
export ZSH=~/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="agnoster"
# Uncomment the following line to use case-sensitive completion.
@powellc
powellc / gist:de1b1a73cf814b16e39f
Created October 5, 2015 15:20
Toggl-Button-Todoist
// ==UserScript==
// @name Toggl-Button GitHub
// @namespace https://github.com/jurgenhaas/toggl-button-greasemonkey
// @version 1.3
// @include http*://github.com/*
// @grant GM_xmlhttpRequest
// @grant GM_addStyle
// @grant GM_getResourceText
// @grant GM_getValue
// @grant GM_setValue
@powellc
powellc / keybase.md
Last active February 10, 2016 21:28

Keybase proof

I hereby claim:

  • I am powellc on github.
  • I am secstate (https://keybase.io/secstate) on keybase.
  • I have a public key ASBxgRKwG3tnw7tfdz9pf0b2oIvtQrkboSA3EbFL7aDObQo

To claim this, I am signing this object:

@powellc
powellc / gogs.conf
Created October 28, 2014 14:29
Gogs Upstart Script
#
# upstart script for gogs (Go Git Service)
#
author "tsv"
description "gogs upstart script"
start on (local-filesystems and net-device-up)
stop on shutdown
@powellc
powellc / save_as-with-unique-slugs
Created January 5, 2014 06:01
ModelAdmin code to make save_as work for models with unique slugs
def add_view(self, request, form_url='', extra_context=None):
save_as_new = request.POST.get("_saveasnew", '')
if extra_context is None:
extra_context = {}
# keep the save as new in case of validation errors
extra_context['save_as_new'] = save_as_new
# but if it is a real new addition, remove _saveasnew from POST
if not save_as_new and '_saveasnew' in request.POST:
del request.POST['_saveasnew']
@powellc
powellc / backup.sh
Created May 28, 2013 12:31
Shell script to use duplicity and AWS S3 to backup files on a server, hooray. Not the most secure way to handle your password and AWS key, but couldn't get easier, giving you no reason to have some kind of backup of your server.
#!/bin/bash
export PASSPHRASE=your_gpg_passphrase
export AWS_ACCESS_KEY_ID=your_s3_access_key
export AWS_SECRET_ACCESS_KEY=your_s3_secret
export MYSQL_PASSWORD=your_mysql_password
for DB in app_1 app_2 app_3; do
mysqldump -h localhost -u backup_user -p${MYSQL_PASSWORD} ${DB} | gzip > /var/dbdumps/${DB}.sql