Skip to content

Instantly share code, notes, and snippets.

Bohumír Zámečník bzamecnik

Block or report user

Report or block bzamecnik

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
bzamecnik /
Created Sep 17, 2019
Accept ČD Wifi on the command line (if you hate clicking).
# Accept CD Wifi (Czech railways) on the command line (if you hate clicking).
# Put the script to ~/bin/cdwifi and make sure that export it's on the path: PATH=$PATH:~/bin
curl -s \
-o /dev/null \
-w "%{http_code}\n" \
-b '' \ \
| grep -q 307 \
bzamecnik /
Created Aug 6, 2019
Floyd-Steinberg dithering in Python (quite fast via Numba JIT)
from numba import jit
import numpy as np
def floyd_steinberg(image):
# image: np.array of shape (height, width), dtype=float, 0.0-1.0
# works in-place!
h, w = image.shape
for y in range(h):
bzamecnik /
Created Apr 4, 2019
Allows to compare data in two DataFlows, eg. for regression tests.
import numpy as np
from tensorpack import DataFlow
class CompareData(DataFlow):
Compares that two DataFlows generate equal data, raises ValueError if not.
def __init__(self, a, b):
self.a = a
bzamecnik /
Created Mar 9, 2019
Power saving mode for NVIDIA GTX 980 Ti.

My NVIDIA GTX 980 Ti being idle eats 53 W (out of 250 W max). Here's how to put to to a power saving mode at 30 W consumption and keep it prepared to run at higher performance automatically when there's a computation running.


sudo nvidia-smi -pm ENABLED -i 0
sudo nvidia-smi -ac 405,135 -i 0
bzamecnik /
Created Mar 1, 2019
Example of basic MNIST Keras model with tf.Dataset
# Example of basic MNIST Keras model with tf.Dataset
# More up-to-date version of:
MNIST classification with TensorFlow's Dataset API.
Introduced in TensorFlow 1.3, the Dataset API is now the
standard method for loading data into TensorFlow models.
A Dataset is a sequence of elements, which are themselves
composed of tf.Tensor components. For more details, see:
bzamecnik /
Last active Dec 16, 2019
Python profiling to chrome://tracing
# Example of how to profile a Python app with multiple processes
# by logging events and opening the resulting trace file in chrome://tracing.
# pip install multiprocessing_logging
from functools import wraps
import json
import logging
bzamecnik / .profile
Created Dec 19, 2018
SSH refresh in tmux & git force pull
View .profile
# refresh SSH socket after reconnect to tmux (useful with ssh agent forwarding)
alias ssh_refresh='export $(tmux show-environment | grep "^SSH_AUTH_SOCK")'
# list current git branch
alias git_current_branch='git branch | grep \* | cut -d " " -f2'
# force pull (after rebase in remote)
alias git_pull_force='ssh_refresh && git fetch && git reset --hard origin/$(git_current_branch)'

Perfect Tuner - Privacy terms

This app uses microphone to analyze tones from your musical intstrument and help you with tuning it.

It does not store or transmit your audio anywhere.



How not to run docker-compose in .gitlab-ci.yml?

Official docker-compose docs recommend this installer:

curl -L`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

Curl is not available in docker:lastest image, so let's use wget.

bzamecnik / docker-compose.yml
Created Aug 6, 2018
NVIDIA in docker-compose
View docker-compose.yml
# based on
# it indeed works :)
# minimum syntax version to support the "runtime" keyword
version: "2.3"
# show the system information about GPUs
image: "nvidia/cuda:9.1-base"
You can’t perform that action at this time.