Skip to content

Instantly share code, notes, and snippets.

View MattDietz's full-sized avatar

Matt Dietz MattDietz

  • Matthew Dietz, LLC
  • San Antonio, TX
  • 18:15 (UTC -12:00)
View GitHub Profile
diff --git a/pyhole/utils.py b/pyhole/utils.py
index 86a0180..5ff46e3 100644
--- a/pyhole/utils.py
+++ b/pyhole/utils.py
@@ -71,18 +71,20 @@ def spawn(func):
def decode_entities(html):
"""Strip HTML entities from a string"""
- html = re.sub("<[^>]*?>", "", html)
- html = re.sub("&nbsp;", " ", html)
@MattDietz
MattDietz / gist:3363258
Created August 15, 2012 20:23
CTags setup
Install this:
http://vim.sourceforge.net/scripts/script.php?script_id=273
.vimrc setup:
""" ctags
map ,bt :!ctags -R . <CR>
@MattDietz
MattDietz / gist:3429125
Created August 22, 2012 20:40
tmux config so far
set -g default-terminal "screen-256color"
# remap prefix to Control + a
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf
@MattDietz
MattDietz / Gitconfig sloc alias
Created March 20, 2013 17:10
Git sloc alias
sloc = "!f() { git ls-files | xargs -i git blame \\{\\} | egrep -o \"\\(.* \" | cut -f1-2 -d\" \" | sort | uniq -c; }; f"
@MattDietz
MattDietz / gist:5241529
Created March 25, 2013 22:43
Repose tm2
[composite:quantum]
use = egg:Paste#urlmap
/: quantumversions
/v2.0: quantumapi_v2_0
[composite:quantumapi_v2_0]
use = call:quantum.auth:pipeline_factory
noauth = noauth egg:repoze.tm2#tm extensions quantumapiapp_v2_0
#noauth = extensions quantumapiapp_v2_0
keystone = authtoken keystonecontext egg:repoze.tm2#tm extensions quantumapiapp_v2_0
@MattDietz
MattDietz / gist:6066882
Created July 23, 2013 22:56
Quota driver fixup
commit 93894e70b7313e37f97a58565c75d114d9e180e7
Author: Matt Dietz <[email protected]>
Date: Tue Jul 23 22:53:56 2013 +0000
Moves quota config back to plugin
Moves the quota configuration lines back into plugin.py which in turn
solves a weird dependency issue when loading the Quark quota driver via
the neutron.conf.
@MattDietz
MattDietz / gist:6072825
Created July 24, 2013 17:51
Finding python tree root
import os
import sys
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
os.pardir,
os.pardir))
if os.path.exists(os.path.join(possible_topdir, '<project name>', '__init__.py')):
sys.path.insert(0, possible_topdir)
(compute)~/code/python/path_test/foo python bar.py
['/home/nova/code/python/path_test/foo'...]
(compute)~/code/python/path_test/foo cd ..
(compute)~/code/python/path_test python foo/bar.py
['/home/nova/code/python/path_test/foo'...]
@MattDietz
MattDietz / gist:6144016
Last active December 20, 2015 14:09
Counting word usage. Could be more efficient ways.
import re
data = open("a bunch of text", 'r')
words = {}
strip_punc = re.compile("[!.,]")
whitespace_collapse = re.compile("\s+")
for line in data.readlines():
line = strip_punc.sub('', line)
@MattDietz
MattDietz / Team Philosophy
Last active August 28, 2017 16:35
Team Philosophy
This is an ivory tower, but we're going to aim high. Patches Accepted.
No dissent goes undiscussed. Everyone has equal say.
You won't always get your way.
All debates must end with a constructive conclusion and a direction forward, and the sooner the better.
Encourage Sharing: Everyone has legimitate ideas worthy of validation
We only succeed or fail as a team
Always present a possible solution after presenting a problem
We will communicate with our teammates if any issues arise
Educating your peers is never a waste of time.