Skip to content

Instantly share code, notes, and snippets.

@izderadicka
izderadicka / megaback.sh
Last active February 7, 2022 04:53
backup script for megatools
#!/bin/bash
BACKUP_DIR="/Root/Backup/"
PIECE_SIZE=10M
ACTION=store
trap "exit 2" SIGINT
if [[ $1 =~ -h|--help ]]; then
@izderadicka
izderadicka / calc.py
Last active November 28, 2015 15:18
Calculate number of Fridays 13th between given dates - effective algorithm
'''
Created on Nov 28, 2015
@author: ivan
'''
from datetime import date, timedelta
from copy import copy
import pprint
@izderadicka
izderadicka / check.py
Created November 29, 2015 07:58
Check if point is inside triangle
import matplotlib.pyplot as lpt
import numpy as np
def pt(data, point=None):
p = plt.Polygon(data, closed=True, fill=None)
ax = plt.gca()
ax.add_patch(p)
x=data[:,0]
y=data[:,1]
if point:
@izderadicka
izderadicka / tf.ipynb
Created July 29, 2016 09:54
TensorFlow tutorial
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@izderadicka
izderadicka / eratosthenes_sieve.rs
Last active September 27, 2017 19:44
Sieve of Eratosthenes in RUST
//! Simple module to implement [Sieve of Eratosthenes](https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes).
//! It implements both clasical sieve (starting from 2 to given limit) and segmented sieve (from min to max).
//! # Examples
//!
//! Primes under 20:
//!
//! ```
//! use numbers::sieve::{Sieve,Eratosthenes};
//! let s = Eratosthenes::new(20);
//! assert_eq!(s.first(), Some(2));
0x0004da82394ED7Aa756E6343F0A1a52609087d79
@izderadicka
izderadicka / split_audiobook.sh
Last active September 12, 2019 08:40
Splits large audiobooks into smaller files ( either by chapters, if available or to pieces of fixed duration) encoded with Opus audio
#!/bin/bash
# Author : <Ivan Zderadicka> ivan@zderadicka.eu
# License: MIT
VERSION="0.2.3"
BITRATE=48
CUTOFF=12000
SEGMENT_TIME=1800
COMMON_PARAMS="-nostdin -v error"
@izderadicka
izderadicka / mp3_to_opus.sh
Last active November 24, 2018 11:17
Converts mp3 files to opus concurrently (one conversion per core)
#!/bin/bash
# Author : <Ivan Zderadicka> ivan@zderadicka.eu
# License: MIT
VERSION=0.1.1
BITRATE=48
CUTOFF=20000
APPLICATION=audio
FORMAT=opus
QUALITY=10
@izderadicka
izderadicka / extract_cover.py
Created August 20, 2018 07:46
Extract cover images from mp3 files within directory
#! /usr/bin/env python3
import argparse
import os
import subprocess
import logging
log = logging.getLogger()
def main():