Skip to content

Instantly share code, notes, and snippets.

View runvnc's full-sized avatar

Jason Livesay runvnc

View GitHub Profile
@runvnc
runvnc / gist:3469936
Created August 25, 2012 19:36
Server app piping in data from SatGraphicsStub and sending to browser clients
express = require 'express'
childproc = require 'child_process'
#Just setting up the web server, not that interesting
app = module.exports = express.createServer()
app.configure ->
app.use express.bodyParser()
app.use express.methodOverride()
app.use express.static(__dirname + '/public')
app.get '/', (req, res) ->
/dev/xvdb1 contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Inode 173396 has illegal block(s). Clear? yes
Illegal block #12 (6448484) in inode 173396. CLEARED.
Illegal block #13 (154470701) in inode 173396. CLEARED.
Illegal block #14 (858851637) in inode 173396. CLEARED.
Illegal block #15 (825766448) in inode 173396. CLEARED.
Illegal block #16 (825438770) in inode 173396. CLEARED.
Illegal block #17 (755581193) in inode 173396. CLEARED.
@runvnc
runvnc / gist:3823706
Created October 2, 2012 22:23
what the hell did I do my files are gone
2074 coffee app
2075 vim public/index.html
2076 coffee app
2077 ls
2078 vim .gitignore
2079 ls
2080 git add --all
2081 git init
2082 git add --all
2083 git remote add git@github.com:ithkuil/pingservers.git
@runvnc
runvnc / posa.mkdn
Created November 8, 2012 19:38 — forked from audreyt/posa.mkdn
Comments on EtherCalc Chapter for POSA

From SocialCalc to EtherCalc

Previously, in The Architecture of Open Source Applications, I described SocialCalc, an in-browser spreadsheet system that replaced the server-centric WikiCalc architecture. SocialCalc performs all of its computations in the browser; it uses the server only for loading and saving spreadsheets.

...diagram on SocialCalc's scalability model...

For the Socialtext team, performance was the primary goal behind SocialCalc's design. The key observation was this: Client-side computation in JavaScript, while an order of magnitude slower than server-side computation in Perl (are V8 and the new Firefox engines which are compiled to native code when optimized really an order of magnitude slower than Perl?), was still much faster than the network latency incurred during AJAX roundtrips. (Show a graph, or maybe explain briefly when/for what purpose those AJAX rountrips served in SocialCalc?)

Toward the end of the AOSA chapter, we intr

@runvnc
runvnc / somedefs.ls
Created November 16, 2012 10:19
some defs
tag = (name, id, content) -> "<#{name} class=\"#{id}\">#{content}</#{name}>"
div = (classid, content) -> tag 'div', classid, content
$ \body .append (div 't1' 'test1')
make = (name, id, content) -> $ \body .append (tag name, id, content)
div = (id, content) -> make 'div', id, content
make 'p' 'par' 'This is a paragraph'
div 't3' 'test3'
$ \.t3 .draggable!
div 't4' 'test 4'
$ \.t4 .attr 'contentEditable' true
@runvnc
runvnc / app.coffee
Created December 2, 2012 20:36 — forked from katanacrimson/app.js
nodejs app - expressjs 3.0 + socket.io v9 + passport + redis in coffeescript
express = require("express")
passport = require("passport")
LocalStrategy = require("passport-local").Strategy
connect = require("connect")
http = require("http")
path = require("path")
util = require("util")
fs = require("fs")
redis = require("redis")
cookie = require("cookie")
@runvnc
runvnc / app.coffee
Last active October 13, 2015 11:48
starting point for node.js app using mongodb and nowjs (not tested)
###
I came up with my own way that makes it as straightforward as possible to do 'databasing'. It does use CoffeeScript which I also recommend because it makes things easier also. If you really want to you can convert this to javascript on js2coffee.org. It will look very similar, with more punctuation for the most part.
It uses MongolianDeadBeef (mongolian) and NowJS (see nowjs.org, sudo npm install -g now).
You will need to specify express 2.x in the package.json to use it as is
Server: CoffeeScript (node.js)
###
express = require 'express' #web server
MongolianDeadBeef = require 'mongolian' #database thing
server = new MongolianDeadBeef #database thing
@runvnc
runvnc / gist:4202410
Created December 4, 2012 10:14
Writing a Plugin Based Code Generation System in LiveScript

Welcome to the Next Few Minutes of Your Life

The goal is to make it easier to build and maintain web applications. I will create a system that can turn a high-level description like this:

data =
  site:
    template: 'octoish'
    pages:
      * Home:
 * markdown: "
@runvnc
runvnc / waveview.tcl
Created December 8, 2012 09:53
Display a wav file graphically with a line growing to show position and a red line to illustrate marking positions
#!/usr/bin/wish
#See http://www.tcl.tk/man/tcl/TkCmd/contents.htm for manual
#I think that tcl/tk is installed by default on ubuntu
#but if not the package is tk8.5
#for snack you need package libsnack2 and libsnack2-alsa
#python I think may be a bit of a pain
#to install snack
#that is why I am using tcl/tk
#also tcl tk syntax is more similar to bash
#and python using tk behind the scenes anyway
@runvnc
runvnc / gist:5243003
Created March 26, 2013 03:56
Now.js example in CoffeeScript
###
It does use CoffeeScript which I also recommend because it makes things easier also. If you really want to you can convert this to javascript on js2coffee.org. It will look very similar, with more punctuation for the most part.
Uses NowJS (see nowjs.org, sudo npm install -g now).
You will need to specify express 2.x in the package.json to use it as is
Server: CoffeeScript (node.js)
###
express = require 'express' #web server
nowjs = require 'now' #remote procedure call, easier than GET/POST
fs = require 'fs'