Skip to content

Instantly share code, notes, and snippets.

View avshyz's full-sized avatar

Avishay Zarad avshyz

  • Singular Labs Inc.
  • Tel Aviv
View GitHub Profile
@avshyz
avshyz / snippet.sql
Last active June 30, 2020 12:03
[Postgres Delete Locks] delete all hang queries #postgres #db
SELECT pg_terminate_backend(b.pid)
from (SELECT pid,
now() - pg_stat_activity.query_start AS duration,
query,
state
FROM pg_stat_activity
WHERE (now() - pg_stat_activity.query_start) > interval '5 minutes') as b
where pid <> pg_backend_pid();
@avshyz
avshyz / snippet.py
Created June 24, 2020 14:44
[Jupyter Autoreload] #python #jupyter
%load_ext autoreload
%autoreload 2
@avshyz
avshyz / snippet.zsh
Created June 24, 2020 14:43
[Alembic Version Control]
alembic upgrade +2
alembic downgrade -1
alembic downgrade HASH+2
@avshyz
avshyz / snippet.zsh
Created June 24, 2020 14:43
[Alembic DB Upgrade] #migration
alembic revision -m "REVISIONNAME" --autogenerate
alembic upgrade head
@avshyz
avshyz / snippet.zsh
Created June 24, 2020 14:37
[Ephemeral Docker] #docker
docker run -it --rm nginx:1.16.0-alpine /bin/sh