Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Martin Nowak MartinNowak

🎯
Focusing
View GitHub Profile
@MartinNowak
MartinNowak / terraform_update.sh
Last active Jun 11, 2020
script to update terraform binary to (latest) version
View terraform_update.sh
#!/usr/bin/env bash
set -ueo pipefail
function cleanup {
rm -rf "$TMP"
}
TMP=$(mktemp -d)
trap cleanup EXIT
cd "$TMP"
@MartinNowak
MartinNowak / convert_saved_model.py
Created Nov 28, 2019
Convert TF saved model from protobuf binary to text format
View convert_saved_model.py
import os, sys
import google.protobuf
from tensorflow.core.protobuf import saved_model_pb2
import tensorflow as tf
def convert_saved_model_to_pbtxt(path):
saved_model = saved_model_pb2.SavedModel()
with open(os.path.join(path, 'saved_model.pb'), 'rb') as f:
@MartinNowak
MartinNowak / safety_dance.d
Last active Oct 23, 2017
@safe, scope, and RC related question marks
View safety_dance.d
//==============================================================================
//
struct String
{
/// clone string, doesn't escape, but return value must have independent lifetime
String clone() scope
{
return String();
}
@MartinNowak
MartinNowak / plot.R
Last active Sep 26, 2017
Benchmark realloc growth strategies
View plot.R
library(ggplot2)
library(dplyr)
library(plyr)
data <- read.csv('capacities.csv')
data <- ddply(data, .(growth_factor), mutate, step = seq_along(capacity))
data$growth_factor <- factor(data$growth_factor)
p <- ggplot(data, aes(x=step, y=capacity, color=growth_factor)) + geom_step() + geom_point(size = 0.5)
ggsave("capacity_steps.png", p)
@MartinNowak
MartinNowak / excludedCommits
Last active Jul 14, 2017
Get top contributors for a source file of a git repo.
View excludedCommits
// ==== phobos
// git log --grep='convert docstring examples to unittests' --pretty=%H
ba596549cc76547e1cb78177ed3d3d99668f9212
04654c071d1b7e59b53aa6f269dfe209966263cf
afc40287e02042df43bc763595869bedee15e8de
66e0dc39c5212821208b496800080210f7146ff9
ce795612149097cc6f2bcaa32da4a1023dedaa28
167b28679bd3b9f2639341e78b102616e2223efb
6c386d6f3165f062d0722155dc64a87de4c3e1b2
d81030ab8a15de5353735c646807308ec3bbf3b0
@MartinNowak
MartinNowak / release.sh
Last active Jun 3, 2021
Orchestration for dlang release building
View release.sh
#!/usr/bin/env bash
set -ueo pipefail
set -x
ROOT="$PWD"
LATEST_D_VER=v$(curl -fsS http://downloads.dlang.org/releases/LATEST)
BUILD_LDC_VER=v1.26.0
D_VER=v2.097.0
@MartinNowak
MartinNowak / benchmark_compare.diff
Last active Jan 15, 2017
rake benchmark:compare REFERENCE=benchmark/results/corpora-7980c3dc-unstaged.json CANDIDATE=benchmark/results/corpora-c4f1ea51-unstaged.json
View benchmark_compare.diff
--- /dev/fd/63 2017-01-16 00:04:30.566666277 +0100
+++ /dev/fd/62 2017-01-16 00:04:30.566666277 +0100
@@ -2,21 +2,21 @@
- "cev62/FEH-Robot-A7/blob/674d3b2378ea97fd7b655a830be112fae3c0d7f0/HelloWorld/main.d": "D",
- "cev62/FEH-Robot-A7/blob/674d3b2378ea97fd7b655a830be112fae3c0d7f0/PT5/PT4/VectorTest2.d": "D",
- "cev62/FEH-Robot-A7/blob/674d3b2378ea97fd7b655a830be112fae3c0d7f0/PT5/PT4/control.d": "D",
- "cev62/FEH-Robot-A7/blob/674d3b2378ea97fd7b655a830be112fae3c0d7f0/PT5/PT4/drive.d": "D",
- "cev62/FEH-Robot-A7/blob/674d3b2378ea97fd7b655a830be112fae3c0d7f0/PT5/PT4/main.d": "D",
- "cev62/FEH-Robot-A7/blob/674d3b2378ea97fd7b655a830be112fae3c0d7f0/Robot/command.d": "D",
- "cev62/FEH-Robot-A7/blob/674d3b2378ea97fd7b655a830be112fae3c0d7f0/Robot/printcommand.d": "D",
@MartinNowak
MartinNowak / .gitignore
Last active Jan 15, 2017
Scrape GH search for language corpora
View .gitignore
cookie.jar
corpora/
@MartinNowak
MartinNowak / pull_request_stats.sh
Last active Dec 11, 2016
number of pull requests per major release
View pull_request_stats.sh
#!/bin/bash
set -ueo pipefail
majors=$(seq 66 72)
projects="dmd druntime phobos dlang.org tools installer"
printf ' %9s ' ''
for maj in $majors; do
echo -n "..v2.0$maj.0 "
@MartinNowak
MartinNowak / corpora.sh
Last active Sep 23, 2016
get corpora for different languages
View corpora.sh
#!/bin/bash
set -euo pipefail
tmp=$(mktemp -d)
cleanup() {
rm -rf "$tmp"
}
trap cleanup EXIT