Skip to content

Instantly share code, notes, and snippets.

View BenAtWide's full-sized avatar
🌇
Skiff

Ben Edwards BenAtWide

🌇
Skiff
View GitHub Profile
@BenAtWide
BenAtWide / basic_south.sh
Created November 16, 2011 15:21
Basic commands for South migrations.
# create initial migration from existing models
./manage.py schemamigration app_name --initial
# apply the migration
./manage.py migrate app_name
# make a change, create a new migration
./manage.py schemamigration app_name --auto
@BenAtWide
BenAtWide / apache-basic-auth
Created July 17, 2012 14:17 — forked from lurcio/apache-basic-auth
Apache 2.2 Basic Authentication
AuthType Basic
AuthName "Restricted Files"
AuthBasicProvider file
AuthUserFile /path/to/password/file
Require user valid-user
@BenAtWide
BenAtWide / gist:3339902
Created August 13, 2012 11:41 — forked from axelav/gist:1839777
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@BenAtWide
BenAtWide / gist:3414921
Created August 21, 2012 12:00 — forked from pioz/gist:403496
Adding system user, e.g. to run redis
adduser --system --no-create-home --group --shell /bin/false --disabled-password --disabled-login redis
@BenAtWide
BenAtWide / FixLaunchServices.sh
Created December 12, 2012 11:28
This command removes multiple entries from the OSX Finder Open with.. contextual menu. Technique from here http://simplicitybliss.com/blog/2012/11/multiple-open-with-entries-in-mac-os-x-finder
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
# Then relaunch finder or reboot machine
@BenAtWide
BenAtWide / sqlbackup.sh
Created January 9, 2013 11:21
Encrypted rotated backups of MySQL databases, from Jon Allie http://jonallie.com/blog/post/65/
#!/bin/bash
# setup
suffix=`date +%Y%m%d`
dest=/home/wide/dbs
cmd='/usr/bin/mysqldump'
user='backuper'
password='jfhiue839'
#databases="mysql test"
@BenAtWide
BenAtWide / cdf.fish
Created February 11, 2013 15:27
Fish function to cd to frontmost finder window
# jump straight to open finder window. Remember fish uses parentheses instead of backticks.
function cdf
set -l target (osascript -e 'tell application "Finder" to if (count of Finder windows) > 0 then get POSIX path of (target of front Finder window as text)')
if test $target != ""
cd "$target"
pwd
else
echo 'No Finder window found' >&2
end
@BenAtWide
BenAtWide / testfile.txt
Created February 14, 2013 17:30
Created by gitfred
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
@BenAtWide
BenAtWide / extend_path.fish
Created April 23, 2013 09:39
add a component to $PATH in the fish shell
# This is the syntax to add a component to $PATH in the fish shell
set -gx PATH /usr/local/mysql/bin/ $PATH
# Note the space between the new component and the existing $PATH variable.
@BenAtWide
BenAtWide / django-bootstrap-paginator.html
Last active July 12, 2017 12:43
Simple Bootstrap-styled pagination for Django class-based list view
{% if is_paginated %}
<div class="pagination">
<ul>
{% if page_obj.has_previous %}
<li><a href="?page={{ page_obj.previous_page_number }}">
{% else %}
<li class="disabled"><a href="#">
{% endif %}
Prev</a></li>
{% for p in page_obj.paginator.page_range %}