Skip to content

Instantly share code, notes, and snippets.

View pztrick's full-sized avatar

Patrick Paul pztrick

View GitHub Profile

Keybase proof

I hereby claim:

  • I am pztrick on github.
  • I am pztrick (https://keybase.io/pztrick) on keybase.
  • I have a public key whose fingerprint is E179 BC62 6ADB 2CE2 2387 AAC7 B33A 8C59 11D3 93CA

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am pztrick on github.
  • I am pztrick (https://keybase.io/pztrick) on keybase.
  • I have a public key whose fingerprint is 465D F1BF E263 8E21 CFA8 E540 4E8D FD5E C772 7F8D

To claim this, I am signing this object:

@pztrick
pztrick / cloudcache.py
Created February 13, 2014 19:29
from cloudcache import cloudcache
from django.conf import settings
from iron_cache import IronCache
import thread
credentials = settings.IRON_IO_CACHE.lstrip('ironcache://').rstrip('@').split(':')
class IronCacheAsync(IronCache):
def put_async(self, *args, **kwargs):
thread.start_new_thread(self.put, args, kwargs)
return None
@pztrick
pztrick / gist:5713866
Created June 5, 2013 13:33
Fabfile excerpt for SO #16929264
@roles('broker', 'stressors')
def git_pull():
with cd("%s" % git_folder):
run("git pull")
@roles('stressors')
def restart_celeryd():
# NOT WORKING
sudo("supervisorctl restart all")
@pztrick
pztrick / jekyll-fancyalbum.sublime-snippet
Created August 16, 2012 05:29
ofa snippet for my fancyalbum plugin
<!-- Insert Fancy Album
{% fancyalbum 123x456[!] %}
image.png[: label]
{% endfancyalbum %}
-->
<snippet>
<content><![CDATA[
{% fancyalbum ${1:weight}x${2:height}${3:[!]} %}
${4:image.png[: label]}
{% endfancyalbum %}
@pztrick
pztrick / octopress-code.sublime-snippet
Created August 16, 2012 01:51
Slightly better octopress snippet
<!-- Insert Code
{% codeblock [title] [lang:language] [url] [link text] %}
[code]
{% endcodeblock %} -->
<snippet>
<content><![CDATA[
{% codeblock ${1:title} lang:${2:html} ${3:url} ${4:link-text} %}
${5:code}
{% endcodeblock %}
]]></content>
@pztrick
pztrick / Terminal.py
Created August 16, 2012 01:36
ST2 Terminal plugin hack for Git Bash terminal
def run_terminal(self, dir, parameters):
try:
if not dir:
raise NotFoundError('The file open in the selected view has ' +
'not yet been saved')
for k, v in enumerate(parameters):
parameters[k] = v.replace('%CWD%', dir)
args = [TerminalSelector.get()]
args.extend(parameters)
encoding = locale.getpreferredencoding(do_setlocale=True)
@pztrick
pztrick / chubby-er ninja.tmTheme
Created August 12, 2012 02:10
SublimeText2 theme Chubby-er Ninja (based on Chuby Ninja @ https://github.com/jturcotte/SublimeChubyNinja)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Chubby-er Ninja</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
@pztrick
pztrick / fancyimage_tag.rb
Created June 21, 2012 01:33
Jekyll Image plugin that dynamically creates thumbnails and fancyboxes for uploaded images
# Title: Fancyimage tag for Jekyll
# Authors: Devin Weaver (photos_tag.rb), Brian M. Clapper (img_popup.rb), Patrick Paul (this gist)
# Description: Takes full size image, automagically creates thumbnail at specified size, +fancybox
#
# Adapted from:
# http://tritarget.org/blog/2012/05/07/integrating-photos-into-octopress-using-fancybox-and-plugin/
# (photos_tag.rb) https://gist.github.com/2631877
# (img_popup.rb) https://github.com/bmc/octopress-plugins/
#
# Syntax {% photo filename [tumbnail] [title] %}