Skip to content

Instantly share code, notes, and snippets.

@julen
julen / main.py
Last active July 24, 2017 13:14 — forked from evernotegists/main.py
from evernote.edam.type import ttypes
def makeNote(authToken, noteStore, noteTitle, noteBody, parentNotebook=None):
nBody = '<?xml version="1.0" encoding="UTF-8"?>'
nBody += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">'
nBody += '<en-note>%s</en-note>' % noteBody
## Create note object
ourNote = ttypes.Note()
@julen
julen / sqlparse.py
Created August 1, 2013 07:28
Printing human-readable SQL queries to the console in scenarios where the django-debug-toolbar isn't available.
import sqlparse
qs = MyObject.objects.filter(foo='bar', baz__startswith='baz')
sql, params = qs.query.sql_with_params()
print sqlparse.format(str(sql % params),
reindent=True, keyword_case='upper')
@julen
julen / twitter_search.py
Created June 22, 2013 10:21
An example Twitter search using the 1.1 API.
#!/env/bin/python
import requests
from requests_oauthlib import OAuth1
API_BASE = 'https://api.twitter.com/1.1/'
auth_url = API_BASE + 'account/verify_credentials.json'
tweets_url = API_BASE + 'search/tweets.json'
tweets_params = {
@julen
julen / hauta_lanerako_euskal_hiztegia.sh
Created January 9, 2013 11:16
Simple command to download "Hauta Lanerako Euskal Hiztegia" dictionary's underlying XML files.
for i in `perl -e '$,=" ";print +(a..z)'` ; do wget "http://www.euskara.euskadi.net/appcont/sarasola/XMLak/${i}_LETRA.xml"; done