Skip to content

Instantly share code, notes, and snippets.


František Řezáč calaveraInfo

View GitHub Profile
calaveraInfo /
Last active Nov 29, 2019
Wildcards in "indirect" or "second level" generics.
package x;
* <p>
* Wildcards in "indirect" or "second level" generics.
* <p>
* {@link #list} contains generic items.
* {@link #testWildcard()} and {@link #testGeneric()} wants to work with that items
* and shouldn't care about it's generic type <i>as long as it's the same type through the
* whole method<i>. How to express that correctly (if it's possible at all)?
calaveraInfo /
Created Nov 21, 2019
Intermittently mutable data concept
public interface Index() {
* @return mutable copy of indexes contained in this instance.
MutableIndex beginMutation();
* Example usage of indexes for data retrieval.
PrimaryKey findBySomeAttributeValue(String value);
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