Skip to content

Instantly share code, notes, and snippets.

silent !stty -ixon > /dev/null 2>/dev/null
let g:python_host_prog = '/home/peter/.pyenv/versions/neovim2/bin/python'
let g:python3_host_prog = '/home/peter/.pyenv/versions/neovim3/bin/python'
set t_Co=256
set laststatus=2
set nocompatible " be iMproved, required
filetype off " required
@pbabics
pbabics / timeseries.cpp
Last active November 2, 2019 19:38
Simple AggregatedTimeSeries storage which allows fast retrieval of aggregated value. Aggregating function is defined by two functions, binary function `op` and inverse function `inv`.
#include <vector>
#include <exception>
/**
* Exception thrown whenever AggregatedTimeSeries instance
* is trying to access First or Last element of storage
* while storage is empty
*/
function env_activate() {
if [ $# -ne 1 ]; then
echo "Usage: env_activate <environment name>" >&2
return
fi
if [ ! -d "${HOME}/.virtualenvs/${1}" ]; then
echo "Virtualenvironment '${1}' does not exist" >&2
return
fi
source "${HOME}/.virtualenvs/${1}/bin/activate"
typedef int (*CALLABLE) (void);
CALLABLE async_functions[] = {
xyz,
yzx,
zxy,
};
int async_delays[] = {0, 0, 0};
@pbabics
pbabics / metacentrum.md
Created May 25, 2017 10:09
MetaCentrum Python setup (without modules..)

Metacentrum Python installation

Metacentrum (https://metavo.metacentrum.cz/) is virtual organization providing grid computing infrastructure for academic purposes of Czech Universities and Research Groups.

Servers under this organization contain so called modules which are software packages that can be loaded via module commmand. These modules contain also python software packages like TensorFlow, Caffe, Keras, and others. But these modules contain old versions of these python software packages, and most of time, it is difficult to use them, due to wrong installation with different versions of python librabries. Most of time you get exception with missing library name.

Best way to use python software packages is to install them locally, without loading any available modules.

Prepare environment

First step is to prepare Python environment, install pip and install required python software packages.

@pbabics
pbabics / progress.cpp
Last active April 5, 2017 16:44
Simple Linux console application for printing progress of per line output items (i.e progress of printing sha sums of listed files via parallels), to compile use: g++ -O3 -o progress -Wall -Wno-long-long -pedantic -std=c++11 progress.cpp
#include <cstdio>
#include <cstdlib>
#include <cstring>
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
int main(int argc, const char* argv[])
{
if (argc != 2)
@pbabics
pbabics / progress.cpp
Created April 5, 2017 16:44
Simple Linux console application for printing progress of per line output items (i.e progress of printing sha sums of listed files via parallels)
#include <cstdio>
#include <cstdlib>
#include <cstring>
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
int main(int argc, const char* argv[])
{
if (argc != 2)
@pbabics
pbabics / gitlab-registry-cleaner.py
Created January 31, 2017 09:37
Python script for removal of old Gitlab Registry tags (per project), usefull when you have many tags and you are too lazy to remove them manualy
#!/usr/bin/env python
import os
import json
import argparse
import math
from datetime import datetime
import dateutil.parser
import time
import sys
@pbabics
pbabics / gitlab-registry-stats.py
Created January 27, 2017 11:31
Prints statistics per project in gitlab registry (usefull for debugging purposes)
#!/usr/bin/env python2.7
import os
import json
import argparse
import math
def convert_size(size_bytes):
if (size_bytes == 0):
return '0B'
#!/usr/bin/env python3
import threading
import multiprocessing
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
import tensorflow.contrib.slim as slim
import scipy.signal
import gym