Skip to content

Instantly share code, notes, and snippets.

@baryluk
baryluk / gist:1413912
Created December 1, 2011 05:20
ocaml and haskel
OCaml
http://www-lipn.univ-paris13.fr/~loddo/funding/projet-hyper-learning.pdf
http://ocsigen.org/theproject
Oscigen - "Fresh air in Web Programming"
http://ocsigen.org/
O'Browser http://ocsigen.org/obrowser/
@baryluk
baryluk / 85_releated.tex
Created December 1, 2011 05:29
References - X-to-JS langauges and utilities
\subsection{Related work}
There is many releated works in field of JS and HTTP extensions
which tries to remove some of the current limitations
of JS, similary as erljs tries to handle them in one way.
\begin{itemize}
\item Erjang (\url{http://wiki.github.com/krestenkrab/erjang/})
% http://www.javalimit.com/
-- complete reimplementation of Erlang Virtual Machine to run on top of Java platform.
@baryluk
baryluk / gist:ec0484295444c6bca9337c88b9739d86
Last active March 19, 2019 23:51
ordered vs unordered dequeue from the queue
Time: 3.133 ms
[local] baryluk@d=> EXPLAIN ANALYZE SELECT itemid FROM queue LIMIT 1;
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ QUERY PLAN │
├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Limit (cost=0.00..0.01 rows=1 width=4) (actual time=0.040..0.041 rows=1 loops=1) │
│ -> Seq Scan on queue (cost=0.00..1680786.04 rows=116492104 width=4) (actual time=0.039..0.039 rows=1 loops=1) │
│ Planning Time: 0.046 ms │
│ Execution Time: 0.050 ms │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────
@baryluk
baryluk / gist:b179e4dfc3ca54a6d4cc02ade0383c2f
Last active March 23, 2019 20:03
postgresql stats and settings after benchmark
mydb=> SELECT psut.schemaname, psut.relname,
to_char(psut.last_vacuum, 'YYYY-MM-DD HH24:MI') as last_vacuum,
to_char(EXTRACT(EPOCH FROM (NOW() - psut.last_vacuum))/60, '999,999,990.0') || ' min ago' as last_vacuum_ago,
vacuum_count,
to_char(psut.last_autovacuum, 'YYYY-MM-DD HH24:MI') as last_autovacuum,
to_char(EXTRACT(EPOCH FROM (NOW() - psut.last_autovacuum))/60, '999,999,990.0') || ' min ago' as last_autovacuum_ago,
autovacuum_count,
to_char(pg_class.reltuples, '9G999G999G999') AS n_tup,
to_char(psut.n_dead_tup, '9G999G999G999') AS dead_tup,
to_char(CAST(current_setting('autovacuum_vacuum_threshold') AS bigint)
@baryluk
baryluk / gist:fed99894c0e29894a0884013162f09fa
Last active March 25, 2019 08:33
pgbench scale 1000, clients 64, prepared statements, 8000 seconds
https://imgur.com/3mbDns1.png
PostgreSQL 11.2
Each pgbench run:
/usr/lib/postgresql/11/bin/pgbench --initialize --scale=10 --fillfactor=90 mydb # basically drop old tables
/etc/init.d/postgresql stop
/etc/init.d/postgresql start
/usr/lib/postgresql/11/bin/pgbench --initialize --scale=1000 --fillfactor=90 mydb
@baryluk
baryluk / mesa-build.py
Last active November 14, 2024 20:45
Build Mesa from git and libdrm git for Debian. amdgpu build 64-bit and 32-bit for Debian stable, testing and unstable, and possibly Ubuntu, Mint, PopOS, etc. No root required. (well sudo to install some build dependencies required tho). Currently a bit borked on Debian stable (requires newer meson).
#!/usr/bin/env python3
# A simple script to build 64-bit and 32-bit Mesa and libdrm on amd64 Debian
# stable, Debian testing, Debian unstable, and possibly some Ubuntu versions
# with some tweaks.
#
# libdrm is build too, because often version right now in Debian sid and experimental
# is too old for current mesa git repo. Also it is nice to build debug
# versions of libdrm when troubleshooting some crashes and bugs.
#

Blueprint book string

Collection of belt balancers. These balancers could originally be found on the wiki, now there are hosted here and on factorioprints.com.

Includes:

  • 12 to 4 throughput unlimited (all belt colors)
  • 12 to 6 (blue belt)
  • 12 to 12 (all belt colors)
  • 16 to 16 inline (blue belt)
  • 16 to 16 throughput unlimited (all belt colors)
@baryluk
baryluk / greate-lane-randomizer.blueprint.txt
Created November 24, 2019 17:04
Factorio. An fun experiment with using LFSR to randomize belt / lane content.
0eNrVnetuHEe6bN9Fv91C5Zf3/SqDgSBLbQ8xEiWQzcGZM9C7n5ZMUjyczmKssAxs7T+zbcnRUdmdGXWJWvmfV79+uDt+vrm6Pr36n/+8unr36fr21f/87T+vbq9+v3774eu/O/378/HV/7y6Oh0/vvrl1fXbj1//6be3t6fD6ebt9e3nTzenw6/HD6dXX355dXX9/vh/Xv1P+vL3X14dr09Xp6vjH3Lf/uHfb67vPv56vDn/hV2hX159/nR7/m8/XX/9/LPeocYvr/59/t+IL19++S+1cNXy2fL7q5vjuz/+NC5oZ6qddO1CtTddu0LtMnXtRrWHrt2pdte1B9Vuuvak2lXXThsVL0CczsWSgTidmgVMzUTnZgFzM9HJWcDkTHR2ZjA7E52eGUzPROdnBvMz0QmawQRNdIZmMEODztAMZmjQGZrBDA06QzOYoUFnaAYzNOgMzWCGBp2hAWZo0BkaYIYGnaEBZmjQGRpghgadoQFmaKYzNMAMzXSGBjkDpTM0wPTPdIbG9ngm/v+Jt0vixRVXnOMZmi47L5fEmyuuOKczNA0w5sMVV5zTGZqm7rxsrrhyqUVnaGrAebjiinM6Q1MHzosrrjinMzQV4Ly54opzPEMrcD5cccU5nqGhO6+bK67csMAzNAPn4YorzvEMBRlaiyuuOMczNAHnzRVXnNMZCiK0DlNb8U3nJwjQtpnayi0/OjtBfLYwtRXfdG6C8GzF1FZ84/u3wHcztRXfdF6C4GzD1FZ842tP3XffTG3ldjm+NwR8h6mt+IbzEiRmL5604hrnJbDdTG3FN5yV5Mc9PGnFNZyTYLDH5kkrD5ngjAQL9whPWnEN5yNYRkbxpBXXcD6Ck5LRPGnFNZyNICLH8KQV13A2ghPuuXnSymNZOBvB6d8MT1pxDWcjuaCcxdRWfMP5CC5uZvOkFddwPpJbJnOY2opvmo8gINO2meJSnwHOSnJjMG1hikvO6czMxHkxxSXncG6SG+Bpa6a45JzOz0qcD1Ncck5nKAj
@baryluk
baryluk / factorio_save_archiver.sh
Created November 29, 2019 17:00
Factorio autosave saver / archiver.
#!/bin/sh
# This script looks for new complete Factorio autosaves and archives
# them into current directory with date and time.
# Copyright: Witold Baryluk, 2019
if ! which inotifywait >/dev/null; then
echo "Please install inotify-tools first. Debian example: sudo apt install inotify-tools"
exit 1
fi
@baryluk
baryluk / divider.py
Created April 26, 2020 22:30
Divide a full circle into equal angles.
#!/usr/bin/env python3
# Divides a full circle into equal angles.
import math
for N in range(2, 27):
print(f"{N} divider:")
for i in range(N):
alpha = 360.0 * i / N