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 / 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);});
@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 / .gitignore
Created November 24, 2014 09:29
Create a .gitignore on Windows
touch .gitignore
@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 / 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
<div class="navbar navbar-default" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Brand Name</a>
@OliverRC
OliverRC / temporary-aspnet-files
Created February 18, 2014 12:42
Temporary ASP.Net Files
%TEMP%\Temporary ASP.NET Files
C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files
@OliverRC
OliverRC / stored-proc-dropcreate.sql
Created February 18, 2014 12:41
Creating a Stored Procedure - Drop + Create
IF EXISTS(SELECT * FROM sysobjects where id = object_id(N'<schema>.<procedureName>') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE <schema>.<procedureName>
GO
CREATE PROCEDURE <schema>.<procedureName> <@parameters
AS
BEGIN
END
@OliverRC
OliverRC / view-dropcreate.sql
Created February 18, 2014 12:41
Creating a View - Drop + Create
IF EXISTS(SELECT * FROM sysobjects where id = object_id(N'<schema>.<view>') and OBJECTPROPERTY(id, N'IsView') = 1)
DROP VIEW <schema>.<view>
GO
CREATE VIEW dbo.vw_Mon_Casino
AS
GO
@OliverRC
OliverRC / restore-db.sql
Created February 18, 2014 12:40
restore-db.sql
USE master
GO
--Run to varify backup and view Logical and Physical Names
RESTORE FILELISTONLY
FROM disk = 'C:\<backfile>'
--Run once you are happy with everything
RESTORE DATABASE <databasename>
FROM disk = 'C:\<backfile>'