Skip to content

Instantly share code, notes, and snippets.

View coderofsalvation's full-sized avatar

Coder of Salvation / Leon van Kammen coderofsalvation

View GitHub Profile
@danmack
danmack / nix-alpine.org
Last active September 12, 2024 21:04
install NIX package manager on Alpine Linux

NIX Package Manager Install on Alpine Linux

System Information

  • alpine 3.17.1, 3.18, 3.19 and edge x86-64
  • multiple linux kernels worked 6.1.8-lts w/zfs and 6.6.8-lts
  • edge, testing apk repos enabled

Preparation

@coderofsalvation
coderofsalvation / eco-friendly-tiny-server-patterns.md
Last active September 2, 2024 13:33
My favorite (awesome) eco-friendly server patterns

tiny servers: the serverpark killers

auto-suspend-wakeup webservices

stop wasting cpu/mem-resources on idling services:

#!/bin/sh
while sleep 1s; do
 set +e
@thykka
thykka / line-fonts.lua
Last active October 3, 2021 18:12
Line Fonts for PICO-8
--[[
line fonts v0.1 - thykka 2021
==usage==
printl(
text,
x, y,
color,
font_size,
@modest
modest / twowayrsync
Created March 2, 2021 07:10
Two-way folder sync with rsync - Inefficient but portable
#!/usr/bin/env bash
remoteuser="$1"
remotehost="$2"
remotedir="$3"
localdir="$4"
syncstatusfile=".lastsync"
if [[ ! -d "$4" ]]; then
ffmpeg \
-i dance_addition.mp4 \
-i dance_and.mp4 \
-i dance_average.mp4 \
-i dance_blend.mp4 \
-i dance_burn.mp4 \
-i dance_darken.mp4 \
-i dance_difference.mp4 \
-i dance_divide.mp4 \
-i dance_dodge.mp4 \
@developit
developit / *valoo.md
Last active November 13, 2023 08:39
🐻 Valoo: just the bare necessities of state management. 150b / 120b. https://npm.im/valoo

🐻 valoo

just the bare necessities of state management.

Usage

Hotlink it from https://unpkg.com/valoo.

See Interactive Codepen Demo.

@amark
amark / li.html
Last active April 30, 2023 05:25
<html><body>
<style>
html, body {
background: rgb(245, 245, 245);
margin: 0;
padding: 0;
}
div {
position: relative;
overflow: hidden;
@joeladdison
joeladdison / youtube-test.sh
Created January 16, 2017 08:40
Test stream for YouTube Live
#!/bin/sh
YT_SERVER="rtmp://a.rtmp.youtube.com/live2"
# Needs AUTH, which is the "Stream Name" from Ingestion Settings > Main Camera
# apt-get install --assume-yes gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools
# https://bugzilla.gnome.org/show_bug.cgi?id=731352#c6
@gsanders5
gsanders5 / example.nginx
Last active September 2, 2024 13:44
Automatic nginx virtual subdomains with sub-folders or sub-directories
# Automatic nginx virtual subdomains with sub-folders or sub-directories
#
# Since the original source where I found this code is now offline, I have decided to mirror it here.
# All credit goes to: http://web.archive.org/web/20150307193208/http://www.messaliberty.com/2010/10/automatic-nginx-virtual-subdomains-with-sub-folders-or-sub-directories
#
# Description: In my web root directory I wanted create a folder called photos, and another called
# music using a sftp program. Without manually going back to the config file or to the shell I like to
# be able to access them at photos.nginxdomain.com and music.nginxdomain.com. That is what this config does.
# Redirect visitors from http://nginxdomain.com/ to http://www.nginxdomain.com/
@Brainiarc7
Brainiarc7 / transient-clustering-gnu-parallel-sshfs.md
Last active September 2, 2024 13:53
How to set up a transient cluster using GNU parallel and SSHFS for distributed jobs (such as FFmpeg media encodes)

Transient compute clustering with GNU Parallel and sshfs:

GNU Parallel is a multipurpose program for running shell commands in parallel, which can often be used to replace shell script loops,find -exec, and find | xargs. It provides the --sshlogin and --sshloginfile options to farm out jobs to multiple hosts, as well as options for sending and retrieving static resources and and per-job input and output files.

For any particular task, however, keeping track of which files need to pushed to and retrieved from the remote hosts is somewhat of a hassle. Furthermore, cancelled or failed runs can leave garbage on the remote hosts, and if input and output files are large, sending them to local disk on the remote hosts is somewhat inefficient.

In a traditional cluster, this problem would be solved by giving all nodes access to a shared filesystem, usually with NFS or something more exotic. However, NFS doesn't wo