%First Steps with Markdown %Marco Malva %2015/12/22 - 2021/05/18
The format traditionally Markdown is now rebranded as commonmark. One can read more on commonmark here http://commonmark.org/
The commonly used suffix for markdown files is .md
%First Steps with Markdown %Marco Malva %2015/12/22 - 2021/05/18
The format traditionally Markdown is now rebranded as commonmark. One can read more on commonmark here http://commonmark.org/
The commonly used suffix for markdown files is .md
| -- PostgreSQL: List the active queries | |
| -- see also <https://gist.github.com/rgreenjr/3637525> | |
| SELECT ROW_NUMBER() OVER() as rn | |
| , a.datname | |
| , a.usename | |
| , a.client_addr | |
| , a.pid | |
| , age(clock_timestamp(), a.query_start) as age_start | |
| , age(clock_timestamp(), state_change) as age_change | |
| , a.wait_event |
| -- | |
| -- PostgreSQL: query how larger tables (data + index) are | |
| -- | |
| SELECT *, pg_size_pretty(total_bytes) AS total | |
| , pg_size_pretty(index_bytes) AS INDEX | |
| , pg_size_pretty(toast_bytes) AS toast | |
| , pg_size_pretty(table_bytes) AS TABLE | |
| , pg_size_pretty(sum(table_bytes) OVER(ORDER BY total_bytes)) AS table_total | |
| , pg_size_pretty(sum(total_bytes) OVER(ORDER BY total_bytes)) AS db_total | |
| FROM ( |
| -- 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%' |
| # various useful nomad commands | |
| # | |
| # listed in pseudo pet style, i.e. "<xyz>" prompts the user to supply a value for xyz | |
| # * [GitHub - knqyf263/pet: Simple command-line snippet manager, written in Go.](https://github.com/knqyf263/pet) | |
| # * [document cli command options](http://docopt.org/) | |
| # * [Utility Conventions](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_01) | |
| # list dead jobs that are not batch (periodic) | |
| # any job listed indicates a failed deployment, | |
| # that is a deployed job that did not remain running |
| -- tuning advise: https://www.cybertec-postgresql.com/en/tuning-max_connections-in-postgresql/ | |
| -- | |
| -- get number of connections by database instance + total | |
| select datname, count(*) as cnt_conn, sum(count(*)) over () as tot_conn from pg_stat_activity group by datname order by datname; | |
| -- get more details, see column numbackends for number of connections | |
| select * from pg_stat_database order by datname; | |
| select datname, numbackends, sum(numbackends) over() as tot_conn from pg_stat_database order by datname; |
Six steps from donwloading an appimage to making it available as a Gnome desktop application.
The examples assume that one stores the appimage files in folder /opt/var/AppImage/ but any folder will do.
Download the appimage, e.g. cd /opt/var/AppImage/ && wget https://mirrors.mit.edu/kde/stable/digikam/7.3.0/digiKam-7.3.0-x86-64.appimage
Set the executable bit, e.g. chmod u+x digiKam-7.3.0-x86-64.appimage
Get an icon file (*.png) from the web, e.g. the github project page.
| -- copy2csv.sql: use psql to copy table or select query to CSV file with source and file as parameter | |
| -- | |
| -- usage: | |
| -- psql -v table_name="<table_name>" -v file_name="<file_name>" -h <host_name> -U <user_name> <db_name> -f copy2csv.sql | |
| -- psql -v table_name="dummy" -v file_name="my_dummy.csv" -f copy2csv.sql | |
| -- psql -v table_name="(select * from dummy order by birthdate desc)" -v file_name="my_dummy_2.csv" -f copy2csv.sql | |
| -- | |
| -- idea from: https://postgrespro.com/list/thread-id/1893680 | |
| -- see also https://www.postgresqltutorial.com/postgresql-format/ for format command | |
| -- |
| #!/bin/bash | |
| # | |
| # check for JVM flags pertaining periodic GC (uncommit, periodic, Shenandoa) | |
| java -XX:+PrintFlagsFinal -version | grep -iE "uncommit|periodic|Shenandoa" | |
| # and to show the JVM and OS settings as well the JVM version | |
| java -XshowSettings:all -version | |
| # testing with java8, java11 and java17 | |
| /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -XX:+PrintFlagsFinal -version | grep -iE "uncommit|periodic|Shenandoa" |
| # see also: | |
| # * to export public key: <https://mirrors.tripadvisor.com/centos-vault/4.5/docs/html/rhel-sbs-en-4/s1-gnupg-export.html> | |
| # * to extract private key to another machine: <https://makandracards.com/makandra-orga/37763-gpg-extract-private-key-and-import-on-different-machine> | |
| # * to check key expiration date: <https://stackoverflow.com/questions/48914338/how-to-get-expiration-date-from-a-gpg-key> | |
| # * to encrypt/decrypt: <https://www.gnupg.org/gph/en/manual/x110.html> | |
| # | |
| # list public keys | |
| gpg --list-keys |