Skip to content

Instantly share code, notes, and snippets.

Avatar

Astro astro

View GitHub Profile
@astro
astro / flash-arduboy.sh
Created Feb 19, 2017
Flash .hex on Arduboy
View flash-arduboy.sh
PORT=/dev/ttyACM1
HEX=hollow_v0.31.hex
ard-reset-arduino --caterina $PORT --verbose
avrdude -P /dev/ttyACM1 -p atmega32u4 -c avr109 -b 57600 -D -Uflash:w:$HEX:i
View keybase.md

Keybase proof

I hereby claim:

  • I am astro on github.
  • I am astro (https://keybase.io/astro) on keybase.
  • I have a public key whose fingerprint is A5EE 826D 645D BE35 F9B0 9933 5851 2AE8 7A69 900F

To claim this, I am signing this object:

View scrape.js
// npm i crawler && node scrape.js && less scraped.json
var fs = require('fs');
var resolve = require('url').resolve;
var Crawler = require("crawler").Crawler;
function trim(s) {
return s.replace(/^\s+/gm, "").replace(/\s+$/gm, "");
}
View canvas.html
<canvas id="myCanvas" width="400" height="300" style="border:1px solid #000000;"> </canvas>
<script>
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
var width = c.width / 6;
var height = c.height / 4;
var o = 0;
View fade.html
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
@-webkit-keyframes fader {
/*from {
background-color: rgb(255, 0, 0);
}
25% {
background-color: rgb(255, 255, 0);;
View graph.js
var width = window.innerWidth,
height = window.innerHeight;
var force = d3.layout.force()
.charge(-120)
.size([width, height]);
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
@astro
astro / hlsdump.js
Created Sep 5, 2013
Reliably record an HTTP Live Stream with node.js
View hlsdump.js
var fs = require('fs');
var request = require('request');
var joinUrl = require('url').resolve;
if (process.argv.length != 3) {
console.log("Please pass playlist URL");
process.exit(1);
}
var plsUrl = process.argv[2];
var INTERVAL = 5 * 1000;
View osm-xml-dvb.hs
{-# LANGUAGE OverloadedStrings, RankNTypes #-}
module Main where
import Data.Conduit
import Data.Conduit.Binary
import qualified Data.Conduit.List as CL
import Data.XML.Types
import Text.XML.Stream.Parse
import System.IO
import qualified Data.Text as T
@astro
astro / zmqchat.hs
Last active Dec 16, 2015
Winning the 0MQ book at #RealtimeConfEu
View zmqchat.hs
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Control.Monad
import System.IO
import System.ZMQ3.Monadic
import qualified Data.ByteString.Char8 as CS
import Control.Concurrent (forkIO)
main :: IO ()
@astro
astro / watch.js
Created Dec 7, 2012
jsonchangewatch
View watch.js
var http = require('http');
var child_process = require('child_process');
function poll(url, cb) {
http.get(url, function(res) {
var body = "";
res.setEncoding('utf8');
res.on('data', function(data) {
body += data;
});