Add reverse lookup to zsh bindkey '^R' history-incremental-search-backward ( read on Stack Exchange > Unix&Linux > “How to enable reverse search in zsh?”
Handies
Edit files in place This -i '' was necessary on MacOs to avoid creating a greatings.txt.bak file as a backup $ sed -i '' 's/hello/bonjour/' greetings.txt xargs into vim Per this helpful answer , you can xargs into vim on macos x with xargs -o … find . -name 'blahfile*py' |head -1 |xargs -o vim xargs to md5 This is nice too, quickly md5 files. $ fd spark-wee en/post/2021-01-23-spark-weekend.md posts/2021-01-23-spark-weekend.md $ $ fd spark-wee|xargs -o md5 MD5 (....
import datetime def date_from_date_str(date_str): return datetime.datetime.strptime(date_str, '%Y-%m-%d').date() def make_start_end_clauses(start, end): '''Make sql to take advantage of Athena date partitioning. Example WHERE ((year = 2017 AND month = 10 AND day >=30) OR (year = 2017 AND month = 11 AND day = 1))''' assert start <= end month_tuples = make_start_end_month_tuples(start, end) clauses = [] if len(month_tuples) == 1: clause_raw = ('(year = {} AND month = {} AND day BETWEEN {} AND {})') clause = clause_raw....
[[TOC]] List indexes From here SELECT tablename, indexname, indexdef FROM pg_indexes WHERE schemaname = 'public' ORDER BY tablename, indexname; Disk Usage per table from the postgresql wiki except one minor change … for ('user_blah', 'user_blar', 'schema1', 'schema2') schemas only … 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 FROM ( SELECT *, total_bytes-index_bytes-COALESCE(toast_bytes,0) AS table_bytes FROM ( SELECT c.oid,nspname AS table_schema, relname AS TABLE_NAME , c....
Interesting The operator ~~ is equivalent to LIKE, and ~~* corresponds to ILIKE. There are also !~~ and !~~* operators that represent NOT LIKE and NOT ILIKE. All of these operators are PostgreSQL-specific. per 7.3 doc. not sure if outdated