Skip to content

Instantly share code, notes, and snippets.

@rcarmo
rcarmo / gist:5857681
Created June 25, 2013 11:06
Bottle layout
<root>
+-- dev.py # Stub to run Bottle while coding
+-- app.py # WSGI glue
+-- tasks.py # Celery glue
+-- fabfile.py # Fabric deployment/build script
+-- Vagrantfile # never leave home without it
+-- etc
| +-- config.json # my main configuration file
+-- api
import os
import sys
import pickle
import console
# I moved 'dropboxlogin' into a sub folder so it doesn't clutter my main folder
sys.path += [os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lib')]
import dropboxlogin # this code can be found here https://gist.github.com/4034526
STATE_FILE = '.dropbox_state'
# YOU NEED TO INSERT YOUR APP KEY AND SECRET BELOW!
# Go to dropbox.com/developers/apps to create an app.
app_key = 'YOUR_APP_KEY'
app_secret = 'YOUR_APP_SECRET'
# access_type can be 'app_folder' or 'dropbox', depending on
# how you registered your app.
access_type = 'app_folder'
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Single-Column Responsive Email Template</title>
<style>
@media only screen and (min-device-width: 541px) {
.content {
@rcarmo
rcarmo / setup.hy
Last active December 28, 2015 05:59
Setuptools in hylang
(import [os [walk]]
[os.path [join splitext]]
[distutils.core [setup]]
[distutils.command.build [build]]
[fnmatch [fnmatch]]
[subprocess [Popen PIPE]])
(defn glob [path pattern]
"find all files matching a given pattern"
(for (step (walk path))
@rcarmo
rcarmo / hosetests.hy
Created December 7, 2013 19:19
First stab at a plugin for running tests in hylang
(import os sys logging nose)
(import [nose.plugins [Plugin]])
(setv log (.getLogger logging "nose.plugins.hylang"))
(.setLevel log logging.DEBUG)
(defclass HoseTests [Plugin]
[[name "HoseTests"]
[options
@rcarmo
rcarmo / chekhov.hy
Created May 4, 2014 19:27
map-reduce in hylang
; Packed shepherd together with mincemeat for convenience
(import [mincemeat.shepherd [run_server]])
; chunker is temporarily broken
;(defn chunker [gen size]
; (let [[gen (iter gen)]
; [chunk []]
; (try
; (while True
; (for [_ (xrange size)]
{
"lines.linewidth": 2.0,
"examples.download": true,
"patch.linewidth": 0.5,
"legend.fancybox": true,
"axes.color_cycle": [
"#30a2da",
"#fc4f30",
"#e5ae38",
"#6d904f",
(import [os [walk environ]]
[os.path [dirname exists join getmtime]]
[datetime [datetime]]
[time [time]]
[whoosh.writing [BufferedWriter AsyncWriter]]
[whoosh.index [create-in open-dir]]
[whoosh.fields [Schema TEXT STORED ID KEYWORD NUMERIC DATETIME]]
[xml.etree [cElementTree]]
[bs4 [BeautifulSoup]]
[hashlib [sha1]]
### Keybase proof
I hereby claim:
* I am rcarmo on github.
* I am rcarmo (https://keybase.io/rcarmo) on keybase.
* I have a public key whose fingerprint is 0E2D 06BA B19C 2006 AA54 A7C1 ACD1 5B9D E6C8 ADE1
To claim this, I am signing this object: