Skip to content

Instantly share code, notes, and snippets.

View williambh's full-sized avatar

Willian Leite Araújo williambh

  • UFVJM
  • Diamantina
View GitHub Profile
@peterneave
peterneave / readme.md
Last active November 10, 2023 06:51
Install pgAgent on Postgres 10 (Debian Linux)

Install pgAgent on Postgres 10 (Debian Linux)

This assumes you will have pgAgent running on the same machine as your database.

Terminal

  1. Install pgAgent via package manager
sudo apt update
@sv99
sv99 / How can I replace a newline (\n) using sed.md
Last active May 10, 2024 07:56
How can I replace a newline (\n) using sed?

stackoverflow (hdorio)

Fast answer:

sed ':a;N;$!ba;s/\n/ /g' file
  1. :a create a label 'a'
  2. N append the next line to the pattern space
  3. $! if not the last line, ba branch (go to) label 'a'
  4. s substitute, /\n/ regex for new line, / / by a space, /g global match (as many times as it can)
@mateuszwenus
mateuszwenus / save_restore_dependencies.sql
Last active April 11, 2024 05:49
PostgreSQL: How to handle table and view dependencies
create table deps_saved_ddl
(
deps_id serial primary key,
deps_view_schema varchar(255),
deps_view_name varchar(255),
deps_ddl_to_run text
);
create or replace function deps_save_and_drop_dependencies(p_view_schema varchar, p_view_name varchar) returns void as
$$