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/env bash | |
function tt() { | |
osascript &>/dev/null <<EOF | |
tell application "iTerm2" | |
tell current window | |
create tab with default profile command "$@" | |
end tell | |
end tell | |
EOF |
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 | |
from pdb import Pdb | |
banner = """Usage: | |
%(command)s @<module>:<linenumber> ... <filename> <args> | |
Use @<module>:<linenumber> to set one or multiple breakpoints. | |
<module> may be an absolute path to a module file, or relative to sys.path. |
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 bash | |
# From: https://en.wikipedia.org/wiki/Oblique_Strategies | |
strategies=( | |
"(Organic) machinery" | |
"A line has two sides" | |
"A very small object Its center" | |
"Abandon desire" | |
"Abandon normal instructions" |
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
// Uses https://github.com/krasimir/EventBus | |
var app = (function (document, bus) { | |
function appInit(event, appstate) { | |
var response = prompt("Foo?"); | |
if (response == "foo") { | |
bus.dispatch("render", this, {"status": "ok"}); | |
} else { | |
bus.dispatch("render", this, {"status": "errou-mane"}); |
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 scipy.spatial.distance import euclidean | |
import numpy as np | |
from __future__ import division | |
def periodic_distance(a, b, period=12): | |
""" | |
Euclidean distance w/ periodic boundaries. | |
>>> A = np.array([1, 12, 1]) | |
>>> B = np.array([12, 1, 1]) |
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
$ tail -f /var/log/celery/live-celeryd.log | |
[2014-01-09 17:24:59,335: INFO/MainProcess] Saved OLX feed at /mnt/local/live/media/cache/feeds/olx-2288.xml | |
[2014-01-09 17:24:59,339: INFO/MainProcess] Generating OLX feed for negociaoimoveis.com.br... | |
[2014-01-09 17:25:00,207: INFO/MainProcess] Saved OLX feed at /mnt/local/live/media/cache/feeds/olx-2788.xml | |
[2014-01-09 17:25:00,210: INFO/MainProcess] Generating OLX feed for insigniaci.com.br... | |
[2014-01-09 17:25:02,054: INFO/MainProcess] Saved OLX feed at /mnt/local/live/media/cache/feeds/olx-3418.xml | |
[2014-01-09 17:25:02,057: INFO/MainProcess] Generating OLX feed for imoveisbaixada.com.br... | |
[2014-01-09 17:25:03,385: INFO/MainProcess] Saved OLX feed at /mnt/local/live/media/cache/feeds/olx-4174.xml | |
[2014-01-09 17:25:03,389: INFO/MainProcess] Generating OLX feed for mundialimoveis.net.br... | |
[2014-01-09 17:25:11,698: INFO/MainProcess] Saved OLX feed at /mnt/local/live/media/cache/feeds/olx-3354.xml |
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 colibri.feeds.tasks import generate_olx_feed_task | |
>>> generate_olx_feed_task() | |
[09/Jan/2014 16:20:22] INFO Generating OLX feed for angelaalvesimoveis.com.br... | |
[09/Jan/2014 16:20:27] INFO Saved OLX feed at /Users/hcarvalhoalves/Projetos/colibri/media/cache/feeds/4086.xml | |
[09/Jan/2014 16:20:27] INFO Generating OLX feed for brewimoveis.com.br... | |
[09/Jan/2014 16:20:30] INFO Saved OLX feed at /Users/hcarvalhoalves/Projetos/colibri/media/cache/feeds/2944.xml | |
[09/Jan/2014 16:20:30] INFO Generating OLX feed for bomimoveis.com.br... | |
[09/Jan/2014 16:20:42] INFO Saved OLX feed at /Users/hcarvalhoalves/Projetos/colibri/media/cache/feeds/3409.xml | |
[09/Jan/2014 16:20:42] INFO Generating OLX feed for flavioelecyimoveis.com.br... | |
[09/Jan/2014 16:20:45] INFO Saved OLX feed at /Users/hcarvalhoalves/Projetos/colibri/media/cache/feeds/1446.xml |
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
>>> def wat(obj): | |
... sys.stdout.write("WAT") | |
... | |
>>> sys.displayhook = wat | |
>>> "I broke the REPL" | |
WAT>>> |
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
class Player | |
def initialize | |
@max_health = 20 | |
@last_health = @max_health | |
@taking_damage = false | |
@directions = [:backward, :forward] | |
@current_direction = :forward | |
@reached_wall = false | |
end | |
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 unicodedata import normalize, category | |
def unaccent(s): | |
return unicode( | |
filter( | |
lambda c: category(c) != 'Mn', | |
normalize('NFKD', s.decode('utf-8')) | |
) | |
).encode('utf-8') |