Skip to content

Instantly share code, notes, and snippets.

View fredimachado's full-sized avatar

Fredi Machado fredimachado

View GitHub Profile
@Fonserbc
Fonserbc / Easing.cs
Last active August 27, 2024 23:41
Compact and simple easing functions for Unity
using UnityEngine;
/*
* Most functions taken from Tween.js - Licensed under the MIT license
* at https://github.com/sole/tween.js
* Quadratic.Bezier by @fonserbc - Licensed under WTFPL license
*/
public delegate float EasingFunction(float k);
public class Easing
@mhitza
mhitza / Makefile
Last active November 14, 2024 15:44
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:
@alirobe
alirobe / reclaimWindows10.ps1
Last active November 15, 2024 12:08
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
###
###
@AArnott
AArnott / Cancellation.cs
Last active October 16, 2024 17:10
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...");
@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());
@olilarkin
olilarkin / IPlugOverSampler.cpp
Last active June 14, 2024 12:21
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);
}
@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
@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);
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