Skip to content

Instantly share code, notes, and snippets.

View OliverRC's full-sized avatar
🤩
coding my heart out

Oliver Rivett-Carnac OliverRC

🤩
coding my heart out
View GitHub Profile
@OliverRC
OliverRC / ConvertMP4-MP3
Created August 7, 2014 18:55
A small script that uses ffmpeg to convert mp4 video to mp3
$files = Get-ChildItem -Path . -Filter *.mp4
foreach($file in $files)
{
$filename = $file.name
$basename = $file.BaseName
$command = "ffmpeg -i `"$filename`" -codec:a libmp3lame -q:a 0 `"$basename.mp3`""
Write-Host $command
@OliverRC
OliverRC / singleton
Created November 14, 2014 08:00
Singleton
public sealed class Singleton
{
private static readonly Lazy<Singleton> lazy =
new Lazy<Singleton>(() => new Singleton());
public static Singleton Instance { get { return lazy.Value; } }
private Singleton()
{
}
@OliverRC
OliverRC / .gitignore
Created November 24, 2014 09:29
Create a .gitignore on Windows
touch .gitignore
@OliverRC
OliverRC / Program.cs
Created June 21, 2022 18:09
Secure AspNetCore .NET 6 API with Auth0 - Works with SwaggerUI
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.OpenApi.Models;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
})
@OliverRC
OliverRC / delete-reddit-comments.js
Created October 19, 2022 19:33
Quick script to use on old.reddit.com to delete comments and posts.
var $domNodeToIterateOver = $('.del-button .option .yes'), currentTime = 0, timeInterval = 1500; $domNodeToIterateOver.each(function() { var _this = $(this); currentTime = currentTime + timeInterval; setTimeout(function() { _this.click(); }, currentTime);});