Skip to content

Instantly share code, notes, and snippets.

Avatar

Ernest Mallett DCCoder90

View GitHub Profile
@DCCoder90
DCCoder90 / IncList.cs
Created Jul 23, 2020
Very simple generic increment/decremental list
View IncList.cs
public class IncList<T>
{
private readonly IDictionary<T,int> _incList;
public IncList()
{
_incList = new Dictionary<T, int>();
}
public void Add(T item)
@DCCoder90
DCCoder90 / binary.cs
Created Sep 30, 2019
Quick and dirty example of a binary search (using LinqPad)
View binary.cs
void Main()
{
int[] intArray = new int[]{ 51,83,2523,2452,124,656,254,115,15,5,5,15,156,4378,568,4,37,2,72,2,8,9,10,234,39,23,56,1,63,33};
var list = intArray.ToList();
list.Sort();
var find = search(list,656);
find.Dump();
}
@DCCoder90
DCCoder90 / GOL.cs
Created Jul 16, 2019
Simple Game of Life. Need to test to make sure it's following all the rules.
View GOL.cs
internal class GOL
{
private int _genCounter = 0;
private bool[,] _board;
private int _boardSize;
public void Play()
{
Initialize(30);
PrintBoard();
@DCCoder90
DCCoder90 / AsyncEnumerableExtensions.cs
Created May 25, 2019
Convert IEnumerable to IAsyncEnumerable
View AsyncEnumerableExtensions.cs
public static class AsyncEnumerableExtensions
{
public static IAsyncEnumerable<TResult> SelectAsync<T, TResult>(this IEnumerable<T> enumerable,
Func<T, Task<TResult>> selector)
{
return AsyncEnumerable.CreateEnumerable(() =>
{
var enumerator = enumerable.GetEnumerator();
var current = default(TResult);
@DCCoder90
DCCoder90 / SecretManagerExample.cs
Created Jan 1, 2019
Working with AWS Secret Manager
View SecretManagerExample.cs
var awsCredentials = new BasicAWSCredentials("someaccesskey", "somesecretkey");
var secretManager = new SecretManager(awsCredentials);
secretManager.StoreSecret("somesecretKey","mysecret","Just some test secret I wanted to try");
View AWSSecretManager.cs
internal class SecretManager
{
private readonly AWSCredentials _credentials;
private readonly AmazonSecretsManagerConfig _config;
private readonly AmazonSecretsManagerClient _client;
public SecretManager(AWSCredentials creds)
{
_credentials = creds;
_config = new AmazonSecretsManagerConfig { RegionEndpoint = RegionEndpoint.USEast2 };
@DCCoder90
DCCoder90 / decrapify.ps1
Created Dec 21, 2018
Windows Decrapifier
View decrapify.ps1
#Windows 10 Decrapifier 1803/1809
#By CSAND
#Nov 14 2018
#
#
#PURPOSE: Eliminate much of the bloat that comes with Windows 10. Change many privacy settings to be off by default. Remove built-in advertising, Cortana, OneDrive, Cortana stuff (all optional). Disable some data collection.
# Clean up the start menu for new user accounts. Remove a bunch of pre-installed apps, or all of them (including the store). Create a more professional looking W10 experience. Changes some settings no longer
# available via GPO for Professional edition.
#
#DISCLAIMER: Most of the changes are easily undone, but some like removing the store are difficult to undo. I encourage you to research these changes beforehand, and read through the script.
@DCCoder90
DCCoder90 / EntityBuilder.cs
Created Dec 6, 2018
Creates objects at runtime to store information
View EntityBuilder.cs
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Reflection.Emit;
namespace EntityBuilder
{
internal class EntityBuilder
{
private readonly IDictionary<string, Type> _cache;
@DCCoder90
DCCoder90 / DataChecker.cs
Created Nov 1, 2018
Dictionary Switch - Proves that you can use a dictionary to work the same as a switch making it easier to maintain and more flexible.
View DataChecker.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DictionarySwitch
{
public class DataChecker
{
@DCCoder90
DCCoder90 / Program.cs
Created Sep 19, 2018
For micro-api tutorial
View Program.cs
using System;
using Microsoft.Owin.Hosting;
namespace SelfHosted{
class Program{
static void Main(string[] args){
using (WebApp.Start("http://localhost:8080")){
Console.WriteLine("Web Server is running.");
Console.WriteLine("Press any key to quit.");
Console.ReadLine();
You can’t perform that action at this time.