Skip to content

Instantly share code, notes, and snippets.

View bartekbrak's full-sized avatar

Bartek Brak bartekbrak

  • Warsaw
View GitHub Profile
@garethrees
garethrees / indexes.sql
Last active February 16, 2020 17:34
List all indexes in postgres database
SELECT indexname FROM pg_indexes;
@jamesnesfield
jamesnesfield / git submodules
Created March 2, 2014 12:30
clone and init all submodules.
git submodule update --init --recursive
@sheikhwaqas
sheikhwaqas / setup-mysql.sh
Last active September 6, 2023 15:59
Install MySQL Server on Ubuntu (Non-Interactive Installation)
# Download and Install the Latest Updates for the OS
apt-get update && apt-get upgrade -y
# Set the Server Timezone to CST
echo "America/Chicago" > /etc/timezone
dpkg-reconfigure -f noninteractive tzdata
# Enable Ubuntu Firewall and allow SSH & MySQL Ports
ufw enable
ufw allow 22
@mgedmin
mgedmin / timeit-from-pdb-hack.md
Last active September 27, 2019 16:32
using timeit.timeit from pdb with access to a subset of local vars

= Problem =

timeit.timeit() doesn't let you pass local vars to the code to be timed.

= Solution =

(pdb) !import sys, timeit
(Pdb) !dv = (lambda sys=sys: (lambda **kw: setattr(sys.modules['__main__'], 'VARS', kw)))()
(Pdb) !tt = lambda s, sys=sys: sys.stdout.write('%.3g ms\n' % timeit.timeit(s, 'import sys; self = sys.modules["__main__"].SELF', number=10)/10.*1000)