Skip to content

Instantly share code, notes, and snippets.

View maietta's full-sized avatar

Nick Maietta maietta

View GitHub Profile
@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)])
@maietta
maietta / main.go
Created October 8, 2023 19:44
Shoutcast to Vosk real-time transscription
package main
import (
"fmt"
"log"
"net/http"
"net/url"
"github.com/gorilla/websocket"
"github.com/hajimehoshi/go-mp3"
@maietta
maietta / +page.svelte
Created October 6, 2023 22:29
Fetch remote streaming API and proxy to front-end.
<script>
import { onMount } from 'svelte';
import { writable } from 'svelte/store';
const messages = writable([]);
onMount(() => {
const evtSource = new EventSource('/sse'); // Point to path
evtSource.onmessage = function (event) {
var dataobj = JSON.parse(event.data);
To build IDJC (Internet DJ Console) on the latest version of Ubuntu, you can follow these steps:
1. Update your system:
```
sudo apt update
sudo apt upgrade
```
2. Install the required dependencies:
```
@maietta
maietta / .env.production
Last active April 15, 2023 17:18
Deployment files specifically intended for CapRover, used to deploy SSR-enabled Svelte applications with the Node Adaptor.
APP_NAME="<APP_NAME>"
APP_TOKEN="<APP_TOKEN>"
CAPROVER_URL="https://apps.your-caprover-hostname.com"
@maietta
maietta / deploy.sh
Last active April 2, 2023 16:08
deploy.sh updated. Final builds <2mb
#!/bin/bash
<< BLOCK
MIT License. Do as you wish with this.
Author: 2023 Nick Maietta <[email protected]>
This is a bash script that deploys a SvelteKit application to CapRover using the Node 18 enviornment on Alpine Linux.
The script starts by checking if the user has provided an environment name as a command-line argument. If no argument