Skip to content

Instantly share code, notes, and snippets.

@neiltron
neiltron / proxy.js
Created April 3, 2012 19:00
Node HTTP proxy with url rewriting.
var util = require('util'),
colors = require('colors'),
http = require('http'),
httpProxy = require('http-proxy');
//
// Http Server with proxyRequest Handler and Latency
//
var proxy = new httpProxy.RoutingProxy();
http.createServer(function (req, res) {
def publish_activity!
activity = current_user.publish_activity(:send_karma, :object => karma, :target => receiver, :receivers => [receiver, current_user])
activity.organization = current_organization
activity.save
activity.notify!
activity
end
@neiltron
neiltron / app.rb
Created May 4, 2011 22:19
Sinatra/mongoid issues
#removed a bunch of routes that aren't relevant
require 'rubygems'
require 'bundler'
require 'sinatra'
require 'haml'
require 'bson'
require 'models/user'
@neiltron
neiltron / app.yaml
Created January 14, 2011 22:26
necessary changes to app.yaml to make our stashboard cron work
- url: /check
script: stashboard.py
secure: optional
@neiltron
neiltron / cron.yaml
Created January 14, 2011 22:25
cron.yaml to run stashboard.py periodically
cron:
- description: periodic server checks
url: /check
schedule: every 30 minutes
@neiltron
neiltron / stashboard.py
Created January 14, 2011 22:15
hack stashboard to make it update server status with cron
import urllib
import urllib2
import socket
from google.appengine.api import urlfetch
from google.appengine.api.urlfetch import DownloadError
from google.appengine.ext import db
from models import Status, Service, Event
from datetime import datetime, timedelta, date