Skip to content

Instantly share code, notes, and snippets.

@bootandy
bootandy / riak.txt
Created November 2, 2012 10:21
Riak install guide
Install guide:
http://docs.basho.com/riak/latest/tutorials/installation/Installing-on-Debian-and-Ubuntu/
Note: If you dont build from source (if you use the easy way: 'sudo dpkg -i riak_1.2.1-1_i386.deb') then you wont be able to setup a 4 node cluster with Rebar.
Dependencies for 32bit ubuntu:
sudo apt-get install build-essential libncurses5-dev m4
sudo apt-get install libssl0.9.8
-------- Thoughts ---------
@bootandy
bootandy / cap.rb
Created November 6, 2012 17:56
A sample CAP file capistrano
load 'deploy' if respond_to?(:namespace)
require 'railsless-deploy'
require 'capistrano_colors'
set :application, "grata"
set :user, "ubuntu"
set :use_sudo, false
# Forward your github ssh keys to the server
@bootandy
bootandy / vertical.html
Created November 15, 2012 16:26
HTML Vertical Layout - Like a table
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style type="text/css">
.from_to_text {
position: relative; /*Parent is relative */
}
.from_to_text_real_name {
/*No position - this sets the spacing for the html */
@bootandy
bootandy / mongo_admin.txt
Last active November 6, 2019 23:10
Mongodb admin notes
Start mongodb replica servers:
mongod --replSet abc --dbpath /db/1 --port 27001 --oplogSize 50 --logpath log.1 --logappend --fork --rest
mongod --replSet abc --dbpath /db/2 --port 27002 --oplogSize 50 --logpath log.2 --logappend --fork --rest
mongod --replSet abc --dbpath /db/3 --port 27003 --oplogSize 50 --logpath log.3 --logappend --fork --rest
Basic config for a replica set:
cfg=
{
"_id" : "abc",
@bootandy
bootandy / query_nowa.py
Created December 4, 2012 10:03
how2 query ingenia/nowa in python
import requests
import pymongo
import json
# Requires crunchbase data loaded by this gist: https://gist.github.com/4202360
NOWA_API_KEY = 'NOWA_KEY'
NOWA_URL = 'http://ingeniapi.com/train'
db_connection = pymongo.Connection('localhost', 27017)
@bootandy
bootandy / crunchbase_loader.py
Created December 4, 2012 10:04
how2 load data from Crunchbase (python)
import requests
import pymongo
CRUNCHBASE_API = 'http://api.crunchbase.com/v/1/company/'
CRUNCHBASE_API_END = '.js?api_key=CRUNCHBASE_API'
db_connection = pymongo.Connection('localhost', 27017)
db = db_connection['tc']
@bootandy
bootandy / add_param_to_url.py
Created December 11, 2012 12:34
add a parameter to the url. Overwrite param if it is already there
def _merge_new_params_with_referring_url(url, param_name=None, param_value=None):
if not url:
return '/'
if not param_name or not param_value:
return url
scheme, network, path, query, fragment = urlparse.urlsplit(url)
@bootandy
bootandy / nginx_config
Last active October 14, 2015 01:17
#nginx Nginx config for nuclearcarrot
# -------- /etc/nginx/nginx.conf --------
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
@bootandy
bootandy / tornado_template_date_from_mongo_object_id.py
Created December 17, 2012 15:46
How2 Print a date in a tornado template from a Mongodb ObjectId
{{locale.format_date(c['_id'].generation_time.replace(tzinfo=None))}}
@bootandy
bootandy / tornado_linkedin.py
Created January 17, 2013 12:04
LinkedIn login for Tornado.
from tornado import httpclient
from tornado import auth
from tornado import httputil
from tornado import escape
import urllib
#from tornado.httputil import url_concat