View jsonld.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XDELETE 'localhost:9200/jsonld' | |
curl -XPOST 'localhost:9200/jsonld' | |
curl -XPUT 'localhost:9200/jsonld/doc/1' -d ' | |
{ | |
"@context": | |
{ | |
"dc": "http://purl.org/dc/elements/1.1/", |
View index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head | |
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | |
xmlns:foaf="http://xmlns.com/foaf/0.1/" | |
xmlns:vs="http://www.w3.org/2003/06/sw-vocab-status/ns#" | |
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" |
View regexpr.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://stackoverflow.com/questions/8199398/extracting-only-characters-from-a-string-in-python | |
import re | |
st = ".srep05794" | |
res = " ".join(re.findall("[a-zA-Z]+", st)) |
View extractAnnotations.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# see http://socialdatablog.com/extract-pdf-annotations.html | |
myxkfolder="/home/steve/xk/" #you need to set this to where you want your to-dos to appear | |
import poppler, os.path, os, time, datetime | |
for root, dirs, files in os.walk('./'): | |
for lpath in files: |
View install-poppler-qt4-xpdf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ brew install -v poppler --with-qt4 --enable-xpdf-headers | |
==> Downloading http://poppler.freedesktop.org/poppler-0.18.2.tar.gz | |
File already downloaded in /Users/cczona/Library/Caches/Homebrew | |
/usr/bin/tar xf /Users/cczona/Library/Caches/Homebrew/poppler-0.18.2.tar.gz | |
Package QtCore was not found in the pkg-config search path. | |
Perhaps you should add the directory containing `QtCore.pc' | |
to the PKG_CONFIG_PATH environment variable | |
No package 'QtCore' found | |
Package QtGui was not found in the pkg-config search path. | |
Perhaps you should add the directory containing `QtGui.pc' |
View parseoptions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import time | |
import math | |
import optparse | |
__version__ = "0.1" | |
__copyright__ = "CopyRight (C) 2013 by Michele Pasin" | |
__license__ = "MIT" |
View Snipplr-26506.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql> ALTER TABLE Employee ADD (EMail VARCHAR(25), ICQ VARCHAR(15)); |
View Snipplr-43554.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import os | |
def ensure_dir(f): | |
d = os.path.dirname(f) | |
if not os.path.exists(d): | |
os.makedirs(d) | |
View Snipplr-34626.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.test.client import Client | |
c = Client() | |
response = c.post(\'/login/\', {\'username\': \'john\', \'password\': \'smith\'}) | |
response.status_code | |
# 200 | |
response = c.get(\'/customer/details/\') | |
response.content | |
# \'<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 ...\' |
View Snipplr-34616.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
emails = {'Dick': 'bob@example.com', 'Jane': 'jane@example.com', 'Stou': 'stou@example.net'} | |
email_at_dotcom = dict( [name, '.com' in email] for name, email in emails.iteritems() ) | |
# email_at_dotcom now is {'Dick': True, 'Jane': True, 'Stou': False} | |
# ANOTHER OPTION TO CREATE DICTS ON THE FLY: |
OlderNewer