Skip to content

Instantly share code, notes, and snippets.

Having (YET another) kidney stone surgery in a few days...

Rogério Brito rbrito

Having (YET another) kidney stone surgery in a few days...
View GitHub Profile
dabeaz /
Created Oct 17, 2019
"Build Your Own Async" Workshop - PyCon India - October 14, 2019 -
# Async Producer-consumer problem.
# Challenge: How to implement the same functionality, but no threads.
import time
from collections import deque
import heapq
class Scheduler:
matthieuheitz /
Last active Jun 26, 2021
djvu2pdf, a conversion script using ocrodjvu and pdfbeads
# Method found here
# Dependencies:
# On ubuntu, you can install ocrodjvu and pdfbeads with:
# sudo apt install ocrodjvu
# gem install pdfbeads
# The path and filename given can only contain ascii characters
View ctx_clock.c
* ctx_time Copyright (C) 2018 Matteo Croce <>
* a tool measure the context switch time in clock cycles
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <limits.h>
#include <string.h>
agentcooper /
Last active Oct 16, 2021
Telegram chat backup/export

How to use

  1. Login to
  2. Copy-paste contents of telegram-scripts.js into JS console
  3. Run showContacts() to get the list of contacts with ids
  4. Run saveChat(userId) where userId is the id from step 3

Process can take a while, check console for progress. Occasionall FLOOD_WAIT errors are expected. Once done, browser will download the JSON file.


otsaloma / remove-duplicate-subs
Last active Jun 25, 2017
Remove duplicate subtitles with aeidon
View remove-duplicate-subs
#!/usr/bin/env python3
import aeidon, sys, time
if len(sys.argv) < 2:
print("Usage: {} SUBTITLE_FILE...".format(__file__))
raise SystemExit(1)
for fname in sys.argv[1:]:
project = aeidon.Project()
project.open_main(fname, "utf_8")
before = len(project.subtitles)
meagtan / galois.c
Last active Jun 6, 2021
Quick implementation of Galois fields
View galois.c
* The following is an implementation of the finite field GF(2^8) as bit vectors of length 8, where the nth bit represents the
* coefficient of the nth power of the generator in each element, and the generator satisfies the minimal polynomial
* x^8 + x^4 + x ^3 + x^2 + 1 in the prime field Z_2, in which addition is equivalent to XOR and multiplication to AND.
* The elements of GF(2^8) thus represent polynomials of degree < 8 in the generator x. Addition in this field is simply
* bitwise XOR, but multiplication requires the elimination of powers of x <= 8.
#include <stdio.h>
#include <stdint.h>
CMCDragonkai /
Last active Oct 20, 2021
Linux: Understanding the Memory Layout of Linux Executables

Understanding the Memory Layout of Linux Executables

Required tools for playing around with memory:

  • hexdump
  • objdump
  • readelf
  • xxd
  • gcore
bishboria /
Last active Oct 16, 2021
Springer made a bunch of books available for free, these were the direct links
vlakoff / convert_lz4_header.php
Last active Aug 13, 2021
Convert from Mozilla's LZ4 format to LZ4 v1.3
View convert_lz4_header.php
* Convert from Mozilla's LZ4 format to LZ4 v1.3
* @link
* @link
* @param string $input File content in Mozilla's LZ4 format
* @return string File content converted to LZ4 v1.3
View zram_combined_benchmark
~ # /tmp/ test6 /tmp/ffmpeg-1\:2.6.1-1-x86_64.pkg.tar
zram test6 Sat Apr 4 09:50:06 GMT 2015
comp_algorithm [lzo] lz4 snappy
real 0m 0.20s 0.20s 0.24s avg: 0.214s
real 0m 1.45s 1.42s 1.42s avg: 1.430s
compr_data_size 30504972 30504968 30504947 30504962
comp_algorithm lzo [lz4] snappy