Skip to content

Instantly share code, notes, and snippets.

View spaskalev's full-sized avatar

Stanislav Paskalev spaskalev

  • Plovdiv, Bulgaria
  • 09:28 (UTC +03:00)
  • LinkedIn in/spaskalev
View GitHub Profile
@spaskalev
spaskalev / duplex_print_range.py
Created April 24, 2022 07:44
Duplex printing aid for non-duplex printers
#!/usr/bin/env python3
# Duplex printing aid for non-duplex printers
#
# This tool splits page ranges into odd and even page numbers.
# Print the first set in one go, feed the paper back and print the second set.
import os
import sys
@spaskalev
spaskalev / main.c
Created June 14, 2021 21:02
A forking writer pattern, e.g. a transaction processor with eventually-consistent non-blocking readers
#define _GNU_SOURCE
#include <unistd.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <stdio.h>
#include <stdlib.h>
@spaskalev
spaskalev / main.c
Created June 13, 2021 20:27
copy on write example with mmap in the same process
#include <sys/mman.h>
#include <unistd.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
char *hello = "Hello world!\n";
@spaskalev
spaskalev / gist:70a72be73f8db67e3146c44b9c377c83
Created September 7, 2020 18:58
remote keyboard on LibreELEC from another linux box
#
# NOTE: make sure to update the device paths on both scripts
#
#
# server - run this on LibreELEC via /storage/.config/autostart.sh
#
#!/bin/sh
@spaskalev
spaskalev / zram.sh
Created July 13, 2017 20:12 — forked from sultanqasim/zram.sh
ZRAM config for Raspberry Pi 3
#!/bin/bash
# Raspberry Pi ZRAM script
# Tuned for quad core, 1 GB RAM models
# put me in /etc/init.d/zram.sh and make me executable
# then run "sudo update-rc.d zram.sh defaults"
modprobe zram
echo 3 >/sys/devices/virtual/block/zram0/max_comp_streams
echo lz4 >/sys/devices/virtual/block/zram0/comp_algorithm