Skip to content

Instantly share code, notes, and snippets.

using System.Diagnostics;
using Microsoft.AspNet.SignalR;
namespace Microsoft.AspNet.SignalR.Samples
{
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
var config = new RedisScaleoutConfiguration("127.0.0.1", 6379, "", "MyApplication");
http {
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m;
proxy_temp_path /var/tmp;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_comp_level 6;
# -*- coding: utf-8 -*-
# Based on https://github.com/ikasamah/withings-garmin/blob/master/withings.py
import urllib
from datetime import datetime
import urlparse
import oauth2 as oauth
try:
import json
@vnisor
vnisor / twitter.json
Created August 13, 2013 23:59 — forked from hrp/twitter.json
{
"text": "RT @PostGradProblem: In preparation for the NFL lockout, I will be spending twice as much time analyzing my fantasy baseball team during ...",
"truncated": true,
"in_reply_to_user_id": null,
"in_reply_to_status_id": null,
"favorited": false,
"source": "<a href=\"http://twitter.com/\" rel=\"nofollow\">Twitter for iPhone</a>",
"in_reply_to_screen_name": null,
"in_reply_to_status_id_str": null,
"id_str": "54691802283900928",
# Nginx+Unicorn best-practices congifuration guide. Now with SPDY!
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies.
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module
#
# Deployment structure
#
# SERVER:
# /etc/init.d/nginx (1. nginx)
# /home/app/public_html/app_production/current (Capistrano directory)
#
using System;
using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR.Messaging;
using RabbitMQ.Client;
namespace SignalR.RabbitMQ {
public static class DependencyResolverExtensions {
public static IDependencyResolver UseRabbitMq(this IDependencyResolver resolver, ConnectionFactory connectionFactory) {
if (connectionFactory == null) {
@vnisor
vnisor / RobinHood.cs
Created September 11, 2013 20:46 — forked from phm200/RobinHood.cs
public long numberOfRedirects = 1;
private string redirectHost = "192.168.100.57";
private int hostPort = 9999;
private string destinationOne = "192.168.100.57";
private int destOnePort = 8100;
private string destinationTwo = "192.168.100.57";
private int destTwoPort = 8101;
public void AutoTamperRequestBefore(Session oSession)

Running redis using upstart on Ubuntu

I've been trying to understand how to setup systems from the ground up on Ubuntu. I just installed redis onto the box and here's how I did it and some things to look out for.

To install:

/** Reinflates a compressed signature string:
resolution = a representation of the resolution in
pixels of the canvas which this signature will be drawn
e.g. {x:800,y:200}
*/
var inflateToJsonSignature = function (deflatedSig, resolution) {
var components = [],
modifier = 1,
compressWithResolution = /^(?:\[(\d+)x(\d+)\])?([\w\W]*)/,
parsedSigString = deflatedSig.match(compressWithResolution),