Skip to content

Instantly share code, notes, and snippets.

View maietta's full-sized avatar

Nick Maietta maietta

View GitHub Profile
@maietta
maietta / getDNS.sh
Created February 29, 2024 21:23
Coolify - Pull IP's and their associated domains.
#!/bin/bash
docker exec -i coolify-db psql -U coolify -t -c "\
SELECT
json_agg(json_build_object(
'uuid', uuid,
'destination_id', destination_id,
'name', name,
'domain', domain,
'ip', ip,
@maietta
maietta / command.txt
Created February 29, 2024 20:28
Coolify DNS entries lookup
docker exec -i coolify-db psql -U coolify -t -c "\
SELECT
json_agg(json_build_object(
'uuid', uuid,
'destination_id', destination_id,
'name', name,
'domain', domain,
'ip', ip,
'source_table', source_table,
'docker_compose', docker_compose
@maietta
maietta / metadata.struct.go
Created February 27, 2024 03:08
Sample Struct in Go used in unmarshalling XML data into JSON.
type Metadata struct {
ReplyCode string `json:"ReplyCode"`
ReplyText string `json:"ReplyText"`
MetadataSys struct {
Version string `json:"Version"`
Date string `json:"Date"`
System struct {
SystemID string `json:"SystemID"`
SystemDescription string `json:"SystemDescription"`
} `json:"System"`
@maietta
maietta / reps2csv.js
Created December 15, 2023 17:53
Fetch current Representatives and save to CSV
// npm i node-fetch cheerio
// npx ts-node reps2csv.js
import fetch from 'node-fetch';
import cheerio from 'cheerio';
import fs from 'fs';
async function fetchAndParseHouseGov() {
try {
const response = await fetch('https://www.house.gov/representatives');
@maietta
maietta / publish.sh
Created December 13, 2023 18:30
Publish to CapRover - for SvelteKit SSR apps.
#!/bin/bash
# Exit if any command fails
set -e
# Check if the .env.production file exists
if [ ! -f .env.production ]; then
echo "The .env.production file does not exist. Please create it and add the necessary environment variables to deploy to CapRover."
exit 1
fi
@maietta
maietta / +layout.server.ts
Created December 12, 2023 18:39
Issue with
import type { LayoutServerLoad } from './$types';
import { ServicesOffered } from '$lib/db/schema';
import { db } from '$lib/db/db';
export const load = (async () => {
const result1 = await db.query.ServicesOffered.findMany({
select: {
id: true,
name: true
@maietta
maietta / snapshot.sh
Created November 7, 2023 23:43
CapRover service app snapshot script
#!/bin/bash
set -e
# Define the backup base path
backup_base_path="backups"
# Check if the service name argument is provided
if [ $# -ne 1 ]; then
echo "Usage: $0 <service_name>"
exit 1
@maietta
maietta / example.ts
Created October 29, 2023 04:22
Simple get/set key value store for SvelteKit, etc.
const keyValueStore = new KeyValueStore('./key-value-store.txt');
// Get a value from the store
const value = await keyValueStore.get('key1');
// Set a value in the store
await keyValueStore.set('key2', 'value2');
@maietta
maietta / capture_archive_relay.liq
Created October 8, 2023 20:22
Capture audio from soundcard, stream to Shoutcast server & archive 1 minute intervals.
# Set log level
set("log.level", 4)
# Capture audio from the ALSA sound card interface
input_stream = input.alsa(device="default")
# Function to add breaks every minute
def add_breaks(~duration, s) =
let duration = duration * 60. in
sequence([s, blank(duration)])
@maietta
maietta / shoutcast_relay_and_slice.liq
Created October 8, 2023 20:15
Shoutcast Relay with Timestamped Slicing
# Set log level
set("log.level", 4)
# Capture the remote Shoutcast stream
input_stream = input.http("http://your.shoutcast.server/stream")
# Function to add breaks every minute
def add_breaks(~duration, s) =
let duration = duration * 60. in
sequence([s, blank(duration)])