Skip to content

Instantly share code, notes, and snippets.

@ninowalker
ninowalker / server.py
Created December 10, 2011 02:02
A simple web server in two (three) steps
#
# Source: http://www.linuxjournal.com/content/tech-tip-really-simple-http-server-python
#
# Simple server in two steps:
# - create an index.html file.
# - run:
# python server.py [<port>]
# - go to:
@ninowalker
ninowalker / gist:1482729
Created December 15, 2011 20:28
Convert HTML entities to unicode
import htmlentitydefs
import re
def unescape_entities(m):
return unichr(htmlentitydefs.name2codepoint[m.group(1)])
print re.sub(r'&(\w+);', unescape_entities, "&times;&nbsp;&trade;Foo&bar")
This is a test
@ninowalker
ninowalker / gist:8292135
Created January 6, 2014 23:45
Load/invert the DB from http://urlblacklist.com
import glob
import collections
import re
def load(root="./"):
h = {}
for f in glob.glob(root + "*/domains"):
d = f.replace(root, "").replace("/domains", "")
h[d] = set()
with open(f) as _f:
customFields:
actual: customfield_10501
at: assignee
customer: customfield_10013
epicLink: customfield_11000
epicName: customfield_11001
expected: customfield_10502
links: issueLinks
points: customfield_10004
ptype: customfield_11401
- issuetype: Story
project: LF
reporter: nino
components: Spam
assignee: eugene
- manifest:
fixVersions: Narnia
links:
- key: PP-146
type: relates to
(global-set-key (kbd "C-x C-\\") 'jira-open)
(global-set-key (kbd "C-x C-/") 'jira-run)
(setq jy_username "...")
(setq jy_password "...")
(setq jy_server "https://livefyre.atlassian.net")
(defun jira-open ()
(interactive)
(shell-command
- issuetype: Story
project: LF
reporter: nino
components: Spam
assignee: eugene
- manifest:
fixVersions: Narnia
links:
- key: PP-146
type: relates to
from lfcore.v2.fulfillment.stream.service import *
import time
m = MongoStreamSvc.instance()
for x in m.pubsub.find({'group': 'settings'}):
x
print "Looking in events..."
t = list(m.events.find({'group': 'settings'}))
t
import pkg_resources
def get_pkg_license(pkgname):
"""
Given a package reference (as from requirements.txt),
return license listed in package metadata.
NOTE: This function does no error checking and is for
demonstration purposes only.
"""