Skip to content

Instantly share code, notes, and snippets.

@jphsd
jphsd / interprocess.md
Last active October 13, 2024 16:46
Interprocess channels in Go by using named pipes

How to use channels across different processes in Go

A couple of code samples to show how a named pipe can be used to extend Go's channel paradigm for use between different processes running on a system.

  • interprocess1.go details a single byte channel.
  • interprocess2.go details a channel that passes slices of bytes.

Note that opening a write channel will return two channels -

@rodydavis
rodydavis / pocketbase_plugin_fts5.go
Last active March 27, 2025 18:54
Drop in plugin for PocketBase to add SQLIte native full text search to any collection
package plugins
import (
"fmt"
"strings"
"github.com/labstack/echo/v5"
"github.com/pocketbase/dbx"
"github.com/pocketbase/pocketbase"
"github.com/pocketbase/pocketbase/apis"
@cugu
cugu / README.md
Last active April 21, 2025 16:34
Webhooks for PocketBase

Webhooks for PocketBase

A simple webhook plugin for PocketBase.

Adds a new collection "webhooks" to the admin interface, to manage webhooks.

Example

The webhook record in the following example send create, update, and delete events in the tickets collection to http://localhost:8080/webhook.

@sombriks
sombriks / example.html
Created June 15, 2024 20:01
hx-dataset-include - keep your application state in the loop using this hacky, fast and simple extension.
<!--
Since the markup IS the application state, using data-* attributes to keep track of some specifics would be handy.
Luckily, HTMX is brutally easy to extend, so we can do that in no time!
-->
<article class="message task"
th:id="'task'+${task.id}"
th:data-task="${task.id}"
th:data-status="${task.status.id}"
th:hx-put="@{/task/{id}(id=${task.id})}"
hx-ext="hx-dataset-include"
@sebastiancarlos
sebastiancarlos / term2plain.bash
Last active January 25, 2025 15:10
term2plain - Record an interactive terminal session, and convert it to plain text.
#! /usr/bin/env bash
# All my gist code is licensed under the MIT license.
# term2plain
# - Convert a text file containing terminal escape sequences to plain text.
# - This plain text is close to the visual result of running the file in a
# terminal.
# - This is achieved by running the file in a virtual terminal (tmux) and
# capturing it's buffer output.
@sebastiancarlos
sebastiancarlos / colorcat.bash
Last active March 21, 2025 16:39
Cross-app URL aliases (like shell aliases) powered by Nginx.
#!/usr/bin/env bash
# All my gist code is licensed under the MIT license.
# Video demo: https://www.youtube.com/watch?v=y542zPAPeG4
# colorcat
# - cats a file, but if any line contains N hex colors, it appends the colors
# (rendered as ansi escape sequences) to the end of the line.
# - input can be stdin, a file, or a hex color in plain text
@sebastiancarlos
sebastiancarlos / fonts.bash
Last active December 15, 2024 18:37
Check your OS fonts from your terminal
#!/usr/bin/env bash
# Video demo: N/A (This script is so dank that YouTube took down my video without explanation)
# Add this to your ~/.bashrc
# custom fc-list
# - sort list
# - add color
# - format table output
@17twenty
17twenty / demo.tmpl.html
Last active February 16, 2025 11:49
Golang Flash demo using cookies - recreate the Flask Flash library using Golang and HTMX and make life easier.
<html>
<head>
<script src="https://unpkg.com/[email protected]"></script>
<script src="https://cdn.tailwindcss.com"></script>
<title>Template Fragment Example</title>
</head>
<body>
<div hx-get="/notifications" hx-trigger="load" hx-swap="outerHTML"><!-- I GET REPLACED --></div>
@sebastiancarlos
sebastiancarlos / custom-type.bash
Last active August 23, 2023 11:48
Custom version of the Bash 'type' command, navigating symlinks and aliases.
# All my gist code is licensed under the terms of the MIT license.
# Video demo: https://www.youtube.com/shorts/mYfEIZFlIwo
# Put this in your .bashrc or something like that
# pretty_print_directory
# - replace $HOME with ~
# - make everything before the last '/' green, and everything after white and
# bold
@sebastiancarlos
sebastiancarlos / show_notifications.bash
Last active July 23, 2024 08:43
Show notifications in your terminal
# All my gist code is licensed under the terms of the MIT license.
# Video demo: https://www.youtube.com/shorts/WVyqVkGYb4k
# Add this somewhere in ~/.bashrc
# write_message
# - write a message on the lower right corner of the terminal
function write_message () {
if [[ "$#" -eq 0 ]]; then