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
# ======================================== | |
# Testing n-gram analysis in ElasticSearch | |
# ======================================== | |
curl -X DELETE localhost:9200/ngram_test | |
curl -X PUT localhost:9200/ngram_test -d ' | |
{ | |
"settings" : { | |
"index" : { | |
"analysis" : { |
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.db.models.query import EmptyQuerySet | |
class FakeQuerySet(EmptyQuerySet): | |
"""Turn a list into a Django QuerySet... kind of.""" | |
def __init__(self, model=None, query=None, using=None, items=[]): | |
super(FakeQuerySet, self).__init__(model, query, using) | |
self._result_cache = items | |
def count(self): | |
return len(self) |
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 fabric.api import env, local, run | |
def vagrant(): | |
# change from the default user to 'vagrant' | |
env.user = 'vagrant' | |
# connect to the port-forwarded ssh | |
env.hosts = ['127.0.0.1:2222'] | |
# use vagrant ssh key | |
result = local('vagrant ssh_config | grep IdentityFile', capture=True) |
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 time | |
def RateLimited(maxPerSecond): | |
minInterval = 1.0 / float(maxPerSecond) | |
def decorate(func): | |
lastTimeCalled = [0.0] | |
def rateLimitedFunction(*args,**kargs): | |
elapsed = time.clock() - lastTimeCalled[0] | |
leftToWait = minInterval - elapsed | |
if leftToWait>0: |
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
# United States of America Python Dictionary to translate States, | |
# Districts & Territories to Two-Letter codes and vice versa. | |
# | |
# Canonical URL: https://gist.github.com/rogerallen/1583593 | |
# | |
# Dedicated to the public domain. To the extent possible under law, | |
# Roger Allen has waived all copyright and related or neighboring | |
# rights to this code. Data originally from Wikipedia at the url: | |
# https://en.wikipedia.org/wiki/ISO_3166-2:US | |
# |
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
.DS_Store | |
Gemfile.lock | |
*.pem | |
node.json | |
tmp/* | |
!tmp/.gitignore |
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/sh | |
### | |
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer) | |
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos | |
### | |
# Alot of these configs have been taken from the various places | |
# on the web, most from here | |
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx |
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
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
# Version 2, December 2004 | |
# Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> | |
# Everyone is permitted to copy and distribute verbatim or modified | |
# copies of this license document, and changing it is allowed as long | |
# as the name is changed. | |
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
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
/** | |
* Copyright (C) 2013 Typesafe Inc. <http://www.typesafe.com> | |
*/ | |
package docs.channels | |
import akka.actor.{ Actor, ActorSystem } | |
import akka.channels._ | |
import akka.util.Timeout | |
import scala.concurrent.duration._ |
OlderNewer