Skip to content

Instantly share code, notes, and snippets.

## DEPENDENCIES (BUILD ON INSTANCE) ###########################################
/usr/local/bin/jt:
cat target/jt.tar.gz \
|(cd /usr/local && tar xzvf -)
/usr/local/bin/tclsh8.5:
cat target/tcl8.5.19-src.tar.gz \
|(cd target && tar xzvf - && cd tcl8.5.19/unix && ./configure && make && make install)
.PHONY: all clean
all: demo/main.js
clean:
rm -rf build
rm -f demo/main.js
build/%.js: src/%.js
mkdir -p build
const { is } = require('immutable');
/*
* const { List } = require('immutable');
* const { input, formula } = require('cell');
*
* var a = input(100);
* var b = input(200);
* var c = formula((x, y) => List([x, y]))(a, b);
* var d = formula((x, y) => x + y)(a, b);
<html>
<head>
<script type="text/javascript">
//have to load this one differently so that you get it on the load of the JS.
window.ados = {};
window.ados.events = {}
</script>
<script type="text/javascript" src="ados.js"></script>
@micha
micha / ah-lsenv
Last active January 17, 2017 15:50
#!/usr/bin/env bash
aws autoscaling describe-auto-scaling-groups \
|jt AutoScalingGroups \
[ Tags [ Key % ] [ Value % ] ] \
[ Tags [ Key % ] [ Value % ] ] \
|awk -F ' ' "\$1 == \"AhApplication\" && \$2 == \"$AH_APP\" && \$3 == \"AhEnvironment\" {print \$4}" \
|sort
import csv
class FieldTests(object):
def __init__(self,csvfile):
self.reader = csv.DictReader(csvfile)
self.rows = []
for row in self.reader:
self.rows.append(row)
self.Fieldname = 'name/__text'
@micha
micha / build.boot
Last active January 6, 2017 13:05
(require '[clojure.java.io :as io])
(deftask demo []
(let [tmp (tmp-dir!) ; Anonymous, boot-managed temp directory.
prev-fs (atom nil)] ; Atom where the previous fileset is stored.
(with-pre-wrap [fs]
(let [diff (fileset-diff @prev-fs (reset! prev-fs fs)) ; Fileset containing only changed files.
inputs (->> (input-files diff) ; Sequence of [String, java.io.File]
(by-ext [".c"]) ; pairs, the classpath path and File
(map (juxt tmp-path tmp-file)))] ; for files with given extensions.
local last_balanced = "lastBalanced"
local orphans_key = "orphanAds"
local last_balanced_ttl = 60 * 20
for i = 1, #ARGV do
local ad_id = ARGV[i]
local ad_key = last_balanced .. ":" .. ad_id
if redis.call("EXISTS", ad_key) ~= 1 then
redis.call("SADD", orphans_key, ad_id)
<html>
<head>
<script>
/* Load adOS.js */
(function() {
var d = document;
var protocol = d.location.protocol == "https:" ? "https" : "http";
var z = d.createElement("script");
z.type = "text/javascript";
z.src = protocol + "://static.adzerk.net/ados.js";
/******************************************************************************
*
* Adzerk header bidding boilerplate.
*
*****************************************************************************/
window.adospb = (function() {
window.pbjs = window.pbjs || {};