Skip to content

Instantly share code, notes, and snippets.

View nmelnick's full-sized avatar

Nick Melnick nmelnick

View GitHub Profile
@spazm
spazm / 00_about.mkd
Last active April 25, 2023 19:57
Add trigger to update last modified column in postgres

Automated last updated columns -- postgresql

SYNOPSIS

Create an updated_at timestamp column that is automatically updated whenever row values are changed in a postgresql database.

ABOUT

  • Modifying a column when a row is changed requires a BEFORE UPDATE TRIGGER on row updates.
  • A trigger can call a procedure
  • A function can create a trigger programatically.
@nmelnick
nmelnick / elementary-bing-wallpaper.pl
Last active March 14, 2018 02:55
This is a quick and dirty script to change the elementary os wallpaper to the Bing image of the day
#!/usr/bin/env perl
# Sets the current elementary os wallpaper to the Bing image of the day. This
# is similar to Bing wallpaper daemons for Windows, GNOME, and the like. Instead
# of running as a daemon, just add to your crontab. For instance, to run every
# 3 hours, execute `crontab -e` from the command line, and insert:
# 0 */3 * * * /path/to/elementary-bing-wallpaper.pl
#
# This may require the installation of libjson-xs-perl.
# sudo apt install libjson-xs-perl
#