Skip to content

Instantly share code, notes, and snippets.

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
View snippet.sql
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
View snippet.py
%load_ext autoreload
%autoreload 2
@avshyz
avshyz / snippet.zsh
Created June 24, 2020 14:43
[Alembic Version Control]
View snippet.zsh
alembic upgrade +2
alembic downgrade -1
alembic downgrade HASH+2
@avshyz
avshyz / snippet.zsh
Created June 24, 2020 14:43
[Alembic DB Upgrade] #migration
View snippet.zsh
alembic revision -m "REVISIONNAME" --autogenerate
alembic upgrade head
@avshyz
avshyz / snippet.zsh
Created June 24, 2020 14:37
[Ephemeral Docker] #docker
View snippet.zsh
docker run -it --rm nginx:1.16.0-alpine /bin/sh