Skip to content

Instantly share code, notes, and snippets.

Avatar

Witold Baryluk baryluk

View GitHub Profile
@baryluk
baryluk / squashfs.txt
Created Jul 24, 2020
squashfs compression tests using mksquashfs - xz, gzip, zstd, lz4, lz4hc, lzo
View squashfs.txt
Just a quick test of squashfs compression ratio using different settings.
I am looking for relatively good and fast compression, that also is quick to decompress.
I don't care about ultimate end size exactly tho.
Input (a Debian testing live build with 6240 installed packages):
$ sudo du -bs ./chroot
26566785410 ./chroot # 26.6GB
$
@baryluk
baryluk / sizes.txt
Last active May 19, 2020
Minimal betterC example
View sizes.txt
#!/bin/sh
time g++-10 -Os -g0 -fno-exceptions -fomit-frame-pointer miniCPP.cpp -o miniCPP_gcc
time gcc-10 -Os -g0 -fno-exceptions -fomit-frame-pointer miniC.c -o miniC_gcc
time clang++-10 -Os -g0 -fno-exceptions -fomit-frame-pointer miniCPP.cpp -o miniCPP_clang
time clang-10 -Os -g0 -fno-exceptions -fomit-frame-pointer miniC.c -o miniC_clang
time dmd -betterC -O -inline -release -of=miniD_dmd miniD.d
time gdc-10 -Os -g0 -frelease -fno-weak -fno-moduleinfo -fomit-frame-pointer -fno-druntime -o miniD_gdc10 miniD.d
time ldc2 --Os --release --betterC -of=miniD_ldc2 miniD.d
View gist:1e44595acad20039b4ac7fe0cde829ef
_D3std5stdio__T8writeflnTaTiZQoFNfxAaiZv
_D3rcu__T3RCUTSQn1AZQl15reader_accessorMFNbZSQBr__TQBqTQBpZQBy12RCU_Accessor
_D3std8datetime9stopwatch9StopWatch6__ctorMFNbNcNiNfEQBz8typecons__T4FlagVAyaa9_6175746f5374617274ZQBfZSQDyQDxQDrQDk
_D4core4time8Duration__T8opBinaryVAyaa1_2bTSQBqQBoQBmZQBeMxFNaNbNiNfQzZQBc
_D4core4sync5mutex5Mutex__T12lock_nothrowTOCQBqQBoQBmQBjZQBeMOFNbNiNeZv
_D4core8internal5array8capacity__T22_d_arraysetlengthTImplHTAPmTQdZ18_d_arraysetlengthTFNaNbNeMNkKQBmmZm
_D3std6random__T7uniformVAyaa2_5b29TiTiTSQBnQBm__T21MersenneTwisterEngineTkVmi32Vmi624Vmi397Vmi31Vki2567483615Vmi11Vki4294967295Vmi7Vki2636928640Vmi15Vki4022730752Vmi18Vki1812433253ZQFcZQGoFNaNfiiKQGbZi
_D3std5array__TQjTSQr5range__T4TakeTSQBjQt__T9GeneratorS_D3rcu8gen_listFZ9__lambda1FNfZiZQBsZQClZQDnFNfQDhZAi
_D3std5range__T9GeneratorS_D3rcu8gen_listFZ9__lambda1FNfZiZQBs8popFrontMFNfZv
@baryluk
baryluk / divider.py
Created Apr 26, 2020
Divide a full circle into equal angles.
View divider.py
#!/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
@baryluk
baryluk / factorio_save_archiver.sh
Created Nov 29, 2019
Factorio autosave saver / archiver.
View factorio_save_archiver.sh
#!/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 / greate-lane-randomizer.blueprint.txt
Created Nov 24, 2019
Factorio. An fun experiment with using LFSR to randomize belt / lane content.
View greate-lane-randomizer.blueprint.txt
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
View Bilka's Belt Balancers - Big Ones.md

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 / mesa-build.sh
Last active Dec 1, 2020
Mesa git amdgpu build 64-bit and 32-bit for Debian testing and unstable, and possibly Ubuntu and Mint, etc
View mesa-build.sh
#!/bin/bash
# A simple script to build 64-bit and 32-bit Mesa and vkpipeline-db
# on amd64 Debian testing, Debian unstable, and possibly some Ubuntu
# with some tweaks.
#
# A situation with LLVM on Ubuntu was (is?) not perfect, so you are on your own.
#
# If you don't want to or cant use it, modify the script to install and use
# other LLVM and update LLVMVERSION variable below.
@baryluk
baryluk / gist:fed99894c0e29894a0884013162f09fa
Last active Mar 25, 2019
pgbench scale 1000, clients 64, prepared statements, 8000 seconds
View gist:fed99894c0e29894a0884013162f09fa
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 / gist:b179e4dfc3ca54a6d4cc02ade0383c2f
Last active Mar 23, 2019
postgresql stats and settings after benchmark
View gist:b179e4dfc3ca54a6d4cc02ade0383c2f
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)
You can’t perform that action at this time.