This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Select which JDK to use | |
# Usage example: | |
# $ . use_java 1.8 | |
JDK_DIR="$HOME/opt/jdk" | |
JDK_NAME=$(ls "$JDK_DIR" | grep "${1:-}" | tail -n1) | |
export JAVA_HOME="$JDK_DIR/$JDK_NAME" | |
export PATH="$JAVA_HOME/bin:$(awk -v RS=: -v ORS=: '/jdk/ {next} {print}' <<< "$PATH" | sed 's/:*$//g')" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib as mpl | |
import matplotlib.pyplot as plt | |
# read the data | |
x, y = np.loadtxt('responses.dat', unpack=True) | |
# change absolute timestamps to relative to start, and convert to seconds: | |
x = (x - x[0]) / 1000.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Spreads the topic among the active brokers. | |
# Does not change the replication factor. | |
# | |
# Usage: $0 <ZOOKEEPER> <TOPIC> | |
set -eu | |
KAFKA_HOME="/crypt/home/iv/opt/kafka_2.11-0.10.1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: add-gcloud-key.sh [PROJECT_ID] | |
set -eu | |
# Change these two lines | |
# USER=<your user name> | |
KEY="$HOME/.ssh/your_key.pub" | |
PROJECT="${1:+--project=$1}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Spreads the topic among the active brokers. | |
# Can increase the replication factor; by default sets it to 3. | |
# | |
# Usage: $0 <ZOOKEEPER> <TOPIC> <REPLICATION_FACTOR> | |
set -eu ${DEBUG:+-x} | |
KAFKA_HOME="${KAFKA_HOME:-/opt/kafka}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
more = 0 | |
less = 0 | |
for n in range(100, 1000): | |
a = n / 100 | |
b = n % 100 / 10 | |
c = n % 10 | |
if a > b > c: | |
more += 1 |