Skip to content

Instantly share code, notes, and snippets.

View bitemyapp's full-sized avatar
🐺
aroo

Chris A. bitemyapp

🐺
aroo
View GitHub Profile
ipdb> conn.search("name:Cinna*")
{'hits': {'hits': [{'_score': 1.0, '_type': 'dish-type', '_id': 'o5uCPB7CQsStr9qjj3z0JQ', '_source': {'name': '" Better Than Cinnabon" Cinnamon Rolls'}, '_index': 'dish-index'}, {'_score': 1.0, '_type': 'dish', '_id': 'df3nK23TRHShqioVYPmcvA', '_source': {'name': '" Better Than Cinnabon" Cinnamon Rolls'}, '_index': 'dishes'}], 'total': 2, 'max_score': 1.0}, '_shards': {'successful': 25, 'failed': 0, 'total': 25}, 'took': 6, 'timed_out': False}
var page = require('webpage').create();
var href = "http://localhost:5000";
var step = 0;
var raise = function(error) {
console.log("Error raised: " + error);
phantom.exit(1);
}
var assertEquals = function(first, second, message) {
if (first === second) {
var page = require('webpage').create();
var href = "http://localhost:5000";
var step = 0;
var raise = function(error) {
console.log("Error raised: " + error);
phantom.exit(1);
}
var assertEquals = function(first, second, message) {
if (first === second) {
def _install_java():
with settings(warn_only=True):
java_installed = (run("java -version 2>&1 | grep 'HotSpot'").find("Java HotSpot") == 0)
if not java_installed:
run("sudo rm -f /var/lib/dpkg/info/oracle-java7-installer*")
with settings(warn_only=True):
run("sudo apt-get purge oracle-java7-installer*")
run("sudo rm -f /etc/apt/sources.list.d/*java*")
run("sudo apt-get update")
run("sudo apt-get install -y python-software-properties")
datatypes/compare.cc: In function 'bool compare_float(const e::slice&, const e::slice&)':
datatypes/compare.cc:62:5: error: 'unpackdoublele' is not a member of 'e'
datatypes/compare.cc:63:5: error: 'unpackdoublele' is not a member of 'e'
make[1]: *** [datatypes/libhyperclient_la-compare.lo] Error 1
make[1]: Leaving directory `/home/callen/code/HyperDex'
make: *** [all] Error 2
require 'formula'
class Ab < Formula
homepage 'http://httpd.apache.org/docs/trunk/programs/ab.html'
url 'http://www.apache.org/dist/httpd/httpd-2.4.3.tar.bz2'
sha1 '0ef1281bb758add937efe61c345287be2f27f662'
def patches
{
# The ab tool of the latest stable httpd (2.4.2) does not work
@bitemyapp
bitemyapp / convert db uri for korma
Created February 17, 2013 07:32
convert db uri for korma
(defn- convert-db-uri [db-uri]
(let [[_ user password host port db] (re-matches #"postgres://(?:(.+):(.*)@)?([^:]+)(?::(\d+))?/(.+)" db-uri)]
{:user user
:password password
:host host
:port (or port 80)
:db db}))
<p>
<h5>Basic HTTP</h5>
<a href="https://github.com/mmcgrana/ring">Ring</a>
<h5>Routing</h5>
<a href="https://github.com/weavejester/compojure">Compojure</a>
(defn binary-search
"Finds earliest occurrence of x in xs (a vector) using binary search."
([xs x]
(loop [l 0 h (unchecked-dec (count xs))]
(if (<= h (inc l))
(cond
(== x (xs l)) l
(== x (xs h)) h
:else nil)
(let [m (unchecked-add l (bit-shift-right (unchecked-subtract h l) 1))]