Skip to content

Instantly share code, notes, and snippets.

View gtors's full-sized avatar

Andrey Torsunov gtors

  • Russian Federation, Kazan
View GitHub Profile
@gtors
gtors / queues.io.md
Last active January 18, 2023 21:41
queues.io snapshot

Queues

Job queues, message queues and other queues. Almost all of them in one place.

About

There are many queueing systems out there. Each one of them is different and was created for solving certain problems. This page tries to collect the libraries that are widely popular and have a successful record of running on (big) production systems.

Feel free to add more resources to this page or clean it up!

[[Hacker News Comments on "From AST to Lossless Syntax Tree"|https://news.ycombinator.com/item?id=13628412]]

Other Names

  • RedBaron: Full Syntax Tree
  • Go: AST
    • [[Issue 20744: Free-floating comments are single-biggest issue when manipulating the AST|golang/go#20744]]
  • JavaScript: AST or CST
@gtors
gtors / worker_pool.go
Last active May 15, 2020 09:54
Go dynamic resizable worker pool
package main
import (
"sync"
"time"
)
type WorkerPool struct {
sync.Mutex
sync.WaitGroup
@gtors
gtors / gen_all.py
Created March 3, 2020 19:42
Auto generate __all__ variable
#!/usr/bin/env python3
import sys
# NOTE: redbaron have no full support of python3.7, so construction such as `foo = {**bar}` may cause crash
from redbaron import RedBaron
def generate_all_variable(file_name: str):
with open(file_name, 'r+') as src:
rb = RedBaron(src.read())
@gtors
gtors / migration.sql
Created February 12, 2020 09:22
PostgreSQL move all extensions into separate schema
DO $$
DECLARE
_name TEXT;
_ver TEXT;
BEGIN
-- Loop over all extensions in `public` schema (except timescaledb)
-- and move it into `ext` schema
FOR _name, _ver IN (
SELECT
extname,
@gtors
gtors / sketch.c
Last active January 4, 2020 20:23
NFC 3ka
//Access Control Reader based on ApplePay (EMV) and Troyka cards
#include <Adafruit_PN532.h>
// If using the breakout with SPI, define the pins for SPI communication.
#define PN532_SCK (2)
#define PN532_MOSI (3)
#define PN532_SS (4)
#define PN532_MISO (5)
// Use this line for a breakout with a software SPI connection (recommended):
@gtors
gtors / country-bounding-boxes.py
Created September 6, 2019 15:04 — forked from graydon/country-bounding-boxes.py
country bounding boxes
# extracted from http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_countries.zip
# under public domain terms
country_bounding_boxes = {
'AF': ('Afghanistan', (60.5284298033, 29.318572496, 75.1580277851, 38.4862816432)),
'AO': ('Angola', (11.6400960629, -17.9306364885, 24.0799052263, -4.43802336998)),
'AL': ('Albania', (19.3044861183, 39.624997667, 21.0200403175, 42.6882473822)),
'AE': ('United Arab Emirates', (51.5795186705, 22.4969475367, 56.3968473651, 26.055464179)),
'AR': ('Argentina', (-73.4154357571, -55.25, -53.628348965, -21.8323104794)),
'AM': ('Armenia', (43.5827458026, 38.7412014837, 46.5057198423, 41.2481285671)),
@gtors
gtors / ipsec.conf
Created May 19, 2019 20:20
linux strongswan client l2tp ipsec psk to windows server behind nat
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
ike=3des-sha1-modp1024!
esp=3des-sha1!
@gtors
gtors / gist:effe8eef7dbe7052b22a009f3c7fc434
Created December 10, 2018 12:57
Makefile -> compilation_commands.json
@gtors
gtors / celery_environ.py
Created October 31, 2018 12:24
Celery + Environ
# Celery (4.2)
# http://docs.celeryproject.org/en/latest/userguide/configuration.html
from datetime import timedelta
from libs.env import env
PREFIX = 'PRJ'
# General settings
CELERY_ACCEPT_CONTENT = env.list(
f'{PREFIX}_CELERY_ACCEPT_CONTENT', default=['json'])