Skip to content

Instantly share code, notes, and snippets.

jftuga / all_remove_python_venv.ps1
Last active May 19, 2021
remove Python 3.9 Virtual Environment on Windows 10
View all_remove_python_venv.ps1
# this will remove:
# Python venv
# PyCharm .idea folder
rm -r -fo .\pyvenv.cfg,.\Include\,.\Scripts\,.\__pycache__\,.\.idea\
rm -r -fo .\Lib\
jftuga /
Created May 19, 2021 — forked from bhtucker/
A demonstration of Postgres upserts in SQLAlchemy
Upsert gist
Requires at least postgres 9.5 and sqlalchemy 1.1
Initial state:
Initial upsert:
jftuga /
Created May 19, 2021 — forked from malexer/
Modelling UPSERT in SQLAlchemy (well actually it is not upsert but speed improvement is significant in comparison with simple session.merge)
# Note: it is a copy of great answer by "mgoldwasser" from Stackoverflow
# Check the original answer here:
# Imagine that post1, post5, and post1000 are posts objects with ids 1, 5 and 1000 respectively
# The goal is to "upsert" these posts.
# we initialize a dict which maps id to the post object
my_new_posts = {1: post1, 5: post5, 1000: post1000}
for each in posts.query.filter(
jftuga /
Created May 19, 2021 — forked from DmitryBe/
SQLAlchemy quick start
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine
from datetime import datetime, timedelta
from sqlalchemy import Table, Column, Integer, String, DateTime, ForeignKey
from sqlalchemy.orm import relationship, backref
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
View - Use AWS SQS as a clipboard to copy and paste across different systems and platforms - A cross-platform TCP port forwarder with Duo 2FA and Geo-IP integration - Quickly get AWS spot instance pricing - Return IP address info including geographic location and distance when given IP address, email address, host name or URL - Resize photo ID images using face recognition technology

jftuga / compare_dt_libs.go
Last active Apr 20, 2021
comparing go date/time libraries
View compare_dt_libs.go
// compare_dt_libs.go
// comparing go date/time libraries
package main
import (
jftuga /
Last active Jun 18, 2021
Compiling Python 3.9 on Debian Buster or Raspberry Pi OS

Tested with Python 3.9.5 on Raspbian GNU/Linux 10 (buster)

apt install -y libbz2-dev libffi-dev libffi-dev libgdbm-compat-dev libgdbm-dev liblzma-dev libncurses-dev \
    libncurses5-dev libnss3-dev libreadline-dev libsqlite3-dev libssl-dev uuid-dev zlib1g-dev
./configure --prefix=/opt
# edit Makefile to remove `-g -Wall`
jftuga /
Last active Jun 2, 2021
Using the LESS environment variable

set LESS environment variable to: -SXIFR

  • -S: chop lines, side scroll with left/right arrow keys
  • -X: leave contents on screen when less exits
  • -I: ignore case
  • -F: quit immediately when the entire file fits in one screen
  • -R: enable colored output


jftuga / bounded.go
Created Feb 14, 2021
Go Concurrency Patterns: Pipelines and cancellation
View bounded.go
// Copied from:
package main
import (