Skip to content

Instantly share code, notes, and snippets.

View bcicen's full-sized avatar

bradley bcicen

View GitHub Profile
#!/bin/bash
cat <<EOF
hello
there
EOF
function hered1(){
cat <<EOF
hello
there
@bcicen
bcicen / results.py
Created June 11, 2014 01:35
numpy.sum_vs_sum
>>> t = timeit.Timer("np.sum(a, axis=0)",
... "import numpy as np\na = np.random.randint(1, 1000, (30, 40))"
... )
>>> t.repeat(3,100000)
[1.3957889080047607, 1.3684840202331543, 1.3558411598205566]
>>> t = timeit.Timer("sum(a)",
... "import numpy as np\na = np.random.randint(1, 1000, (30, 40))"
... )
>>> t.repeat(3,100000)
[5.969266176223755, 5.947613954544067, 5.906123876571655]
RANGES="100 1000 10000 100000"
for RANGE in $RANGES; do
echo "Generating random numbers with a ceiling of $RANGE"
while :; do
nowtest=$((RANDOM%$RANGE+0))
echo -n $nowtest
[[ $nowtest == $lasttest ]] && echo && echo "found side by side collision after $tests tests" && break
let tests++
lasttest=$nowtest
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.md')) as f:
README = f.read()
with open(os.path.join(here, 'CHANGES.md')) as f:
CHANGES = f.read()
var dCursor = db.realtime.find( { profileId: "673772" });
var dDocument = dCursor.hasNext() ? dCursor.next() : null;
getsize = function(doc) {
var dSize = Object.bsonsize(doc);
print(dSize)
}
dCursor.forEach(getsize);
@bcicen
bcicen / glrun.sh
Last active August 29, 2015 14:03
docker run --name=gitlab -d \
-e "GITLAB_HTTPS=true" -e "SSL_SELF_SIGNED=true" \
-e "GITLAB_HTTPS_ONLY=false" -e "HTTPARTY_TIMEOUT=60" \
-v /opt/gitlab/data:/home/git/data sameersbn/gitlab:7.0.0
import random
ranges = [
32767,
2147483647,
9223372036854775807,
]
for range in ranges:
print('generating integers in range 0-%i') % range
count = 0
cur_rand = 0
$ python2 ~/bin/random_test.py
generating integers in range 0-32767
found sequential random collision after 22893 iterations
generating integers in range 0-2147483647
found sequential random collision after 340197 iterations
generating integers in range 0-9223372036854775807
found sequential random collision after 132434 iterations
$ python2 ~/bin/random_test.py
generating integers in range 0-32767
found sequential random collision after 27756 iterations
[server:main]
use = egg:gunicorn#main
host = 0.0.0.0
port = 6543
workers = 20
worker_class = gevent
version=1.7.1
[general]
# What to display in S mode: graph, status, pivoted status
S_func=s
# Which set of variables to display in S (Variables & Status) mode
S_set=general
# Whether to auto-wipe InnoDB deadlocks
auto_wipe_dl=0