Skip to content

Instantly share code, notes, and snippets.

View Relrin's full-sized avatar

Valeryi Savich Relrin

  • Stockholm, Sweden
  • 01:23 (UTC +02:00)
View GitHub Profile
@Relrin
Relrin / postgresql_profiling.txt
Last active June 20, 2018 08:40
Profiling PostgreSQL queries
1) In psql tool find the path to configuration file:
SHOW config_file;
2) In config:
shared_preload_libraries = 'pg_stat_statements'
3) After it restart the node via using `service postgresql restart`
4) In psql:
CREATE EXTENSION pg_stat_statements;
Queries:
SELECT pid,datname,usename,client_addr,query_start,query FROM pg_stat_activity;
@Relrin
Relrin / runit
Created June 11, 2018 07:51
Running wxPython in virtualenv on Mac OS X
#!/bin/bash
# Copy this file into /bin folder of your virtual environment and let this this be executable
PYVER=3.6
PYTHON=/usr/local/bin/python$PYVER
ENV=`$PYTHON -c "import os; print(os.path.abspath(os.path.join(os.path.dirname(\"$0\"), '..')))"`
export PYTHONHOME=$ENV
exec $PYTHON "$@"
@Relrin
Relrin / run_wx.sh
Created December 7, 2014 15:06
Script for running wxPython applications from virtualenv
ENV=`python -c "import sys; print sys.prefix"`
PYTHON=`python -c "import sys; print sys.real_prefix"`/bin/python
export PYTHONHOME=$ENV
exec $PYTHON "$@"