Skip to content

Instantly share code, notes, and snippets.

View beppu's full-sized avatar

John Beppu beppu

View GitHub Profile
#!/bin/sh
# Quick start-stop-daemon example, derived from Debian /etc/init.d/ssh
set -e
NAME=ip_monster
PIDFILE=/var/run/$NAME.pid
LOG="/var/log/$NAME.log"
[img]http://i.imgur.com/bDzzx8t.jpg[/img]
[img]http://i.imgur.com/xWS5Obr.jpg[/img]
[img]http://i.imgur.com/ALdQr1b.jpg[/img]
[img]http://i.imgur.com/Jx8Km2W.jpg[/img]
[img]http://i.imgur.com/dTfawmq.jpg[/img]
@beppu
beppu / burst.ls
Created June 3, 2014 02:11
a debounce that summarizes instead of throwing away information from frequent function calls.
# Think of this as a debounce that remembers intermediate calls and summarizes them instead of throwing them away.
#
# @param {Function} initial-fn function that returns initial-state for use with fold and combiner-fn
# @param {Function} combiner-fn given an array of arrays of function arguments, fold them into a value that can be used by final-fn
# @param {Function} final-fn function to run after nothing has happend for longer than delay milliseconds
# @param {Number} delay milliseconds to wait for inactivity before running final-fn
export burst = (initial-fn, combiner-fn, final-fn, delay) ->
ax = []
accumulating = false
wait = null
Generating a project called test-project based on the 'default' template.
To see other templates (app, lein plugin, etc), try `lein help new`.
Times for 2.4.0-RC
Downloading Leiningen to /Users/beppu/.lein/self-installs/leiningen-2.4.0-RC-standalone.jar now...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 13.1M 100 13.1M 0 0 5132k 0 0:00:02 0:00:02 --:--:-- 5133k
real 0m5.887s
user 0m3.230s

Using Git to Contribute to WebGUI 8

For those of you want to contribute to the development of WebGUI 8, here are a few tips to help you get started.

First, fork AlliumCepa/webgui.

This will create a fork of webgui owned by your github account.

export user=you

The Strange Loop 2014

Welcome

cross pollination

diversity

90 diversity scholarships

talk to people

expand your horizons

Keynote - Joe Armstrong - Erlang

#lang racket
(require json)
(require net/http-client)
(define (4chan-data board x)
(let*-values
([(status headers res)
(http-sendrecv "a.4cdn.org"
(string-append "/" board "/" x ".json"))]
[(json) (read-string 1048576 res)]
@beppu
beppu / set-interval.rkt
Created October 6, 2014 21:09
Something like Javascript's setInterval function for Racket (using threads).
#lang racket
(define (set-interval interval fn)
(thread
(lambda ()
(let loop ()
(fn)
(sleep interval)
(loop)))))
(require web-server/servlet
web-server/servlet-env)
(define (my-app req)
(response/xexpr
`(html (head (title "Hello world!"))
(body (p "Hey out there!")))))
(define port (or (and (getenv "PORT")
(string->number (getenv "PORT")))
new Region()
.publishedDocuments()
.query(function(q){
q.join('regions', 'regions.id', '=', 'documentRegions.region_id');
q.whereIn('regions.id', regionIds);
q.where('publishedDocuments.updated_at', '>=', new Date(timestamp));
})
.fetchAll({withRelated: [
'publishedDocuments.images',
'publishedDocuments.ecareSections',