Setup:
$ mongo
> use pubsub
> db.createCollection('messages', { capped: true, size: 100000 })
> db.messages.insert({})
package main | |
import ( | |
"bufio" | |
"flag" | |
"fmt" | |
"net" | |
"strconv" | |
"strings" | |
"time" |
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
function html([type, props, ...children]) { | |
return React.createElement(type, props, ...children.map((child) => { | |
if (Array.isArray(child)) { | |
return html(child); | |
} else { | |
return child; | |
} |
use std::collections::hash_map::{Entry, HashMap}; | |
use std::io::{self, BufRead, BufReader, Write}; | |
use std::net::{TcpListener, TcpStream, ToSocketAddrs}; | |
use std::sync::{ | |
Arc, | |
mpsc::{self, Sender, Receiver}, | |
}; | |
use std::thread::{self}; | |
#[derive(Debug)] |
(defn debounce [in ms] | |
(let [out (chan)] | |
(go-loop [last-val nil] | |
(let [val (if (nil? last-val) (<! in) last-val) | |
timer (timeout ms) | |
[new-val ch] (alts! [in timer])] | |
(condp = ch | |
timer (do (>! out val) (recur nil)) | |
in (recur new-val)))) | |
out)) |
# pip install spidev RPI.GPIO | |
# git clone https://github.com/etrombly/RFM69.git | |
# | |
# 19 MOSI | |
# 21 MISO | |
# 23 SCK | |
# 22 DI00 | |
# 24 NSS | |
import time |
### Keybase proof | |
I hereby claim: | |
* I am scttnlsn on github. | |
* I am scttnlsn (https://keybase.io/scttnlsn) on keybase. | |
* I have a public key ASB9vyD2EVSPOPFZSG40S9RvkY9urio90LlnLsBacf9Z5go | |
To claim this, I am signing this object: |
-------------------------------------------------- | |
--- SETUP | |
-------------------------------------------------- | |
\set ON_ERROR_STOP true | |
CREATE TABLE IF NOT EXISTS migrations ( | |
name CHAR VARYING PRIMARY KEY, | |
timestamp TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT now() | |
); |
require 'mongoid' | |
require 'sinatra' | |
require_relative 'resource' | |
class Example | |
include Mongoid::Document | |
field :name | |
field :created, :type => DateTime |