Skip to content

Instantly share code, notes, and snippets.

View charliebritton's full-sized avatar

Charlie Britton charliebritton

  • Chza Ltd.
  • United Kingdom
  • 17:52 (UTC)
View GitHub Profile
@charliebritton
charliebritton / shoutcast-autorestart.sh
Last active April 6, 2021 02:34
SHOUTcast auto-restart script to restart SHOUTcast DNAS server automatically on failure. Can be tested with --test flag
#!/bin/bash
# SHOUTcast auto-restart script.
# Copyright 2020 Charlie Britton
#
# Run this script as a cronjob, setting BASEDIR to the SHOUTcast directory and
# the sc_serv binary and config files below.
# Directory SHOUTcast is in
BASEDIR=$(dirname "$0")
@charliebritton
charliebritton / ad-processor-v2.sh
Last active May 3, 2019 21:52
Ad Processor V2 - Trims songs down to the perfect length for a 2 min advert and also updates the metadata. Requires ffmpeg & mp3info
#!/bin/zsh
# (c) Copyright 2018 Charlie Britton (chza.me). All rights reserved.
# PLEASE NOTE: You will need ffmpeg and mp3info for this script to work properly!
# On MacOS, install Homebrew and then run `brew install mp3info` and `brew install ffmpeg`
# This script has only been tested on MacOS, there is no guarantee that it will work on any other OS (especially Windows).
# Set the directory to work from, this should have the child folder ./original/ with all of your music.
function sumOfPrimes(number) {
let currentTotal = 0;
let mostRecentPrime = 0;
for(var i =1; i < number; i++) {
let factors = [];
for(var j = 1; j <= i; j++) {
if(i % j == 0) { factors.push(j) }
}
console.log("Factors:" + factors);
if(factors.length == 2) { currentTotal += i; mostrecentPrime = i }