Skip to content

Instantly share code, notes, and snippets.

View arvenil's full-sized avatar
Looking for project

Kamil Dziedzic arvenil

Looking for project
View GitHub Profile
arvenil / port.go
Created September 3, 2021 12:23
// Package port allows to obtain a free port that is ready to use.
package port
import (
// New returns a free open port that is ready to use.
arvenil /
Last active August 15, 2023 14:14
SKIP LOCKED with partitioned table

Create data table and partition it by state

   id bigserial not null,
   state smallint not null DEFAULT 1,
   updated_at timestamp without time zone default now()
) partition by list(state);
create table data_pending partition of data for values in (1);
create table data_processing partition of data for values in (2);

Keybase proof

I hereby claim:

  • I am arvenil on github.
  • I am arvenil ( on keybase.
  • I have a public key whose fingerprint is 6219 08B1 B833 37F3 C040 BB32 9B2A 8BE3 2C07 EA6C

To claim this, I am signing this object:

arvenil /
Created December 21, 2016 18:03 — forked from gavinandresen/
O(1) block propagation

O(1) Block Propagation

The problem

Bitcoin miners want their newly-found blocks to propagate across the network as quickly as possible, because every millisecond of delay increases the chances that another block, found at about the same time, wins the "block race."

arvenil /
Created September 3, 2014 16:10
Recommendation: Michał Górski
$ /usr/bin/ --help
"Michał Górski is an ambitious developer who isn't scared by any work.
Just provide him with some challenges and watch how magic happens.
You will be impressed how quick, creative and thoughtful this person is."
--do-awesome=<work_to_be_done> Do work and provide awesome results
--do-crap=<work_to_be_done> Do work and provide crappy results
--help Read about the only developer you need
arvenil /
Last active August 29, 2015 14:04 — forked from livibetter/
Fix for "08: value too great for base", works for versions with numbers only (no letters, no rc suffixes)
# Copyright (c) 2012 Yu-Jie Lin
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is furnished to do
# so, subject to the following conditions:
// Let's create /tmp/ninja-lock1.txt ...
$fp0 = fopen('/tmp/ninja-lock1.txt', 'c');
// ... and close it imiedietly
// File handler $fp0 was closed so flock()
// is unable to use it to gain lock.
// It will fail with wouldblock set to 0
// as it doesn't make sense to wait on unusable file handle.