Skip to content

Instantly share code, notes, and snippets.

malterb /
Created September 1, 2020 12:43
Export Amplitude data per day
# this script will loop through every day between the two dates and download the amplitude data to a zip file named after the day
# the script will actually duplicate the 00 data, but running unzip -o will take care of it by overwriting
while [ "$d" != 2020-09-02 ]; do
formatted=$(date -d $d "+%Y%m%d")
echo "getting ${formatted}"
d=$(date -I -d "$d + 1 day")
formatted_new=$(date -d $d "+%Y%m%d")
curl -u API_Key:Secret_Key "${formatted}T00&end=${formatted_new}T00" >> ${formatted}.zip

With azure cli 2.0:

How to get all private IPs of an azure virtual machine scale set (vmss)

# Date: Feb-03-2017
az vmss nic list --resource-group $RG --vmss-name $SCALE_SET | jq -r '.[] | .ipConfigurations[] | .privateIpAddress'
malterb / IteratorUtils.scala
Last active June 14, 2021 14:18
groupBy on scala iterator
package utils
import scala.collection.mutable
import scala.language.implicitConversions
object IteratorUtils {
* Implicit class that adds "groupBy" functionality to an iterator. The result is a mutable.HashMap and will be
* stored in memory in its entirety
malterb /
Last active March 9, 2017 18:07
Install script for Java 8 + JCE + node.js as an azure extension. Mounts the volume provided for afs-utils
export DEBIAN_FRONTEND=noninteractive
exec > >(tee -i /var/log/javanode.log)
exec 2>&1
echo "starting mount installation"
chmod -R og+r /var/log/
curl -sL -o
bash $@
echo "mounted /mnt/storage"
bash /mnt/storage/install/
malterb /
Last active August 28, 2015 20:13 — forked from mitchwongho/
Implement CORS Request Headers in PlayFramework 2.3.x Applications


I recently needed to apply CORS (Cross Origin Request Scripting) to a project that I'm working on. If found 2 posts that helped to achieve it:

I combined both to solve my problem: I have a User CRUD (Play!) webservice and a (Play!) web app that services a SPA (Single Page Application). The SPA needs to access the CRUD webservice, but to acheive this, I would need to apply some CORS rules on both applications.