Skip to content

Instantly share code, notes, and snippets.

View MartinNowak's full-sized avatar

dawg MartinNowak

View GitHub Profile
MartinNowak / dnf-automatic-restart
Last active May 15, 2024 10:30
dnf-automatic restart hook
#!/usr/bin/env bash
set -ueEo pipefail
if ! dnf needs-restarting --reboothint; then
systemctl reboot --message='Rebooting after dnf-automatic updates'
mapfile -t services < <(dnf needs-restarting --services)
if [[ "${#services[*]}" -ne 0 ]]; then
MartinNowak /
Created April 28, 2022 10:31
FIR low-pass filter
from numpy import cos, sin, pi, absolute, arange
from scipy.signal import windows, kaiserord, lfilter, firwin, freqz
from pylab import figure, clf, plot, xlabel, ylabel, xlim, ylim, title, grid, axes, show
N = window_size_in_days = 20
MartinNowak /
Created March 11, 2022 15:46
hts for m5 dataset
#!/usr/bin/env python
# coding: utf-8
# # scikit-hts showcase: [M5 kaggle competition](
# In this notebook we will use the data from the Kaggle competiton to perform some hierarchical forecasting. The problem is particularly well suited for the library, as there is a clear hierarchical relationship between each of the series: we have states, stores, categories, departments, and items; sum of sales of items resolve to departments, which summed resolved to categories and so forth.
# We will however limit the scope of the forecasting task to producing forecasts at the
# department level, rather than going to the full extent and forecasting for single items.

send aws credentials

gpg –keyring $PWD/d-keyring.gpg –no-default-keyring –list-keys –with-fingerprint

Bump ldc version with major dlang releases, keep it for minor dlang release

Bump D version (to -beta.1)

Bump Dub version (mostly only with major release, compare e.g. dub v1.26.0…stable to check for bugfixes and minor releases)

We do -beta.1 for all releases and an additional -rc.1 for major releases

(status quo: 2 weeks beta+rc phase for major, 1 week beta for minor releases)

MartinNowak /
Last active November 29, 2021 19:03
script to update terraform binary to (latest) version
#!/usr/bin/env bash
set -ueo pipefail
function cleanup {
rm -rf "$TMP"
TMP=$(mktemp -d)
trap cleanup EXIT
cd "$TMP"
MartinNowak /
Created November 28, 2019 16:17
Convert TF saved model from protobuf binary to text format
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 / safety_dance.d
Last active October 23, 2017 19:59
@safe, scope, and RC related question marks
struct String
/// clone string, doesn't escape, but return value must have independent lifetime
String clone() scope
return String();
MartinNowak / plot.R
Last active September 26, 2017 05:03
Benchmark realloc growth strategies
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 / excludedCommits
Last active July 14, 2017 13:29
Get top contributors for a source file of a git repo.
// ==== phobos
// git log --grep='convert docstring examples to unittests' --pretty=%H
MartinNowak /
Last active October 17, 2022 12:29
Orchestration for dlang release building
#!/usr/bin/env bash
set -ueo pipefail
set -x
LATEST_D_VER=v$(curl -fsS