Skip to content

Instantly share code, notes, and snippets.

View pzmarzly's full-sized avatar

Paweł Zmarzły pzmarzly

View GitHub Profile
@pzmarzly
pzmarzly / containers.json
Created September 24, 2023 02:01
Dagger microservice + DB
{
"node": {
"tag": "node:20-slim",
"uuid": "node@sha256:24a8b77508a4edaa99ef31f020e915da31c87068b4164d6746bf0c1684c71f98"
},
"postgres": {
"tag": "postgres:16",
"uuid": "postgres@sha256:1e90f8560705b0daccbd8eb25573627c8452fc9282496433aab1259ae4c85824"
},
"redis": {
@pzmarzly
pzmarzly / drop.rs
Created April 9, 2019 13:24
Rust dropping behavior test
struct T(String);
impl Drop for T {
fn drop(&mut self) {
println!("Dropping {}", self.0);
}
}
fn main() {
{
@pzmarzly
pzmarzly / lib.rs
Created April 6, 2019 16:57
!crates protocol - example code
use protocol_derive::Protocol;
use std::rc::Rc;
#[derive(Protocol, Debug, PartialEq)]
pub struct Health(pub u8);
#[derive(Protocol)]
pub struct Player {
pub name: String,
pub health: Rc<Health>,
#!/bin/bash
set -e
# we have files a.pdf and b.pdf
mkdir tmp
cd tmp
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOUTPUTFILE=a1.pdf -dFirstPage=1 -dLastPage=1 ../a.pdf
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOUTPUTFILE=a2.pdf -dFirstPage=2 -dLastPage=2 ../a.pdf
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOUTPUTFILE=b1.pdf -dFirstPage=1 -dLastPage=1 ../b.pdf
@pzmarzly
pzmarzly / pacman.conf
Created January 16, 2019 15:14
Some useful AUR build repos, to replace repo.itmettke.de
[herecura]
SigLevel = Never
Server = https://repo.herecura.be/herecura/x86_64/
[disastrousaur]
SigLevel = Never
Server = https://mirror.repohost.de/disastrousaur/
[dx37essentials]
SigLevel = PackageOptional
@pzmarzly
pzmarzly / latency.txt
Created December 30, 2018 18:14 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD

Keybase proof

I hereby claim:

  • I am pzmarzly on github.
  • I am pzmarzly (https://keybase.io/pzmarzly) on keybase.
  • I have a public key ASAL2siJMVlE6bSF0oFdX0ItcK5hBxXCw5EH3PX2yazosgo

To claim this, I am signing this object:

@pzmarzly
pzmarzly / qemu.sh
Created January 30, 2018 14:27
QEMU gpu acceleration
qemu-system-i386 -machine accel=kvm -smp 1,cores=4,maxcpus=4 -m 1024 -vga virtio -display sdl,gl=on -soundhw hda file.iso
@pzmarzly
pzmarzly / LIST.md
Last active November 29, 2017 22:26
Degooglifying and privacy

List of alternatives:

  • Google - YaCy (P2P), Seeks (P2P?), searx (self-hosted aggregator of 70 search engines)
  • G+ - ZeroTalk (P2P), Diaspora (decentralized)
  • GMail - ProtonMail (since self-hosted solutions are blocked by bigger mail providers)
  • Hangouts - Tox Chat (P2P), Ring (P2P), Retroshare (P2P), Bitmessage (P2P, only text & images), Mumble (self-hosted), Teamspeak (non-free but self-hosted), Rocket Chat (has voice/video calls, self-hosted)
  • Google Play - Uptodown, Aptoide, APKpure, F-Droid, Yalp Store
  • Android - custom ROMs, Replicant, Sailfish OS, Tizen (not ready for most phones), MeeGo (check out neo700 . org, open source, open hardware phone made in US&Germany)
  • Google Drive - ownCloud/nextCloud (self-hosted), Retroshare (P2P), maybe MEGA/pCloud, maybe Filecoin once it's ready
  • Google for Work - Retroshare (P2P), Kolab Now
  • Google Docs - OnlyOffice (offline), LibreOffice (offline) EtherPad (self-hosted), CryptPad
@pzmarzly
pzmarzly / jekyll-compress-html-simple.html
Last active March 17, 2018 15:55
A Jekyll layout which removes space indentations and newlines from HTML but leaves embedded scripts unchanged. I wrote this because https://github.com/penibelst/jekyll-compress-html broke my JS code. It DOESN'T work perfectly, sometimes if indentation is big (12+ characters) it removes only first 8-12 spaces.
---
# Simple HTML Compressor for Jekyll/Liquid
# removes x4 spaces indentation and newlines
# lefts scripts untouched
# check is newline character between two "a" characters a correct \n for your site (Windows or Unix newline character)
# licensed MIT
# 2015 Paweł Zmarzły
---
{% capture lines %}a
a{% endcapture %}{% assign newline = lines | remove: "a" %}{% assign content_lines = content | split: newline %}{% for curr_line in content_lines %}{% if curr_line contains '<script' %}{% assign need_line = true %}{% endif %}{% if curr_line contains '</script' %}{% assign need_line = false %}{% endif %}{% if need_line %}{{curr_line}}{{newline}}{% else %}{{curr_line | replace: " ", " "}}{% endif %}{% endfor %}