Skip to content

Instantly share code, notes, and snippets.

View olned's full-sized avatar
🏠
Working from home

Oleg Nedbaylo olned

🏠
Working from home
  • Vrhnika, Slovenia
View GitHub Profile
@olned
olned / Taskfile
Last active June 5, 2024 07:04
Taskfile golang-migrate docker
version: '3'
tasks:
migrate-up:
dir: "{{.TASKFILE_DIR}}/"
cmds:
- docker run -v ./migrations:/migrations --user $(id -u):$(id -g) --network host migrate/migrate -path /migrations -database ${DATABASE_URL} up
description: "Apply all up migrations"
migrate-down:
dir: "{{.TASKFILE_DIR}}/"
@olned
olned / signal_handler.hpp
Last active November 12, 2020 15:47
SignalHandler Singleton C++
class SignalHandler {
public:
using Handler = std::function<void(int)>;
SignalHandler(const SignalHandler &) = delete;
SignalHandler &operator=(const SignalHandler) = delete;
static void process(int sig)
{
for (const auto &f : handler().handlers_)
@olned
olned / create_console_app.sh
Last active August 29, 2020 12:22
C# Create .Net ConsoleApp
#!/bin/bash
set -ex;
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd ${DIR}
SLNNAME=${PWD##*/}
APPNAME=src/${SLNNAME}App
LIBNAME=src/${SLNNAME}Lib
TESTNAME=test/${SLNNAME}.Tests
@olned
olned / __init__.py
Last active April 2, 2020 10:15
External function call
#
@olned
olned / asyncio_signal_handler.py
Created August 27, 2019 16:39
Handle a signal in an asyncio python app
import asyncio
import functools
import signal
async def my_task(task_num):
try:
while True:
print(f'Task {task_num}')
await asyncio.sleep(task_num + 1)