Skip to content

Instantly share code, notes, and snippets.

View bruno-brant's full-sized avatar
🏠
Working from home

Bruno Brant bruno-brant

🏠
Working from home
View GitHub Profile
@bruno-brant
bruno-brant / New-DependencyGraph.ps1
Last active September 16, 2022 14:12
Creates a dependency graph for a .NET assembly.
param (
[System.IO.FileInfo] $First,
[string] $OutputFormat = "dot",
[string] $OutputPath
)
$ErrorActionPreference = "stop"
class NodeRelation {
[string]$Start;
@bruno-brant
bruno-brant / README.md
Last active May 9, 2023 20:29
Essential .NET Libraries

Essential .NET Libraries

A few libraries that we can leverage on most projects to make our life easier:

  1. AnyOf - Sort of union types for .NET.

  2. SuccincT - Adds some functional features to .NET, with helpers such as pipe operators and partial function applications.

  3. IntelliEnum - Typed Enums for free.

@bruno-brant
bruno-brant / concentration.py
Last active November 18, 2023 13:38
Small experiment I wrote for myself to understand the concentration of molecules in the body considering their half-life and daily intake.
def concentration_after(initial_dosage, age, half_life):
"""
Age is the number of days, dosage is the amount (in mg) that was applyed at
the day 0
:param initial_dosage: Initial dosage
:param age: how many hours since the dosage
:param half_life: how many hours for a half-life of the molecule
"""
return initial_dosage * 0.5 ** (age / half_life)
@bruno-brant
bruno-brant / ConvertTo-UNCPath.ps1
Created December 28, 2023 19:07
PowerShell Toolbox
param (
[Parameter(Mandatory=$true)]
[string]$RelativePath
)
$ComputerName = $env:COMPUTERNAME
$AbsolutePath = Convert-Path $RelativePath
$UNCPath = $AbsolutePath -replace "^([A-Za-z]):", '$1$'
$UNCPath = $UNCPath -replace '\\', '\'
$UNCPath = "\\$ComputerName\$UNCPath"
@bruno-brant
bruno-brant / Toolbox.ps1
Last active May 9, 2024 19:52
PowerShell Toolbox
<#
.SUMMARY
Restart a list of computers using shutdown.exe.
#>
function Invoke-ComputerRestart {
[CmdletBinding()]
param (
# List of computers to shutdown
[Parameter(ValueFromPipeline = $true)]
[string[]]$Computer,
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\OpenWithCursor]
@="Open with Cursor"
"Icon"="C:\\Users\\heavy\\AppData\\Local\\Programs\\cursor\\Cursor.exe"
[HKEY_CLASSES_ROOT\Directory\shell\OpenWithCursor\command]
@="\"c:\Users\heavy\AppData\Local\Programs\cursor\resources\app\bin\cursor.cmd\" \"%V\""
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenWithCursor]