Skip to content

Instantly share code, notes, and snippets.

View deanishe's full-sized avatar

Dean Jackson deanishe

View GitHub Profile
@deanishe
deanishe / tree.md
Created January 3, 2013 23:14 — forked from hrldcpr/tree.md

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@deanishe
deanishe / filter_spotlight.py
Created October 29, 2013 23:59
Benchmarking filtering of Spotlight (mdfind) search results.
#!/usr/bin/env python
# encoding: utf-8
"""
"""
from __future__ import print_function
import sys
import os
@deanishe
deanishe / ABSearch.py
Created December 3, 2013 16:40
Search Mac Address Book with Python via the Scripting Bridge
#!/usr/bin/python
# -*- coding: utf-8 -*-
# vim: fileencoding=utf-8
"""
Search Mac Address Book contacts via official API
"""
from __future__ import print_function, unicode_literals
import sys
from time import time
@deanishe
deanishe / packal.py
Created March 3, 2014 21:08
Packal.org Alfred Workflow Search
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright © 2014 deanishe@deanishe.net
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2014-03-03
#
@deanishe
deanishe / search.py
Last active August 29, 2015 13:57
Alfred workflow script filter to perform fuzzy search across a directory subtree
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright © 2014 deanishe@deanishe.net
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2014-03-08
#
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright © 2014 deanishe@deanishe.net
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2014-04-02
#
@deanishe
deanishe / uninstall_py2.7.sh
Last active August 29, 2015 14:02 — forked from munhitsu/gist:1034761
Uninstall a framework Python on OS X
sudo rm -rf /Library/Frameworks/Python.framework/Versions/2.7
sudo rm -rf "/Applications/Python 2.7"
cd /usr/local/bin
ls -l . | grep '../Library/Frameworks/Python.framework/Versions/2.7' | awk '{print $9}' | xargs rm
@deanishe
deanishe / edit_paths.zsh
Last active February 9, 2022 17:03
prepend_path and append_path functions for zsh
# The following functions append/prepend the specified directory to the path variable specified by name
# If the directory is already in the path, it is first removed and then appended/prepended.
# Examples:
#
# Prepend `~/bin` to `$PATH`:
# prepend_path PATH ~/bin
#
# Append `~bin` to `$PATH` instead:
# append_path PATH ~/bin
# (this will remove `~/bin` from the beginning of `$PATH` first)
@deanishe
deanishe / workflow-install.py
Last active September 21, 2023 15:38
Script to install/symlink Alfred workflows. Useful for workflow developers.
#!/usr/bin/python
# encoding: utf-8
#
# Copyright (c) 2013 <deanishe@deanishe.net>.
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2013-11-01
#
@deanishe
deanishe / workflow-build.py
Last active July 7, 2023 14:46
Build Alfred Workflows into .alfredworkflow (zip) files
#!/usr/bin/python
# encoding: utf-8
#
# Copyright (c) 2013 deanishe@deanishe.net.
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2013-11-01
#