Skip to content

Instantly share code, notes, and snippets.

View KristobalJunta's full-sized avatar
🇺🇦

Eugene KristobalJunta

🇺🇦
View GitHub Profile
@KristobalJunta
KristobalJunta / .celery timezones.md
Last active June 21, 2022 15:29
Example for Celery 4.4.0 with timezoned beat task

Example for timezoned beat task with Celery 4.4.0. Two ways to create datetime object inside crontab's nowfun that seemingly produce same result actually behave differentlty.

const dino = `
__
/ _)
_.----._/ /
/ /
__/ ( | ( |
/__.-'|_|--|_|
`
console.log(dino)
@KristobalJunta
KristobalJunta / progress.py
Created February 18, 2022 09:38
Simple progress indicator in python (string rewrites itself)
from time import sleep
n = 10
for i in range(n + 1):
print(f"\rsleeping ... {i} / {n}", end="\r")
sleep(.5)
print()
@KristobalJunta
KristobalJunta / telegram-stickers-converter.sh
Last active January 2, 2022 15:15
A simple script to batch convert images to telegram sticker accepted format, dimensions & file size
#!/bin/bash
# requiements:
# - imagemagick
# - pngquant
# - npm and renamer package
# convert jpg files to png
for f in *.jpg; do
@KristobalJunta
KristobalJunta / split_csv.py
Created June 1, 2021 14:57
Fast (probably) splitting of csv files by number of rows (accounts for linebreaks inside cell values)
#!/usr/bin/env python2
import os
import sys
def split(filehandler, delimiter=',', row_limit=700000,
output_name_template='output_%s.csv', output_path='.', keep_headers=True):
import csv
reader = csv.reader(filehandler, delimiter=delimiter)
current_piece = 1
@KristobalJunta
KristobalJunta / display-layout.sh
Created December 14, 2016 12:59
A script to display current keyboard layout in i3status
#!/bin/bash
# a shell scipt to prepend i3status with more stuff
i3status --config ~/.i3status.conf | while :
do
read line
LG=$(setxkbmap -query | awk '/layout/{print $2}')
echo "LG: $LG | $line" || exit 1
done
@KristobalJunta
KristobalJunta / pyproject.sample.toml
Created April 24, 2020 07:36
Sample pyproject file with the fields used for PyPi metadata
[tool.poetry]
name = "poetry_tutorial_project"
version = "0.1.0"
description = "Simple Python project built with Poetry."
authors = ["Todd Birchard <toddbirchard@gmail.com>"]
maintainers = ["Todd Birchard <toddbirchard@gmail.com>"]
license = "MIT"
readme = "README.md"
homepage = ""
repository = "https://github.com/hackersandslackers/python-poetry-tutorial/"
@KristobalJunta
KristobalJunta / pyproject.toml
Created March 6, 2020 09:57
This set of dependencies makes poetry resolve them for a very long time
[tool.poetry]
name = "example_project"
version = "0.1.0"
description = "Dependencies for this resolve for eternity"
authors = []
[tool.poetry.dependencies]
python = "^3.5"
awscli = "^1.15"
google-api-python-client = "^1.7.4"
@KristobalJunta
KristobalJunta / heididecode.py
Last active October 29, 2019 10:05
Decode passwords stored in HeidiSQL
#!/usr/bin/env python
from __future__ import print_function
import sys
def heidi_decode(hexstr):
shift = int(hexstr[-1])
l = [int(hexstr[i:i+2], 16) for i in range(0, len(hexstr), 2)]
return ''.join(chr(v - shift) for v in l)