Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Estimating π</title>
<meta property="og:image" content="https://pi.ivarvong.repl.co/screenshot.jpg" />
// Paste this into the console
var colors = [...document.querySelectorAll("*")].flatMap((el) => {
const style = getComputedStyle(el);
return [
style.getPropertyValue("color"),
style.getPropertyValue("background-color"),
];
});
curl -X PUT http://localhost:9200/_all/_settings -H 'Content-Type: application/json' -d '{"index.indexing.slowlog.threshold.index.debug": "0s", "index.search.slowlog.threshold.fetch.debug" : "0s", "index.search.slowlog.threshold.query.debug": "0s"}'
<!doctype html>
<body>
<h1 style="font-size: 100px;"></h1>
<script src="https://d3js.org/d3-color.v1.min.js"></script>
<script>
const $h1 = document.querySelector('h1')
function random(l) {
const a = parseInt((Math.random() - 0.5) * 256)
const b = parseInt((Math.random() - 0.5) * 256)
return d3.lab(l, a, b)
@ivarvong
ivarvong / Finding User Sessions with SQL
Created July 24, 2018 16:34 — forked from bstancil/Finding User Sessions with SQL
These queries let you define find user sessions against event data logged to Segment SQL, Snowplow, or Google BigQuery.
-- These queries let you define find user sessions against event data
-- logged to Segment SQL, Snowplow, or Google BigQuery.
-- For more details, see the full post:
-- LINK
--- SEGMENT SQL
-- Finding the start of every session
SELECT *
FROM (

macOS 10.12 Sierra Setup

Custom recipe to get macOS 10.12 Sierra running from scratch, setup applications and developer environment. This is very similar (and currently mostly the same) as my 10.11 El Capitan setup recipe and 10.10 Yosemite setup recipe. I am currently tweaking this for 10.12 Sierra and expect to refine this gist over the next few weeks.

I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. I generally reinstall each computer from scratch every 6 months, and I do not perform upgrades between releases.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your o

window.addEventListener('message', function(e) {
var data;
try {
data = JSON.parse(e.data);
} catch (e) {
return false;
}
if (data.context !== 'iframe.resize') {
return false;
@ivarvong
ivarvong / watcher.sh
Created July 14, 2016 15:22 — forked from josevalim/watcher.sh
A 1LOC bash script for re-running tests whenever a lib/ or test/ file changes keeping the same VM instance
# You will need fswatch installed (available in homebrew and friends)
# The command below will run tests and wait until fswatch writes something.
# The --stale flag will only run stale entries, it requires Elixir v1.3.
fswatch lib/ test/ | MIX_ENV=test mix do test --stale, run --no-halt -e "IO.gets(:stdio, ''); IO.puts 'Restarting...'; :init.restart()"
@ivarvong
ivarvong / dmx.js
Created June 25, 2016 16:29 — forked from evantahler/dmx.js
enttec open dmx + nodejs
#!/usr/bin/env node
// A simple DMX example which will turn all the lights on and off every second
// You can use this as a fork within another application as well (cluster-awareness)
////////////
// dmx.js //
////////////
var ftdi = require('ftdi');
@ivarvong
ivarvong / footer.html
Created June 23, 2016 21:27
Example Pony template