Skip to content

Instantly share code, notes, and snippets.

View copernicus365's full-sized avatar

Nicholas Petersen copernicus365

  • Huber Heights, Ohio
View GitHub Profile
@copernicus365
copernicus365 / sefaria.org-dark-mode.css
Last active October 6, 2024 20:49
Dark theme / mode user css for sefaria.org
/*
Sadly sefaria.org doesn't have a dark theme on desktop, though it does in the apps. See:
https://www.sefaria.org/sheets/215584.26?lang=bi&with=all&lang2=en
But we can add our custom css to a site with browser extensions like these:
https://chromewebstore.google.com/detail/user-css/okpjlejfhacmgjkmknjhadmkdbcldfcb
(or see also: https://chromewebstore.google.com/detail/user-javascript-and-css/nbhcbdghjpllgmfilhnhkllmkecfmpld )
@copernicus365
copernicus365 / UriHostWithoutSubdomain.cs
Last active October 1, 2024 06:58
Class to get the subdomain from the domain / host of a Uri.Host string if it exists
namespace DotNetXtensions.Uri;
/// <summary>
/// `Uri` class does not allow getting a subdomain from the `uri.Host`.
/// This class provides a highly efficient method of getting a subdomain
/// if it exists on an input host / domain string (ideally sent in via
/// <see cref="Uri.Host"/>).
/// </summary>
public class UriHostWithoutSubdomain
{

FileSync

A cross-platform command-line file-syncer, which can sync files from a local source directory, with glob filters, and backup to either another directory, or to cloud storage, namely to Azure blob storage. (Though stalled, it should be trivial in the future to expanded this to Amazon S3 and hopefully even to FTP)

Many years prior I named this tool FileUp.

dotnet tool

Currently the source for this tool is not released. Till then however this gist / readme provides needed documentation.

@copernicus365
copernicus365 / sample-choco-packages.txt
Created July 19, 2022 16:30
Sample choco packages list to be used in same directory as [install-windows-apps-choco.ps1](https://gist.github.com/copernicus365/e3beb726e8269d653249f7a054bcb85a). Rename this file to 'packages.txt'
# core stuff
dotnet
dotnet-sdk
powershell-core
microsoft-windows-terminal
7zip
#?? 7zip.install
# browsers
@copernicus365
copernicus365 / install-windows-apps-choco.ps1
Created July 19, 2022 16:27
Powershell script to use choco (chocolately) to install apps from a packages.txt file. Includes dry run ability and print out. Installs choco if needed. Must have a packages.txt file in same directory (see other gist with sample)
## To fix "cannot be loaded because running scripts is disabled on this system" (run: 'get-executionpolicy' returns: Restricted) -->
## set-executionpolicy remotesigned
# Run following to bypass "not digitally signed" issue (fixes per session only)
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
$dryRun = $false;
$packages = 'packages.txt' #'packages-test.txt'
@copernicus365
copernicus365 / CommaSeparatedArrayModelBinder.cs
Created December 8, 2021 20:26
A model binder allowing ASP.NET Core binding of primitive arrays as query parameters, modified from: https://stackoverflow.com/q/65544525/264031
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Binders;
using Microsoft.Extensions.DependencyInjection;
@copernicus365
copernicus365 / ssl-alpn-test.txt
Created March 30, 2018 02:02 — forked from bobuva/ssl-alpn-test.txt
SSL ALPN Negotiation with .NET Core 2.1 Preview
using System;
using System.Threading;
using System.Collections.Generic;
using System.Net.Security;
using System.Net.Sockets;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
namespace ssltest
@copernicus365
copernicus365 / emoji-full-codes-csv-printout.csv
Created March 14, 2018 13:49
A comma-separated list of emoji values, containing 1) the emoji value itself (`char.ConvertFromUtf32(theDecimalNum)`), 2) its hex value representation, 3) its decimal / integer representation, and 4) the name. The code I wrote to generate this started by parsing the map contained here: https://github.com/ellekasai/twemoji-awesome/blob/gh-pages/v…
😄 1f604 128516 smile
😆 1f606 128518 laughing
😊 1f60a 128522 blush
😃 1f603 128515 smiley
263a 9786 relaxed
😏 1f60f 128527 smirk
😍 1f60d 128525 heart-eyes
😘 1f618 128536 kissing-heart
😚 1f61a 128538 kissing-closed-eyes
😳 1f633 128563 flushed
@copernicus365
copernicus365 / CryptoRandom.cs
Created November 8, 2017 20:45 — forked from niik/CryptoRandom.cs
Buffered CryptoRandom implementation based on Stephen Toub and Shawn Farkas' CryptoRandom
/*
* Original version by Stephen Toub and Shawn Farkas.
* Random pool and thread safety added by Markus Olsson (freakcode.com).
*
* Original source: http://msdn.microsoft.com/en-us/magazine/cc163367.aspx
*
* Some benchmarks (2009-03-18):
*
* Results produced by calling Next() 1 000 000 times on my machine (dual core 3Ghz)
*