Skip to content

Instantly share code, notes, and snippets.

View deanputney's full-sized avatar

Dean Putney deanputney

View GitHub Profile
@deanputney
deanputney / five_letter_word_letter_distribution.sh
Created January 8, 2022 03:32
Distribution of letters in five letter words
$ cat /usr/share/dict/words | sed -nr '/^[a-z]{5,5}$/p' | grep -o . | sort | uniq -c | sort -r
4467 a
4255 e
3043 r
2801 o
2581 i
2383 s
2381 t
2368 l
2214 n
@deanputney
deanputney / git-account-switch.sh
Created July 20, 2020 00:56
Switch between personal and work accounts on git
function git-personal {
git config --global core.sshCommand "/usr/bin/ssh -i $HOME/.ssh/personal"
}
function git-work {
git config --global core.sshCommand "/usr/bin/ssh -i $HOME/.ssh/id_rsa"
}
@deanputney
deanputney / grayscale.applescript
Created January 28, 2018 04:23
Mac Grayscale Screen Applescript
tell application "System Preferences"
activate
tell pane id "com.apple.preference.universalaccess" to reveal anchor 13
delay 0.5
tell application "System Events"
tell process "System Preferences"
keystroke tab
delay 0.1
keystroke tab
delay 0.1
{
"keys" : "1 =",
"is_exclusive" : true,
"prevent_repeat": true,
"on_keydown" : function() {
var g = addGameboy();
var gl = gameboys.length
positionGameboy(g);
},
"on_keyup" : function(e) {
@deanputney
deanputney / test-libcloud-acl.py
Created January 30, 2016 01:52
Example for apache-libcloud ACL setting failure with Google Storage
# Insert your service account email and key
# Provide a project ID and destination bucket
# ACL for inserted object should be "public-read"
# Content-Type for inserted object should be "text/plain"
import sys
import cStringIO
from libcloud.storage.types import Provider
from libcloud.common.types import LibcloudError
@deanputney
deanputney / gist:a4019beaa5b245d0c326
Created April 2, 2015 00:41
subl alias - Prefers project files over opening folders
function subl {
if [ -z "$1" ] || [[ $1 = "." ]]; then
files=$(ls *.sublime-project 2> /dev/null | wc -l)
if [[ $files -eq 0 ]]; then
echo "Opening folder"
/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl .
else
echo "Opening project"
open *.sublime-project
fi
### Keybase proof
I hereby claim:
* I am deanputney on github.
* I am deanputney (https://keybase.io/deanputney) on keybase.
* I have a public key whose fingerprint is AE1E 7886 7280 C05B A476 4090 8355 A7FE 6E82 5D4A
To claim this, I am signing this object:
### Keybase proof
I hereby claim:
* I am mustardhamsters on github.
* I am deanputney (https://keybase.io/deanputney) on keybase.
* I have a public key whose fingerprint is AE1E 7886 7280 C05B A476 4090 8355 A7FE 6E82 5D4A
To claim this, I am signing this object:
function new_excerpt_more( $more ) {
return ' <a class="read-more" href="'. get_permalink( get_the_ID() ) . '">[...]</a>';
}
add_filter( 'excerpt_more', 'new_excerpt_more' );
// Get all active top level categories
$parent_categories = array();
$all_parents = ORM::factory('category')
->where('category_visible', '1')
->where('parent_id', '0')
->find_all();
foreach ($all_parents as $category)
{
// Get The Children