Skip to content

Instantly share code, notes, and snippets.

@emacsen
emacsen / app.js
Created September 10, 2016 00:47
import {log} from "./log";
export class App {
constructor() {
log.info("Starting application");
// Set up the websocket
const ws_scheme = window.location.protocol == "https:" ? "wss" : "ws";
const ws_path = ws_scheme + '://' + window.location.host + "/chat/stream/";
this.ws = new WebSocket(ws_path);
this.ws.onmessage = this.onWSEvent;
@emacsen
emacsen / app.js
Last active December 28, 2015 14:46
var express = require('express');
var nunjucks = require('nunjucks');
var bodyParser = require('body-parser');
var cookieParser = require('cookie-parser')
var session = require('express-session')
var passport = require('passport');
var LocalStrategy = require('passport-local').Strategy;
var db = require('./db');
passport.use(new LocalStrategy(
@emacsen
emacsen / pyxbot.py
Created May 11, 2012 00:15
OSM Tiger expansion code
from xml.sax.handler import ContentHandler
import os
import codecs
from xml.sax.saxutils import escape
class OSMHandler(ContentHandler):
"""This is a base OSMHandler class which sets up the XML parsing, etc.
You will want to override the selectElement and transformElement
functions"""
@emacsen
emacsen / mb2s3.py
Created May 1, 2011 21:16
First rough cut at an mbtiles to s3 uploader. Needs work
#!/usr/bin/env python
"""Script to upload contents of an mbtile to an s3 storage bucket"""
from boto.s3.connection import S3Connection
import sqlite3
import sys
import os
import progressbar
import threading