Skip to content

Instantly share code, notes, and snippets.

View remidinishanth-ntnx's full-sized avatar
🎯
Focusing

N̷̪̞͈̓̀̒ͅi̵̩̺̋̊̀̆̿̂͊̇s̷͚͕͙͈̙̻̀̓͛̇͐͗̿̈̿͠ͅḧ̵͍̻́̑̽̆̇͂̈̈́a̴̧̡͈̥̜͑̄͆ͅń̶̨̧̹̤͍̹̙͛̓͘͜ͅt̵͖̳̣͎̦̰̱̖̬̐̐̓͂͆͠ͅh̴̢̨̛͇̘̪͖̼͚̋̌͂̀̅̍̀̕̚ͅͅ ̷̹͕̩̮̇̾̈̈̐͝ͅR̸͖̀͊̀̎͊́͛̒͘͘ę̴̟͍̣̻͈̮̝̫̞͘d̴͓̺̺̙͖̥̫̣͕̈́͛̅̍͑d̶̜̰̠͓̦̳̟̤̀̿̕y̵̩̮̿̎͐̍̃̃̚͝͠ remidinishanth-ntnx

🎯
Focusing
  • Nutanix
  • India
View GitHub Profile
@sandys
sandys / Fastapi-sqlalchemy-pydantic-dataclasses-reloadable-logging.md
Last active April 12, 2024 01:38
fastapi with python 3.10 dataclasses - used to create both sqlalchemy and pydantic models simultaneously. And setting up sqlalchemy the right way (without deadlocks or other problems). Additionally, this also takes care of unified logging when running under gunicorn..as well as being able to run in restartable mode.
@thehesiod
thehesiod / async_worker_pool.py
Last active June 30, 2023 11:01
Asynchronous Worker Pool, allows for limiting number of concurrent tasks
import asyncio
from datetime import datetime, timezone
import os
def utc_now():
# utcnow returns a naive datetime, so we have to set the timezone manually <sigh>
return datetime.utcnow().replace(tzinfo=timezone.utc)
class Terminator:
pass
@squarism
squarism / iterm2.md
Last active April 23, 2024 11:45
An iTerm2 Cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
@duckythescientist
duckythescientist / periodic.py
Created July 10, 2015 17:58
Periodically run Python function asynchronously in the background of a script
#!/usr/bin/env python2
from threading import Event, Thread
class Periodic(object):
"""Periodically run a function with arguments asynchronously in the background
Period is a float of seconds.
Don't expect exact precision with timing.
Threading is used instead of Multiprocessing because we need shared memory
@cypreess
cypreess / periodic_thread.py
Last active February 28, 2024 02:59
Python periodic thread using timer. You can cancel this thread any time. Thread will live at maximum to the end of one single processing run, otherwise it will end in the same time (especially during a wait time for next run). This code avoids the problem of waiting very long for thread exiting, because it does not uses time.sleep(). Please be a…
import logging
import threading
class PeriodicThread(object):
"""
Python periodic Thread using Timer with instant cancellation
"""
def __init__(self, callback=None, period=1, name=None, *args, **kwargs):