Skip to content

Instantly share code, notes, and snippets.

View copernicus365's full-sized avatar

Nicholas Petersen copernicus365

  • Huber Heights, Ohio
View GitHub Profile

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)
*
using System;
using System.Collections.Generic;
using System.Linq;
using DotNetXtensions;
using static System.Console;
namespace Play1
{
public class Prog
{
@copernicus365
copernicus365 / ColorRGB.cs
Last active September 3, 2019 04:12
ColorRGB - C# hex color parser that gets the R,G,B values of the hex color as well as it's Luminance, YIC, and IsDark values.
using System;
using System.Collections.Generic;
using System.Globalization;
namespace DotNetXtensions
{
public struct ColorRGB
{
public byte R { get; private set; }