Skip to content

Instantly share code, notes, and snippets.

View alekssamos's full-sized avatar


View GitHub Profile
alekssamos /
Created February 24, 2024 10:57 — forked from zfarbp/
Golang - Building Executables for Different Architectures

Golang - Building Executables for Different Architectures

env GOOS=target-OS GOARCH=target-architecture go build package-import-path

# Example
env GOOS=darwin GOARCH=amd64 go build
env GOOS=darwin GOARCH=amd64 go build main.go
env GOOS=darwin GOARCH=amd64 go build
alekssamos /
Created February 23, 2024 09:41 — forked from dmfigol/
Python asyncio event loop in a separate thread
This gist shows how to run asyncio loop in a separate thread.
It could be useful if you want to mix sync and async code together.
Python 3.7+
import asyncio
from datetime import datetime
from threading import Thread
from typing import Tuple, List, Iterable
alekssamos /
Created November 14, 2023 16:31 — forked from un33k/
Performance Profile Decorator (function wrapper based on cProfile). Decorate any function to profile it.
import cProfile
def profileit(func):
Decorator (function wrapper) that profiles a single function
def func1(...)
# do something
alekssamos /
Created November 10, 2023 16:34 — forked from alexeygrigorev/
Track progress of ProcessPoolExecutor with tqdm
from glob import glob
import multiprocessing
from concurrent.futures import ProcessPoolExecutor
import cv2
from PIL import Image
import imagehash
from tqdm import tqdm
alekssamos / Cargo.toml
Created May 24, 2023 15:44 — forked from CoolOppo/Cargo.toml
How to compile to a DLL in rust while using it as a normal rust library
name = "test"
version = "0.1.0"
authors = ["YOU <>"]
edition = "2018"
crate-type = ["cdylib"]
alekssamos /
Last active February 18, 2023 11:31
How can I make a permanent (between restarts) set or any other object
from threading import Lock
import os, os.path
import dill as pickle
import dill.settings
from dill import FILE_FMODE
dill.settings.update({'byref': True, 'fmode': FILE_FMODE, 'recurse': True, 'ignore': True})
except ImportError:
import pickle
alekssamos /
Created February 3, 2023 15:40
Persistent queue with saving to disk (Python)
Persistent queue
A permanent queue with saving to disk. It is restored on restart.
Only waiting new elements that have not yet been taken into operation will be restored.
Persistent Queue « Python recipes « ActiveState Code
alekssamos /
Created November 12, 2022 13:10 — forked from erichschroeter/
Shell script implementation of a Queue.
# This script encapsulates the functionality of a queue. It requires there to be
# an input file with the data in the queue being separated on different lines.
alekssamos / Dockerfile
Created October 2, 2022 08:43 — forked from WoozyMasta/Dockerfile
An example of building a Python application into a self-contained statically linked binary and packaging it into a container image based on scratch
FROM AS build
WORKDIR "/app"
# Install dependecies
# hadolint ignore=DL3008,DL3013
RUN set -eux && \
apt-get update; \
apt-get install --no-install-recommends -y \
python3-dev build-essential patchelf upx; \
apt-get clean; \
alekssamos / supervisor
Created July 25, 2022 15:49 — forked from glarrain/supervisor
logrotate.d/supervisor: config file for logrotate for Supervisor logs (includes explanation of each directive)
/var/log/supervisor/*.log {
rotate 52