Skip to content

Instantly share code, notes, and snippets.

SET WEBHOOK_URL=<your_webhook_url>
curl ^
-H "Content-Type: application/json" ^
-d "{\"content\": \"<your message>\"}" ^
%WEBHOOK_URL%
@eduherminio
eduherminio / heic-to-jpg
Created October 17, 2022 12:57
HEIC to JPG
Based on https://blog.jjhayes.net/wp/2020/09/03/open-source-heic-to-jpg-conversion/
1. Download ImageMagick (portable editions available)
https://imagemagick.org/script/download.php
2. Extract the magick executable
3. Move the directory with your .heic pictures at the same level of the executable
4. Execute the conversion by:
@eduherminio
eduherminio / Day_XX.cs
Last active November 13, 2022 22:56
AoC Day VS template
namespace $rootnamespace$;
public class $itemname$ : BaseDay
{
private readonly List<string> _input;
public $itemname$()
{
_input = ParseInput();
}
@eduherminio
eduherminio / setup.ps1
Created September 15, 2020 18:06
Basic .NET Core WebApi setup (.net core 3.1)
$projectName = ""
mkdir src && cd src
dotnet new classlib -n "$projectName"
dotnet new webapi -n "$projectName.Api"
cd ..
mkdir tests && cd tests
dotnet new xunit -n "$projectName.Test"
cd ..
dotnet new sln -n "${projectName}Solution"
@eduherminio
eduherminio / DateId
Last active November 1, 2020 20:55
DateId() helper method useful for naming files/dirs
# C#
public static string DateId() => DateTime.Now.ToString("yyyy'-'MM'-'dd'__'HH'_'mm'_'ss");
# Bash
date +%Y-%m-%d__%H_%M_%S
@eduherminio
eduherminio / show_wifi_password.bat
Created March 20, 2020 22:34
Reveals a WiFi password already saved in a Windows machine
netsh wlan show profile <wifi_name> key=clear
@eduherminio
eduherminio / package_search.linq
Last active June 13, 2020 19:43
Finds repositories with a given package as a dependency within a GitHub organization
<Query Kind="Program">
<NuGetReference>Octokit</NuGetReference>
<Namespace>Octokit</Namespace>
</Query>
void Main()
{
const string packageName = "MyPackage";
var searchResult = new RepositoryFinder()
@eduherminio
eduherminio / DockerCheatsheet.md
Last active September 23, 2021 13:34
Docker commands and shortcuts

Disclaimer: use under your own responsibility

Containers

Enter a container

docker exec -it <container> bash / docker exec -it <container> cmd

Attach standard input/output to container process, preventing ctrl+c to close it

docker attach --sig-proxy=false <container>

@eduherminio
eduherminio / ExtractVersion.ps1
Created February 6, 2020 23:02
Extract package version from .csproj using powershell
$packageToFind = "Xxxxx"
$found = (cat .\Project.csproj | Where { $_.Contains($packageToFind) }) -match '\d*\.\d*\.\d*'
if ($found) {
$packageVersion = $matches[0]
Write-Host "Package version for ${packageToFind}: $packageVersion"
}
else{
Write-Host "Package version for ${packageToFind} not found"
}
@eduherminio
eduherminio / nswag.json
Last active July 19, 2020 22:25
config.nswag sample
{
"runtime": "NetCore31",
"defaultVariables": null,
"documentGenerator": {
"aspNetCoreToOpenApi": {
"project": null,
"msBuildProjectExtensionsPath": null,
"configuration": null,
"runtime": null,
"targetFramework": null,