Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@malterb
malterb / amplitude_export.sh
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
d=2018-01-01
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 "https://amplitude.com/api/2/export?start=${formatted}T00&end=${formatted_new}T00" >> ${formatted}.zip
done

With azure cli 2.0:

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

# Date: Feb-03-2017
SCALE_SET=""
RG=""
az vmss nic list --resource-group $RG --vmss-name $SCALE_SET | jq -r '.[] | .ipConfigurations[] | .privateIpAddress'
@malterb
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
malterb / install_java_jce_node.sh
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 https://pubtrip.blob.core.windows.net/trippublic/afs-utils-0.1.sh -o afs-utils-0.1.sh
bash afs-utils-0.1.sh $@
echo "mounted /mnt/storage"
bash /mnt/storage/install/agent.sh
@malterb
malterb / 1README.md
Last active August 28, 2015 20:13 — forked from mitchwongho/1README.md
Implement CORS Request Headers in PlayFramework 2.3.x Applications

Introduction

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.

Files