Skip to content

Instantly share code, notes, and snippets.

View FoxCouncil's full-sized avatar
🦊
Foxing stuff up!

Fox FoxCouncil

🦊
Foxing stuff up!
View GitHub Profile
@FoxCouncil
FoxCouncil / IceCastICYHttpClientSupport.cs
Last active April 28, 2023 09:26
This helps stop C#'s HttpClient from puking on Icecast and Shoutcat servers that send a ICY header instead of an HTTP header.
// Main()
{
var socketHandler = new SocketsHttpHandler {
PlaintextStreamFilter = (filterContext, ct) => new ValueTask<Stream>(new HttpFixerDelegatingStream(filterContext.PlaintextStream))
};
var httpClient = new HttpClient(socketHandler);
var httpGetter = await httpClient.GetAsync("http://icyserver:8000/my_awesome_stream.mp3", HttpCompletionOption.ResponseHeadersRead);
}
@FoxCouncil
FoxCouncil / bitnami-php-fpm:redis:latest.Dockerfile
Last active July 8, 2023 09:45
Dockerfile to use Bitnami's PHP-FPM latest, but with Redis 5.3.7 support
# syntax=docker/dockerfile:1
FROM bitnami/php-fpm
RUN apt-get update && apt-get install -y \
autoconf \
build-essential \
wget
RUN cd /root \
&& wget https://pecl.php.net/get/redis-5.3.7.tgz \
&& tar xzf redis-5.3.7.tgz && cd redis-5.3.7 \
&& phpize \
@FoxCouncil
FoxCouncil / get_throttled.cs
Created June 5, 2021 12:26
vcgencmd is a command line utility that can get various pieces of information from the VideoCore GPU on the Raspberry Pi. This is for the command get_throttled part of that.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
public class Program
{
public static void Main()
{
var parsableOutput = "0x3000F";
@FoxCouncil
FoxCouncil / radiotools.js
Last active May 22, 2021 03:42
A NodeJS based tool to pull NowPlaying data from AzuraCast and push it to Azure Blob Storage and Pusher notification.
require('dotenv').config()
let oldCl = console.log;
console.log = function(msg) {
oldCl('[' + new Date().toISOString() + '] ' + msg);
}
const http = require('http');
const i2b64 = require('image-to-base64');
@FoxCouncil
FoxCouncil / ManagerClassAct.cs
Created August 23, 2020 22:24
A threaded Manager class...
public class Manager
{
private readonly AutoResetEvent _reset = new AutoResetEvent(false);
private Thread _mainThread;
public bool IsRunning => _mainThread != null && _mainThread.IsAlive;
public Manager()
{
@FoxCouncil
FoxCouncil / WebClient.GetHeaders.cs
Created November 21, 2019 06:49
Just give me head please...
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Security;
using System.Net.Sockets;
namespace FoxCouncil.Gist
{
private static T GetNext<T>(IEnumerable<T> list, T current)
{
try
{
if (list.Last().Equals(current))
{
return list.First();
}
return list.SkipWhile(x => !x.Equals(current)).Skip(1).First();
namespace FoxCouncil.Gist
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Security.Cryptography;
@FoxCouncil
FoxCouncil / FoxCouncil.Gist.AspNetCore.cs
Last active November 15, 2018 03:06
ASP.NET Core 2.1 - Controller Caching Anonymous Method Function
// Copyright (c) Fox Council - License: MIT
/*
* Usage Example:
* [HttpGet]
* public async Task<IActionResult> All()
* {
* return await this.Cached(TimeSpan.FromMinutes(15), async () => {
* await _stuff.SomeLongTask();
* return await _stuff.GetStuff();