Skip to content

Instantly share code, notes, and snippets.

@goliatone
goliatone / README.md
Last active March 14, 2024 13:10 — forked from colophonemes/create_triggers
Postgres TRIGGER to call NOTIFY with a JSON payload

This TRIGGER function calls PosgreSQL's NOTIFY command with a JSON payload. You can listen for these calls and then send the JSON payload to a message queue (like AMQP/RabbitMQ) or trigger other actions.

Create the trigger with notify_trigger.sql.

When declaring the trigger, supply the column names you want the JSON payload to contain as arguments to the function (see create_triggers.sql)

The payload returns a JSON object:

@goliatone
goliatone / fm.php
Created December 17, 2013 03:01 — forked from eric1234/fm.php
<?php
/*** A stupid simple PHP-based file manager ***/
// Were to put the files. Assume the "fm" directory where this script
// Is located but you can change it to anything you want.
$storage_dir = implode(DIRECTORY_SEPARATOR, array(dirname(__FILE__), 'fm'));
// Set to the name of the file that is the header and footer of the HTML
$header = null;
$footer = null;
@goliatone
goliatone / generate_rsa_ssh_keys.go
Last active October 16, 2023 07:34 — forked from azakordonets/generate_rsa_ssh_keys.go
Generate SSH RSA Private/Public Key pair with Golang
// This shows an example of how to generate a SSH RSA Private/Public key pair and save it locally
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"golang.org/x/crypto/ssh"
@goliatone
goliatone / exclude.sql
Created June 15, 2023 20:14 — forked from fphilipe/exclude.sql
PostgreSQL EXCLUDE constraint
CREATE EXTENSION btree_gist;
CREATE TABLE room_reservations (
room_id integer,
reserved_at timestamptz,
reserved_until timestamptz,
canceled boolean DEFAULT false,
EXCLUDE USING gist (
room_id WITH =, tstzrange(reserved_at, reserved_until) WITH &&
) WHERE (not canceled)
@goliatone
goliatone / README.md
Last active April 4, 2023 02:10 — forked from princejwesley/await-babel-repl.js
[Node REPL] Examples of node REPL #repl #nodejs #node

Node.js REPL Examples

Different examples of Node.js REPLs

  • Top level async/await
  • Using custom VM
  • Using atocomplete, custom commands, histroy, etc
@goliatone
goliatone / meeting-note.md
Created February 12, 2023 23:34 — forked from zsviczian/meeting-note.md
Daily note taking scripts

<%* /*

*/
const view = app.workspace.activeLeaf.view;
const editor = view.editor;
const curLineNum = editor.getCursor().line;
const curLineText = editor.getLine(curLineNum);
const title = tp.file.title;
const today = title.match(/\d{4}\-\d{2}\-\d{2} .+/) //are we on the DNP?
@goliatone
goliatone / Dashboard.md
Created February 12, 2023 22:34 — forked from beet/Dashboard.md
Obsidian Templater script to convert the current line to a Tasks plugin task

Today

due today
not done
done today
@goliatone
goliatone / README.md
Created February 12, 2023 11:25 — forked from lenalebt/README.md
"Rollover Daily Todos" for Obsidian Templater

Rollover Daily Todos for Obsidian, but with the Templater Plugin

Rollver daily todos is a really nice extension for Obsidian.md that takes TODOs from yesterdays daily notes and rolls them over to today's notes. It has support for Obsidians built-in templates, but does - to my understanding - not really work well with the Templater Plugin. At least, I was unable to get it to work :-). Also, I wished it had some way to tell me that TODOs have been rolled over a few times already. Doing it this way is my way of working around these limitations.

I took some of the code of that "rollover daily todos" plugin and made it into a templater user script.

@goliatone
goliatone / DailyNoteTemplate.md
Created February 12, 2023 10:45 — forked from panahi/DailyNoteTemplate.md
Obsidian Templates Collection

<%* var fileDate = moment(tp.file.title); // moment dates are mutable let prevDay = moment(fileDate).subtract(1, 'd').format('YYYY-MM-DD'); let nextDay = moment(fileDate).add(1, 'd').format('YYYY-MM-DD'); let prevDayWeek = moment(fileDate).subtract(1, 'd').format('gggg-[W]ww'); let nextDayWeek = moment(fileDate).add(1, 'd').format('gggg-[W]ww'); let yearLink = fileDate.format('YYYY'); let quarterLink = fileDate.format('YYYY [Q]Q'); let monthLink = fileDate.format('YYYY-MM');

@goliatone
goliatone / dailyNoteTemplate.txt
Created February 12, 2023 10:02 — forked from bennewton999/dailyNoteTemplate.txt
My current Daily Note Template in Obsidian utilizing Templater and DataView Plugins
---
creation date: <% tp.file.creation_date() %>
tags: DailyNote <% tp.file.title.split('-')[0] %>
---
modification date: <%+ tp.file.last_modified_date("dddd Do MMMM YYYY HH:mm:ss") %> // This doesn't currently work in front matter, hoping that gets fixed.
# <% tp.file.title %>
<< [[<% tp.date.now("YYYY-MM-DD", -1, tp.file.title, "YYYY-MM-DD") %>]] | [[<% tp.date.now("YYYY-MM-DD", 1, tp.file.title, "YYYY-MM-DD") %>]]>>