Skip to content

Instantly share code, notes, and snippets.

František Řezáč calaveraInfo

Block or report user

Report or block calaveraInfo

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
calaveraInfo /
Created Aug 23, 2019
Floating point hell
import java.math.BigDecimal;
import org.junit.jupiter.api.Test;
public class Sandbox {
public void testFloat() {
double raw = 21.05d;
double computed = 21.025d+0.025d;
double rounded = Math.round((21.025d+0.025d) * 1000d) / 1000d;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
public class GenericPolymorphicFunctionTest {
public void testPolymorphicFunction() {
calaveraInfo / log
Created Aug 23, 2018
CZ eID smartcard init fail
View log
0x7f3ef3603700 10:30:07.180 [opensc-tool] sc.c:259:sc_detect_card_presence: called
0x7f3ef3603700 10:30:07.180 [opensc-tool] reader-pcsc.c:397:pcsc_detect_card_presence: called
0x7f3ef3603700 10:30:07.180 [opensc-tool] reader-pcsc.c:303:refresh_attributes: Gemalto PC Twin Reader (6C5795CE) 01 00 check
0x7f3ef3603700 10:30:07.181 [opensc-tool] reader-pcsc.c:323:refresh_attributes: returning with: 0 (Success)
0x7f3ef3603700 10:30:07.181 [opensc-tool] reader-pcsc.c:402:pcsc_detect_card_presence: returning with: 1
0x7f3ef3603700 10:30:07.181 [opensc-tool] sc.c:264:sc_detect_card_presence: returning with: 1
Using reader with a card: Gemalto PC Twin Reader (6C5795CE) 01 00
0x7f3ef3603700 10:30:07.181 [opensc-tool] sc.c:259:sc_detect_card_presence: called
0x7f3ef3603700 10:30:07.181 [opensc-tool] reader-pcsc.c:397:pcsc_detect_card_presence: called
0x7f3ef3603700 10:30:07.181 [opensc-tool] reader-pcsc.c:303:refresh_attributes: Gemalto PC Twin Reader (6C5795CE) 01 00 check
calaveraInfo /
Last active May 7, 2018
Backup shell script using rsync


This is simplified version of script I'm using for doing my backups. I have prepared it only recently because manual invocation of rsync was enough for me. But as the number of separately rsynced folders increased I was forced to introduce some automation and I had to solve some interesting problems along the way.

Persistent SSH connection

Normally a separate SSH connection is established for each rsync invocation. That may become irritating if, for some reason, establishing an SSH connection requires

calaveraInfo /
Last active Dec 14, 2017
Bookmarklet helper for adding global Ajax callbacks manualy from console.
calaveraInfo / signature.txt
Created Sep 19, 2017
Cory Doctorow email signature
View signature.txt
For avoidance of doubt: This email does not constitute permission to add
me to your mailing list.
READ CAREFULLY. By reading this email, you agree, on behalf of your
employer, to release me from all obligations and waivers arising from
any and all NON-NEGOTIATED agreements, licenses, terms-of-service,
shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure,
non-compete and acceptable use policies ("BOGUS AGREEMENTS") that I have
entered into with your employer, its partners, licensors, agents and
assigns, in perpetuity, without prejudice to my ongoing rights and
calaveraInfo /
Created Sep 13, 2017
Shell script that repeats simple smart card operations many times. May be used to measure smart card performance or reliability.
# pkcs15-tool --list-keys
# Private RSA Key [Digital Signature]: ID: 11
# reading PIN into environment variable is NOT safe, DO NOT use on shared computer.
# read is built-in, manual can be shown with
# help read
read -e -s -p "PIN: " PIN
calaveraInfo /
Created Sep 4, 2017
Dmenu parameters I like
echo -e "Hello\nHi\nGood morning\nGood afternoon\nGood evening" | dmenu -i -p "Greeting:" -b -l 5 -fn "-*-terminal-*-*-*-*-18-*-*-*-*-*-*-*" -nf green
calaveraInfo / data.xml
Created Aug 28, 2017
Just a starter template for how to create simple HTML report from XML data directly in browser
View data.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="stylesheet.xsl"?>
<pozadavky xmlns="">
<pozadavek id="1" subdodavka="true" md="1" submd="5">
<text>Some text</text>
<pozadavek id="2" subdodavka="false" md="10">
<text>Some other text</text>
<note>Some note</note>
calaveraInfo /
Last active Aug 22, 2017
Analysis of business proposal strategies in situation of nonlinear relation between price and quality


Since the process of public procurement has to be transaparent, assessment of proposals is in most cases clearly defined beforehand, strictly evaluated and it is often complicated mathematical combination of multiple factors like price and quality. This opens a room for speculation about different strategies for winning a contract, for example low price and low quality vs higher price and higher quality. This is an example of analysis of such possibilities using mathematical software Octave.

I'm keeping these notes mainly as personal notes on how to use Octave.

You can’t perform that action at this time.