Skip to content

Instantly share code, notes, and snippets.

View calaveraInfo's full-sized avatar

František Řezáč calaveraInfo

View GitHub Profile
@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
Last active August 11, 2023 09:46
Example of how to split single XML document to separate files using XSLT 2 and other advanced features

About

It is possible to create multiple output files as a result of XSL processing in XSLT 2 with tag xsl:result-document. This is usefull for example when some large database is available as a single XML document from which we need to extract only certain parts and/or modify it. This particular example takes export of accounts from the Waveset Identity Management system, filters them, modifies them and saves them in a separate file per account. This principle might be however usefull in many other cases.

This work is largely based on an example from IBM developer works

@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
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 / 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>
@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 / ncatproxy.sh
Last active February 8, 2024 08:35
How to create extremely simple (http) reverse proxy using netcat (nmap flavor) and a named pipe
mkfifo reply
ncat -kl 8765 < reply | ncat 127.0.0.1 4567 > reply # listens on port 8765 and redirects to localhost:4567. Runs until C-c.
rm reply # cleanup after end
@calaveraInfo
calaveraInfo / README.md
Last active January 27, 2021 05:29
Simple tool that redirects it's standard input to input buffer of a terminal (i.e. fake input to some terminal)

About

It is possible to redirect some input to TTY device by standard IO redirection.

echo ahoj > /dev/tty1

Such redirection will however end in the output buffer of the TTY device so the characters will be ghosts - visible on the terminal, but not effective. It is, in fact, not possible by standard tools to redirect input to terminal as if it is a real input from keyboard.