TL;DR
9.4 -> 9.5:
sudo pg_dropcluster 9.5 main --stop
sudo service postgresql stop
sudo pg_upgradecluster -m upgrade -k 9.4 main
sudo su postgres -c "/usr/lib/postgresql/9.5/bin/vacuumdb --all --analyze-in-stages"
sudo pg_dropcluster 9.4 main
#!/usr/bin/env python3 | |
"""Automatic High-Res Strava Heatmap TMS link generator | |
This script signs in your Strava account using https://github.com/nnngrach/strava_auto_auth, | |
extracts the cookies and forms a TMS link that you can use in apps like OsmAnd or JOSM. | |
On macOS, leverages the keychain, so you don't have to type login and password every time. | |
Requires Docker. |
SN: 603.983% | |
TR: 480.698% | |
MY: 395.515% | |
SA: 229.806% | |
UY: 217.383% | |
VN: 177.495% | |
TH: 176.646% | |
DZ: 158.348% | |
PK: 156.190% | |
IR: 147.665% |
# Use this script to test that your Telegram bot works. | |
# | |
# Install the dependency | |
# | |
# $ gem install telegram_bot | |
# | |
# Run the bot | |
# | |
# $ ruby bot.rb | |
# |
TL;DR
9.4 -> 9.5:
sudo pg_dropcluster 9.5 main --stop
sudo service postgresql stop
sudo pg_upgradecluster -m upgrade -k 9.4 main
sudo su postgres -c "/usr/lib/postgresql/9.5/bin/vacuumdb --all --analyze-in-stages"
sudo pg_dropcluster 9.4 main
# install epel repo | |
sudo yum -y install wget | |
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm | |
sudo rpm -Uvh epel-release-latest-7.noarch.rpm | |
wget http://yum.postgresql.org/9.3/redhat/rhel-7-x86_64/pgdg-redhat93-9.3-1.noarch.rpm | |
sudo rpm -Uvh pgdg*.rpm | |
# update (again) | |
sudo yum -y update |
Magic words:
psql -U postgres
Some interesting flags (to see all, use -h
or --help
depending on your psql version):
-E
: will describe the underlaying queries of the \
commands (cool for learning!)-l
: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import web, json, time, mpd, collections | |
STATIONS = { | |
"FoxNews" : "mmsh://209.107.209.181:80/D/138/13873/v0001/reflector:24137?MSWMExt=.asf", | |
"Classic" : "http://radio02-cn03.akadostream.ru:8100/classic128.mp3", | |
"Jazz": "http://streaming208.radionomy.com:80/A-JAZZ-FM-WEB" | |
} |
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |