Skip to content

Instantly share code, notes, and snippets.

View calaveraInfo's full-sized avatar

František Řezáč calaveraInfo

View GitHub Profile
@calaveraInfo
calaveraInfo / README.md
Last active March 9, 2018 17:44
How to use Czech qualified digital signature in communication with authorities without proprietary software
@calaveraInfo
calaveraInfo / README.md
Last active December 14, 2017 12:52
Bookmarklet helper for adding global Ajax callbacks manualy from console.
@calaveraInfo
calaveraInfo / cardtest.sh
Created September 13, 2017 12:00
Shell script that repeats simple smart card operations many times. May be used to measure smart card performance or reliability.
#!/bin/bash
# pkcs15-tool --list-keys
# Private RSA Key [Digital Signature]: ID: 11
TEMPFILE=`mktemp`
# 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
calaveraInfo / dmenu.sh
Created September 4, 2017 15:56
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
calaveraInfo / data.xml
Created August 28, 2017 14:52
Just a starter template for how to create simple HTML report from XML data directly in browser
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="stylesheet.xsl"?>
<pozadavky xmlns="http://calavera.info">
<pozadavek id="1" subdodavka="true" md="1" submd="5">
<text>Some text</text>
</pozadavek>
<pozadavek id="2" subdodavka="false" md="10">
<text>Some other text</text>
<note>Some note</note>
@calaveraInfo
calaveraInfo / README.md
Last active August 22, 2017 11:31
Analysis of business proposal strategies in situation of nonlinear relation between price and quality

About

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.

@calaveraInfo
calaveraInfo / README.md
Created May 9, 2017 12:47
List of connections between physical reality and computation
  • Landauer's principle: There is a minimum energy needed to delete information because of the laws of thermodynamics.

  • Limits of Koomey's law: Because of Landauer's principle, for non-reversible computation there is a limit on number of computations per joule.

  • Margolus–Levitin theorem: Even reversible computing is constrained in number of computations per joule.

  • Bekenstein bound: Entropy in given finite space is limited.

  • Bremermann's limit: Implication of Bekenstein bound is that there is a limit on computational power of a computer.

@calaveraInfo
calaveraInfo / README.md
Last active April 20, 2017 07:25
Google apps script to forward email as html attachment (ie Email to Kindle integration)

About

@calaveraInfo
calaveraInfo / README.md
Last active April 20, 2017 07:23
Very elementary grep-like tool. Can look just for a simple string in standard input, has no other parameters, but handles multiline log entries.

About

Standard grep has one weakness regarding the log files - it doesn't handle multiline log entries well. For example logs of Java programs are famous to have many lines of stack traces in a single log item. It is possible to use -A grep parameter but this adds lines also for log items that doesn't have any other lines in them resulting in showing log entries which doesn't contain the search term which is very confusing.

I was so frustrated greping through a log file once that I tried a more exotic approach using Lex and it turned out it's extremely easy with it. I realized that it's in fact raison d’être of lex and that it's very dumb not to use it in the first place.

@calaveraInfo
calaveraInfo / response.xml
Last active March 6, 2017 14:42
Testing some XML format for project
<?xml version="1.0" encoding="UTF-8"?>
<result>
<status>success</status>
<html xmlns="http://www.w3.org/1999/xhtml">
<a id="email">somebody@example.com</a>
<span id="filename">file.ext</span>
<table>
<thead>
<tr>
<th>Dodavatel</th>