Skip to content

Instantly share code, notes, and snippets.

@svenkrb
svenkrb / PostgreSQL_index_naming.rst
Created April 18, 2018 13:56 — forked from popravich/PostgreSQL_index_naming.rst
PostgreSQL index naming convention to remember

The standard names for indexes in PostgreSQL are:

{tablename}_{columnname(s)}_{suffix}

where the suffix is one of the following:

  • pkey for a Primary Key constraint;
  • key for a Unique constraint;
  • excl for an Exclusion constraint;
  • idx for any other kind of index;
@svenkrb
svenkrb / adb.sh
Created July 3, 2017 13:04
newest adb
wget https://dl.google.com/android/repository/platform-tools-latest-linux.zip
sudo unzip -d /usr/local/sbin platform-tools-latest-linux.zip
sudo wget -O /usr/local/sbin/adb https://raw.githubusercontent.com/NicolasBernaerts/ubuntu-scripts/master/android/adb
sudo wget -O /usr/local/sbin/fastboot https://raw.githubusercontent.com/NicolasBernaerts/ubuntu-scripts/master/android/fastboot
sudo chmod +x /usr/local/sbin/adb /usr/local/sbin/fastboot
adb version
@svenkrb
svenkrb / pg_upgrade.sh
Created May 29, 2017 20:05
Upgrade postgresql a cluster Ubuntu
# As root
# Add pg repo if not already established
sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
apt update
# Tweak needed packages
apt install postgresql-9.6 postgresql-client-9.6 postgresql-contrib-9.6 postgresql-plpython3-9.6 postgresql-server-dev-9.6 postgresql-9.6-plr postgresql-9.6-mysql-fdw
pg_dropcluster 9.6 main --stop
pg_upgradecluster -m upgrade 9.5 main
pg_dropcluster 9.5 main
@svenkrb
svenkrb / clean_kernels.sh
Created November 16, 2015 12:29
One liner for ubuntu to cleanup installed kernels with exceptions
# Remove kernels and associated packages for all versions execpt meta required and versions X and Y
sudo aptitude purge '~i linux-(headers|image|tools) !lts !common !X !Y'