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 kivy | |
kivy.require('1.0.9') | |
from kivy.lang import Builder | |
from kivy.clock import Clock | |
from kivy.uix.boxlayout import BoxLayout | |
from kivy.properties import StringProperty, NumericProperty, ListProperty, ObjectProperty | |
Builder.load_string(''' | |
[StringListViewItem@BoxLayout]: |
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/gorun | |
package main | |
import "os" | |
import "fmt" | |
import "strings" | |
import "go/doc" | |
import "go/token" | |
import "go/parser" |
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 base64 | |
from aspen import Response | |
def inbound_responder(*args, **kwargs): | |
""" see BasicAuth object for args; they're passed through """ | |
auth = BasicAuth(*args, **kwargs) | |
def _(request): | |
request.auth = BAWrapper(auth, request) |
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 re | |
def by_regex(hook, regex_tuples, default=True): | |
"""A filter for hooks. regex_tuples is a list of (regex, filter?) where if the regex matches | |
the requested URI, then the hook is applied or not based on if filter? is True or False. | |
""" | |
regex_res = [ (re.compile(regex), disposition) for regex, disposition in regex_tuples.iteritems() ] | |
def filtered_hook(request): | |
for regex, disposition in regex_res: |
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
TAGGED_FILES = {} | |
def tag(filename, taglist): | |
for tag in taglist: | |
TAGGED_FILES[tag] = TAGGED_FILES.get(tag, frozenset([])).union(frozenset([filename])) | |
def by_tag(hook, tag): | |
"""A filter for hooks. tag is the tag that must be present for the file if it's to match. |
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
# This will change your prompt and screen/tmux tab title based on how many | |
# fields there are in the FQDN. For a normal 3 field FQDN, it will use $HOSTNAME | |
# like normal. For 4+ fields it will set it to field1.field2. | |
# Rename screen window | |
function rename_screen_tab () { echo -ne "\x1bk$@\x1b\\"; return 0; } | |
MYHOST=`echo $HOSTNAME | sed 's/[.][^.]*[.][^.]*$//'` | |
[[ $TERM == "screen" ]] && PROMPT_COMMAND='rename_screen_tab ${MYHOST}' | |
PS1="\d \A \w\n\u@$MYHOST > " |
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 subprocess import Popen, PIPE | |
def cat(*files): | |
result = [] | |
for f in files: | |
result.extend(open(f).readlines()) | |
return result | |
def pipe(cmd, text=None,filename=None): |
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 fabricate import run | |
raw_css = os.path.join(website.www_root, '..', 'templates', 'gittip.css') | |
class Cache(object): | |
data = None | |
cache = Cache() | |
^L |
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
src = """ | |
from fakemodule import fakefunc | |
fakefunc() | |
print dir() | |
""" | |
def call_with_fakemodule(usersrc): | |
class fmod(object): | |
@staticmethod |
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
#!/bin/bash | |
## these need to be set | |
# initial account credentials | |
SEED_USER=admin | |
SEED_PASS=password | |
# required for new users to be able to sign up ; default to something random | |
INVITATION_CODE=`dd if=/dev/urandom bs=1024 count=1 | md5sum -` |
OlderNewer