Skip to content

Instantly share code, notes, and snippets.

View nilsandrey's full-sized avatar
🏠

Nils nilsandrey

🏠
View GitHub Profile
@nilsandrey
nilsandrey / responseTime-postman-tests-retryable.js
Created March 28, 2025 17:13
Response Time postman tests with retry option before failing. Useful for warming-up-needed scenarios.
pm.test("Response time is less than 1 second, retries up to 3 times", function () {
pm.expect(pm.response.responseTime).to.be.below(1000, "Response time should be less than 1 second");
let retries = 0;
while (pm.response.responseTime >= 1000 && retries < 3) {
pm.sendRequest(pm.request, function () {
pm.expect(pm.response.responseTime).to.be.below(1000, "Response time should be less than 1 second");
});
retries++;
}
@nilsandrey
nilsandrey / reload-profile.ps1
Created June 25, 2024 15:02
Reload your Powershell profile, credits to <https://stackoverflow.com/a/5501909/2100126>.
function Reload-Profile {
@(
$Profile.AllUsersAllHosts,
$Profile.AllUsersCurrentHost,
$Profile.CurrentUserAllHosts,
$Profile.CurrentUserCurrentHost
) | % {
if(Test-Path $_){
Write-Verbose "Running $_"
. $_
@nilsandrey
nilsandrey / update-AdrReadme.ps1
Created June 10, 2024 20:38
Create a README.md with the list of all ADRs found in the current folder, the status extracted from section "## Status" and the notes from first paragraph of the section "## Context"
## Take adrfolder from -Path switch command line argument and default to current directory
# Define the folder containing the ADR markdown files
$adrFolder = $args[0] -split ' ' | Where-Object { $_ -ne '' } | Select-Object -First 1
if (-not $adrFolder) { $adrFolder = $PSScriptRoot }
# Define the summary markdown file path
$summaryFile = "$adrFolder\README.md"
# Initialize an array to store ADR statuses and notes
$substringInName = "myservice-rc"
$exclusions = @("myservice-rc-tests", "myservice-rc-primary")
# Start watching for the pod
Watch-Pod -substringInName $substringInName -exclusions $exclusions
@nilsandrey
nilsandrey / DatabindingDebugConverter.cs
Created July 29, 2023 01:41
Use a ValueConverter to break into the debugger when having Debug Databinding Issues in WPF. (From: http://www.wpftutorial.net/DebugDataBinding.html)
using System;
using System.Diagnostics;
using System.Globalization;
using System.Windows.Data;
/// <summary>
/// This converter does nothing except breaking the
/// debugger into the convert method
/// </summary>
public class DatabindingDebugConverter : IValueConverter
@nilsandrey
nilsandrey / GetDataBaseMd5.sql
Last active July 11, 2023 23:13
Obtain an MD5 Checksum per table of all the rows content for all tables in a database.
DECLARE @table_name NVARCHAR(255);
DECLARE @sql NVARCHAR(MAX);
DECLARE @sep NVARCHAR(10);
DECLARE @md5_hash NVARCHAR(32);
DECLARE table_cursor CURSOR FOR
SELECT name FROM sys.tables;
OPEN table_cursor;
#!/bin/sh
ROTATION=$(shuf -n 1 -e '-' '')$(shuf -n 1 -e $(seq 0.05 .5))
convert -density 150 $1 \
-linear-stretch '1.5%x2%' \
-rotate ${ROTATION} \
-attenuate '0.01' \
+noise Multiplicative \
-colorspace 'gray' $2
@nilsandrey
nilsandrey / Autohotkey.ahk
Last active February 20, 2023 03:40
Autohotkey hotkeys
; IMPORTANT INFO ABOUT GETTING STARTED: Lines that start with a semicolon, such as this one, are comments. They are not executed.
; Help:
; # Win
; ! Alt
; ^ Ctrl
; + Shift
; < Izquiero del siguiente
; > Derecho del siguiente
:*:]d:: ; This hotstring replaces "]d" with the current date and time via the commands below.
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"segments": [
{
"leading_diamond": "\ue0b6",
"background": "#4da0e0",
"foreground": "#ffffff",
@nilsandrey
nilsandrey / atcb-adapter.scss
Created September 16, 2022 02:26
Archivo para personalizar el export to calendar
body {
@media (max-width: 900px) {
div.atcb_list {
width: 100% !important;
left: 0 !important;
border-radius: 0 !important;
bottom: 0 !important;
top: unset !important;
div.atcb_list_item {