Skip to content

Instantly share code, notes, and snippets.

View charliebritton's full-sized avatar

Charlie Britton charliebritton

  • UG @ University of Southampton
  • United Kingdom
View GitHub Profile
@alwynallan
alwynallan / Makefile
Last active April 4, 2024 04:42
Hardware PWM Controller for the Raspberry Pi 4 Case Fan
CC = gcc
RM = rm -f
INSTRUMENT_FOR_PROMETHEUS := false
ifeq ($(INSTRUMENT_FOR_PROMETHEUS),true)
CFLAGS = -Wall -DINSTRUMENT_FOR_PROMETHEUS
LIBS = -lbcm2835 -lprom -lpromhttp -lmicrohttpd
else
CFLAGS = -Wall
@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.
@brandonmwest
brandonmwest / example.cs
Last active January 16, 2024 15:52
Generating base64-encoded Authorization headers in a variety of languages
httpClient.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue(
"Basic",
Convert.ToBase64String(
System.Text.ASCIIEncoding.ASCII.GetBytes(
string.Format("{0}:{1}", username, password))));