Skip to content

Instantly share code, notes, and snippets.

View fredimachado's full-sized avatar

Fredi Machado fredimachado

View GitHub Profile
@davidfowl
davidfowl / MinimalAPIs.md
Last active May 1, 2024 20:58
Minimal APIs at a glance
using namespace System.Management.Automation
using namespace System.Management.Automation.Language
if ($host.Name -eq 'ConsoleHost')
{
Import-Module PSReadLine
}
#Import-Module PSColors
#Import-Module posh-git
Import-Module -Name Terminal-Icons
@AArnott
AArnott / ConcurrentVsOrdinaryDictionary.cs
Last active May 11, 2022 08:33
The .NET Concurrent collections are often used as a thread-safe version of the ordinary collections. But they are *far* slower and heavier on GC pressure than simply adding a `lock` around use of the ordinary collections. Avoid the concurrent collections except in highly concurrent scenarios where you see high lock contention and therefore may b…
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
class Program
{
static void Main(string[] args)
{
var ordinary = RunTest(OrdinaryDictionaryRun);
@craigtp
craigtp / AdvancedDistributedSystemDesignCourseNotes.md
Created May 1, 2020 19:38
Notes on Udi Dahan's Advanced Distributed System Design Course

Advanced Distributed System Design Course - Udi Dahan

Notes by Craig Phillips

Fallacies of Distributed Computing

  • There are 11 fallacies of Distributed Computing:
    1. The network is reliable
    2. Latency isn’t a problem
    3. Bandwidth isn’t a problem
    4. The network is secure
  1. The topology won’t change
@olilarkin
olilarkin / IPlugOverSampler.cpp
Last active August 20, 2021 07:34
IPlugOverSampler
#include "IPlugOverSampler.h"
#include "IPlug_include_in_plug_src.h"
IPlugOverSampler::IPlugOverSampler(const InstanceInfo& instanceInfo)
: Plugin(instanceInfo, MakeConfig(kNumParams, kNumPrograms))
{
GetParam(kGain)->InitDouble("Gain", 1., 1., 100.0, 0.01, "*");
GetParam(kOverSampling)->InitEnum("OverSampling", 0, 5, "", 0, "", OVERSAMPLING_FACTORS_VA_LIST);
}
@AArnott
AArnott / PatGenerator.cs
Created April 8, 2019 20:51
Securely generates new PATs. Useful for a service that wants to issue PATs to users.
using System;
using System.Security.Cryptography;
public static class SecurityUtilities
{
static void Main(string[] args)
{
Console.WriteLine(GeneratePat());
Console.WriteLine(GeneratePat());
Console.WriteLine(GeneratePat());
@AArnott
AArnott / Cancellation.cs
Last active December 12, 2023 16:33
Graceful console app cancellation on Ctrl+C
class Program
{
static async Task Main(string[] args)
{
// Add this to your C# console app's Main method to give yourself
// a CancellationToken that is canceled when the user hits Ctrl+C.
var cts = new CancellationTokenSource();
Console.CancelKeyPress += (s, e) =>
{
Console.WriteLine("Canceling...");
@alirobe
alirobe / reclaimWindows10.ps1
Last active April 26, 2024 17:59
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
###
@mhitza
mhitza / Makefile
Last active April 6, 2024 17:20
Programming Arduino Uno (ATmega386P) in assembly
%.hex: %.asm
avra -fI $<
rm *.eep.hex *.obj *.cof
all: $(patsubst %.asm,%.hex,$(wildcard *.asm))
upload: ${program}.hex
avrdude -c arduino -p m328p -P /dev/arduino-uno -b 115200 -U flash:w:$<
monitor: