Skip to content

Instantly share code, notes, and snippets.


Vinay Sajip vsajip

View GitHub Profile
from __future__ import annotations
import asyncio
import datetime
import sys
import time
from import App, ComposeResult
from textual.containers import Container, Horizontal, Vertical
from textual.widgets import DataTable, Footer, Label
vsajip /
Created December 16, 2022 21:26 — forked from walkermatt/
A debounce function decorator in Python similar to the one in underscore.js, tested with 2.7
from threading import Timer
def debounce(wait):
""" Decorator that will postpone a functions
execution until after wait seconds
have elapsed since the last time it was invoked. """
def decorator(fn):
def debounced(*args, **kwargs):
def call_it():
vsajip / msg373145.rst
Created October 22, 2022 12:36 — forked from zzzeek/msg373145.rst
asyncio support for SQLAlchemy (and Flask, and any other blocking-IO library)
View msg373145.rst

This is a cross post of something I just posted on the Python bug tracker at

I seem to have two cents to offer so here it is. An obscure issue in the Python bug tracker is probably not the right place for this so consider this as an early draft of something that maybe I'll talk about more elsewhere.

> This basically divides code into two islands - async and non-async

vsajip /
Last active October 3, 2022 14:51
Test files for CPython gh-84532
import datetime
import logging
import logging.handlers
import time
d0 =
dt0 = datetime.datetime(d0.year, d0.month,
def message(fmt, *args, **kwargs):
t = time.time() - dt0
vsajip / activate.bat
Created September 20, 2022 09:49
Eryk Sun's activate/deactivate batch scripts
View activate.bat
@setlocal EnableExtensions EnableDelayedExpansion
@REM Set VIRTUAL_ENV and VIRTUAL_ENV_PROMPT to the UTF-8 encoded parameters.
@REM CMD decodes line by line, so switch to UTF-8 (65001) temporarily.
@for /f "tokens=2 delims=:." %%a in ('"%SystemRoot%\System32\"') do @(
set "_OLD_CODEPAGE=%%a"
@if defined _OLD_CODEPAGE (
"%SystemRoot%\System32\" 65001 > nul
vsajip /
Created August 26, 2022 22:28 — forked from anonymous/
Test script showing usage of a buffering SMTP handler.
#!/usr/bin/env python
# Copyright 2001-2002 by Vinay Sajip. All Rights Reserved.
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permission notice appear in
# supporting documentation, and that the name of Vinay Sajip
# not be used in advertising or publicity pertaining to distribution
vsajip / Server.kt
Created June 9, 2022 15:56 — forked from Silverbaq/Server.kt
A simple socket-server written in Kotlin
View Server.kt
package dk.im2b
import java.nio.charset.Charset
import java.util.*
import kotlin.concurrent.thread
vsajip /
Created May 14, 2022 12:00
For Opalstack, configure Nginx and Apache proxy-port "private stack" applications to proxy to a static site with or without PHP.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2022 Red Dove Consultants Limited.
# License: Apache 2.0, see
# Gratefully based on work by Ryan Sanden and Sean Fulmer at
vsajip / test-detached-verification.bash
Created May 7, 2022 23:26
Test GnuPG verification of a detached signature
View test-detached-verification.bash
command_status() {
if [ $1 = '0' ]; then
echo $'\e[1;32m'Result: Success$'\e[0m'
echo $'\e[1;31m'Result: Failure \(exit code = $1\)$'\e[0m'
rm -rf keys
View wordle-nyt-allowed-guesses.txt