Skip to content

Instantly share code, notes, and snippets.

View gcr_repo_digest.bzl
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
})
View FieldView.svelte
<style>
.container :global(.deprecated) {
font-weight: bold;
color: crimson;
}
.container :global(.deprecated p) {
margin-top: 0;
}
@ajbouh
ajbouh / metered_forecast.md
Last active Aug 2, 2021 — forked from yirenlu92/metered_forecast.md
Forecasting Timeseries with Metered and Prophet
View metered_forecast.md

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 / loadnpy.js
Created Jul 14, 2018 — forked from nvictus/loadnpy.js
NumPy binary file parser for javascript
View loadnpy.js
// 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 Oct 11, 2017 — forked from marcoceppi/create-registry.sh
Create a private Docker registry on a fresh Kubernetes Cluster
View create-registry.sh
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 / create-registry.sh
Created Oct 11, 2017
Create a private Docker registry on a fresh Kubernetes Cluster
View create-registry.sh
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 / README.md
Last active Sep 24, 2017
Advanced TFI + TensorFlow SavedModel Example
View README.md
@ajbouh
ajbouh / build_xvfb
Created Feb 19, 2016 — forked from bobzoller/build_xvfb
Compiles a static xvfb for the Heroku platform.
View build_xvfb
#!/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
View organize-json-stream.rb
#!/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)