Skip to content

Instantly share code, notes, and snippets.

@macintux
macintux / presentation-tips.md
Last active November 28, 2022 01:03
Public speaking tips
@macintux
macintux / db_backup_commands.md
Created December 31, 2021 11:51 — forked from AtulKsol/db_backup_commands.md
Commands to backup & restore database
  1. pg_dump is a nifty utility designed to output a series of SQL statements that describes the schema and data of your database. You can control what goes into your backup by using additional flags.
    Backup: pg_dump -h localhost -p 5432 -U postgres -d mydb > backup.sql

    Restore: psql -h localhost -p 5432 -U postgres -d mydb < backup.sql

    -h is for host.
    -p is for port.
    -U is for username.
    -d is for database.

@macintux
macintux / aws-links.txt
Created March 23, 2020 02:56
AWS random resources
@macintux
macintux / python-strftime-brokenness.md
Last active September 7, 2019 17:22
I've often found time frustrating to deal with in Python. There's a popular library that completely ignores time zones (although regrettably at the moment I can't remember what it is). This, though, is particularly egregious: time.strftime (which relies on local libraries) is giving completely wrong values for time zones.

Python 3.7.3, MacOS 10.14.5

>>> epoch = int(datetime.datetime.now().timestamp())
>>> epoch
1567872682
>>> gmt = time.gmtime(epoch)
>>> gmt.tm_zone
'UTC'
>>> time.strftime('%Z', gmt)