Skip to content

Instantly share code, notes, and snippets.

@nivertech
nivertech / Sources
Created February 28, 2013 13:04 — forked from jpmens/Sources
PyWebsocket http://code.google.com/p/pywebsocket/
HTML from http://pedroassuncao.com/blog/2009/12/18/websockets-tutorialexample-with-pywebsocket/
@davit-khaburdzania
davit-khaburdzania / airports.coffee
Last active December 13, 2015 19:59
better information about airports all over the world in json
#author: Davit Khaburdzania
#email: [email protected]
#github: github.com/davit-khaburdzania
fs = require "fs"
mongojs = require "mongojs"
db = mongojs 'mongodb://db_address', ['airports']
#countries in europe
eu_countries = ["austria", "belgium", "bulgaria", "cyprus", "czech republic", "denmark", "estonia", "finland", "france", "germany", "greece", "hungary", "ireland", "iceland", "italy", "latvia", "lithuania", "luxembourg", "malta", "netherlands", "norway", "poland", "portugal", "romania", "slovakia", "slovenia", "spain", "sweden", "switzerland", "united kingdom"]
# you can make a text file of request times (in ms, one number per line) and import it here, or you can use a probability distribution to simulate request times (see below where setting req_durations_in_ms)
# rq = read.table("~/Downloads/request_times.txt", header=FALSE)$V1
# argument notes:
# parallel_router_count is only relevant if router_mode is set to "intelligent"
# choice_of_two, power_of_two, and unicorn_workers_per_dyno are only relevant if router_mode is set to "naive"
# you can only select one of choice_of_two, power_of_two, and unicorn_workers_per_dyno
run_simulation = function(router_mode = "naive",
reqs_per_minute = 9000,
@Nimster
Nimster / intro_to_R
Created February 11, 2013 20:49
An introduction to R, as presented at http://www.meetup.com/Big-Data-Israel/events/96536782/
######### Intro to R ###############
######### The Data Frame ###########
df <- data.frame(
row.names = c('HaLikud', 'Yesh Atid', 'HaAvoda', 'HaBait HaYehudi', 'Yehadut HaTora', 'Meretz', 'Shas'),
LeaderName = c('Netanyahu', 'Lapid', 'Yehimovitch', 'Bennet', 'Litzman', 'GalOn', 'Yishai'),
Category = c('Right', 'Center', 'Left', 'Right', 'Religious', 'Left', 'Religious'),
Mandates = c(31, 19, 15, 12, 7, 6, 11)
)
namespace :app do
desc "create a new app with the given name -- for example, app:create[new_app_name]"
task :create, [:name] => :environment do |t, args|
underscore = get_underscore(args)
name = underscore.camelize
directory = get_directory(args)
raise "#{directory} already exists!" if File.exists?(directory)
puts "Creating app #{name} in #{directory}"
@ralight
ralight / printer.py
Created October 31, 2012 19:07
Print incoming MQTT messages with a maximum width of 32 characters.
#!/usr/bin/python
import mosquitto
import textwrap
def on_message(mosq, obj, msg):
for s in textwrap.wrap(msg.payload, width=32):
print(s)
mqttc = mosquitto.Mosquitto()
@ericbmerritt
ericbmerritt / dialyzer.mkf
Created September 2, 2012 14:59
Dialyzer Example Makefile
# -*- mode: Makefile; fill-column: 80; comment-column: 75; -*-
ERL = $(shell which erl)
ERLFLAGS= -pa $(CURDIR)/.eunit -pa $(CURDIR)/ebin -pa $(CURDIR)/*/ebin
REBAR=$(shell which rebar)
ifeq ($(REBAR),)
$(error "Rebar not available on this system")
@l4u
l4u / gist:3368486
Created August 16, 2012 08:46
Installing esl-erlang on ubuntu
deb http://binaries.erlang-solutions.com/debian precise contrib
wget -O - http://binaries.erlang-solutions.com/debian/erlang_solutions.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install esl-erlang
@Nimster
Nimster / gist:2838511
Created May 30, 2012 19:45
Quick reference to some common R idioms/capabilities - mainly to serve as a reminder for me
### Most of the summary is taken from the awesome R twotorials at http://www.twotorials.com/ by Anthony Damico
### Some of it are my additions from my experience. This is intended so you can Ctrl+F and find what you want using
### common names of functions and concepts from other languages or statistics.
### Troubleshooting: Search http://tolstoy.newcastle.edu.au/R/ , http://www.r-bloggers.com/, http://www.rseek.org/
### Basics
traceback() # Get the call stack after an error, for debugging
32 %% 2 # == 0 mod operator
5 %/% 3 # == 1 integer division
@nivertech
nivertech / README.md
Created May 11, 2012 09:58 — forked from bergie/README.md
MQTT pub/sub example

This is a simple example of the MQTT protocol with Node.js. The client code has also been tested with a combination of C++ servers and clients.