Skip to content

Instantly share code, notes, and snippets.

View diegogslomp's full-sized avatar
🛸

Diego Gobbi Slomp diegogslomp

🛸
View GitHub Profile
@diegogslomp
diegogslomp / worker.py
Last active September 15, 2023 23:15
Python worker for sync and async tasks
from asyncio import Queue
import asyncio
import random
import time
async def worker_for_sync_task(name: str, queue: Queue, task) -> None:
while True:
item = await queue.get()
loop = asyncio.get_event_loop()
@diegogslomp
diegogslomp / docker-compose.yml
Last active February 17, 2023 13:41
jbpm-server-full with remote postgres and persistence
version: "3.1"
services:
jbpm:
image: jboss/jbpm-server-full:latest
environment:
JBPM_DB_DRIVER: postgres
JBPM_DB_HOST: jbpmdb
JBPM_DB_PASSWORD: jbpmpass
ports:
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; AutoHotkey Media Keys
!z::Send {Media_Prev}
!x::Send {Media_Play_Pause}
!c::Send {Media_Stop}
!v::Send {Media_Next}
@diegogslomp
diegogslomp / telegram_bot.py
Last active January 3, 2023 01:47
Chat GPT answer to 'write a telegram bot'
import logging
import telegram
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
# Enable logging
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)
logger = logging.getLogger(__name__)
#!/usr/bin/env bash
set -euo pipefail
last_go_version() {
curl -s https://go.dev/dl/ |
grep linux-amd64 |
grep span |
awk -F">" '{ print $2 }' |
awk -F"<" '{ print $1 }'
}
@diegogslomp
diegogslomp / supervisord.conf
Created July 12, 2022 21:11
Minimal docker samba supervisord
[supervisord]
nodaemon=true
[program:samba]
command=samba -F
autorestart=true
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
stderr_logfile=/dev/fd/2
stderr_logfile_maxbytes=0
#!/usr/bin/env bash
CHAT_ID=
TOKEN=
TEXT=$*
URL="https://api.telegram.org/bot${TOKEN}/sendMessage"
curl -s -X POST "${URL}" -d chat_id="${CHAT_ID}" -d text="${TEXT}"
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
; AutoHotkey Media Keys
!z::Send {Media_Prev}
!x::Send {Media_Play_Pause}
!c::Send {Media_Stop}
!v::Send {Media_Next}
!Left::Send {Volume_Down}
!Down::Send {Volume_Mute}
!Right::Send {Volume_Up}
@diegogslomp
diegogslomp / settings.json
Created October 27, 2021 23:01
vscode settings
{
"terminal.integrated.fontSize": 14,
"workbench.iconTheme": "material-icon-theme",
"workbench.startupEditor": "newUntitledFile",
"polacode.backgroundColor": "#6633CC",
"editor.tabSize": 2,
"editor.fontSize": 14,