Skip to content

Instantly share code, notes, and snippets.

@ajbouh
ajbouh / build_xvfb
Created February 19, 2016 04:13 — forked from bobzoller/build_xvfb
Compiles a static xvfb for the Heroku platform.
#!/bin/sh
#
# Compiles a static xvfb for the Heroku platform.
#
# This script is a conglomeration of:
# * https://github.com/ddollar/heroku-buildpack-apt
# * http://stackoverflow.com/questions/14845291/compile-static-linked-binary-of-xvfb
# * gumption
set -e # fail fast
load("@io_bazel_rules_docker//container:providers.bzl", "BundleInfo", "ImageInfo")
load("//deployment/docker:image_name.bzl", "image_name")
load(":providers.bzl", "DigestInfo", "RepoInfo")
def _bundle_impl(target, ctx):
bundle_info = target[BundleInfo]
return RepoInfo(image_digests = {
image_name(bundle_info, x[ImageInfo]): x[DigestInfo]
for x in ctx.rule.attr.image_targets
})
<style>
.container :global(.deprecated) {
font-weight: bold;
color: crimson;
}
.container :global(.deprecated p) {
margin-top: 0;
}
@ajbouh
ajbouh / metered_forecast.md
Last active August 2, 2021 07:26 — forked from yirenlu92/metered_forecast.md
Forecasting Timeseries with Metered and Prophet

Forecasting timeseries with the Metered Prophet API

Forecasting timeseries

Forecasting timeseries is a common problem in data science/machine learning. It asks, given a set of observations of the past, what the future will look like.

Some real world applications of timeseries forecasting include:

  • Sales/demand forecasting: Say you're an ice cream chain. You might expect that sales will be much higher in the summer and lower in the winter, but trend higher year-over-year overall because you're investing in advertising. The sales forecasts would be useful for things like setting quota for your salespeople, financial disclosure/valuation, and inventory planning.
  • Capacity planning: In a software context, capacity planning refers to ensuring enough compute resources to serve expected traffic. More broadly, capacity planning asks, how many servers, employees, meals, parking spaces, etc
@ajbouh
ajbouh / create-registry.sh
Created October 11, 2017 16:46
Create a private Docker registry on a fresh Kubernetes Cluster
set -ex
REGISTRY_INGRESS_IP=10.73.177.23
REGISTRY_INGRESS_REGISTRY_INGRESS_HOSTNAME=registry.$REGISTRY_INGRESS_IP.xip.io
# if [ ! -e $REGISTRY_INGRESS_HOSTNAME.key ]; then
# echo '{"CN":"'$REGISTRY_INGRESS_HOSTNAME'","hosts":[""],"key":{"algo":"rsa","size":2048}}' | cfssl gencert -config=ca-config.json -ca=ca.pem -ca-key=ca-key.pem -hostname="$REGISTRY_INGRESS_HOSTNAME" - | cfssljson -bare $REGISTRY_INGRESS_HOSTNAME
# fi
# juju ssh easyrsa/0
@ajbouh
ajbouh / loadnpy.js
Created July 14, 2018 21:36 — forked from nvictus/loadnpy.js
NumPy binary file parser for javascript
// Client-side parser for .npy files
// See the specification: http://docs.scipy.org/doc/numpy-dev/neps/npy-format.html
var NumpyLoader = (function () {
function asciiDecode(buf) {
return String.fromCharCode.apply(null, new Uint8Array(buf));
}
function readUint16LE(buffer) {
var view = new DataView(buffer);
var val = view.getUint8(0);
@ajbouh
ajbouh / create-registry.sh
Created October 11, 2017 19:30 — forked from marcoceppi/create-registry.sh
Create a private Docker registry on a fresh Kubernetes Cluster
set -ex
REGISTRY_INGRESS_IP=10.73.177.23
REGISTRY_INGRESS_HOSTNAME=registry.$REGISTRY_INGRESS_IP.xip.io
REQ_CN=10.73.177.126
# if [ ! -e $REGISTRY_INGRESS_HOSTNAME.key ]; then
# echo '{"CN":"'$REGISTRY_INGRESS_HOSTNAME'","hosts":[""],"key":{"algo":"rsa","size":2048}}' | cfssl gencert -config=ca-config.json -ca=ca.pem -ca-key=ca-key.pem -hostname="$REGISTRY_INGRESS_HOSTNAME" - | cfssljson -bare $REGISTRY_INGRESS_HOSTNAME
# fi
@ajbouh
ajbouh / README.md
Last active September 24, 2017 00:46
Advanced TFI + TensorFlow SavedModel Example
#!/usr/bin/env ruby
require 'json'
require 'uri'
USAGE = <<-EOF
Usage: #{File.basename($0)} file suffixformat prefix_field bson_date_field [limit]
TODO(adamb) make prefix_field detect a constant (prefix) vs a field (.prefix)
TODO(adamb) make bson_date_field detect a constant (date) vs a field (.date)