Import text/template
or html/template
as needed.
tmpl, _ := template.New(“template_name”).Parse(“...”)
tmpl.Name() // => name of current template
tmpl.Execute(...) // => current template
#fff
.import { dirname, resolve } from 'path' | |
import express from 'express' | |
import { createServer as createViteServer } from 'vite' | |
import { fileURLToPath } from 'url' | |
const __dirname = dirname(fileURLToPath(import.meta.url)) | |
const ROUTES = { | |
'/': './index.html', | |
'/buckets/:bucket': './[bucket].html', |
A simple function to handle a comunication over TCP via JSON using js generators.
Write a generator for each side of the conversation. To send or receive a message at some point just yield with one of the following functions
import { awaitMessage, sendMessage } from './mp.js'
package extract_test | |
import ( | |
"regexp" | |
"strings" | |
"testing" | |
) | |
func lines(source string) chan string { | |
output := make(chan string) |
Run a function for every line in a file following its output. This is just a more modern version of the code found at https://stackoverflow.com/questions/11225001/reading-a-file-in-real-time-using-node-js and only uses open
from fs/promises
.
Just pass a callback that consumes the lines of the followed file.
import tail from './tail.js';
Pseudocode inspiration from: https://people.eecs.berkeley.edu/~kubitron/courses/cs162-F10/hand-outs/synch.html
ThreadQueue() {
var queue: Queue<Thread>;
Launch commands in a new detached tmux session. This needs tmux
and sqlite3
to be installed, see launch --help
for usage.
Sqlite is used for storing the command history in ~/.cache/aziis98.scripts.launch/history.db
that can be run with launch past <SESSION_NAME>
.