Skip to content

Instantly share code, notes, and snippets.

View nilsandrey's full-sized avatar
🏠

Nils nilsandrey

🏠
View GitHub Profile
$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.
@nilsandrey
nilsandrey / name-shortening functions.js
Last active February 18, 2023 12:40
Name-shortening functions from Hacker News own JS for web site
// From yesenadam at https://news.ycombinator.com/item?id=23590848
function $(id) { return document.getElementById(id); }
function byClass (el, cl) { return el ? el.getElementsByClassName(cl) : [] }
function byTag (el, tg) { return el ? el.getElementsByTagName(tg) : [] }
function allof (cl) { return byClass(document, cl) }
function hasClass (el, cl) { var a = el.className.split(' '); return afind(cl, a) }
function addClass (el, cl) { if (el) { var a = el.className.split(' '); if (!afind(cl, a)) { a.unshift(cl); el.className = a.join(' ')}} }
function remClass (el, cl) { if (el) { var a = el.className.split(' '); arem(a, cl); el.className = a.join(' ') } }
function html (el) { return el ? el.innerHTML : null; }
{
"$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 {
@nilsandrey
nilsandrey / react-useTimeout.hook.js
Last active August 10, 2022 00:31
React useTimeout hook (by Chris Bongers)
// From <https://dev.to/dailydevtips1/react-cleaner-use-of-settimeout-105m>
import { useCallback, useEffect, useRef, useMemo } from 'react';
/**
* To use the hook
* ```
* import useTimeout from './useTimeout';
*
* const [timeout] = useTimeout(() => {
* setShow(false);
@nilsandrey
nilsandrey / gist:99f9a9eaf809dcaea5cb748b1563a778
Created July 6, 2022 02:59 — forked from Mikodes/gist:be9b9ce42e46c3d4ccb6
All Media queries for resolutions
/* (320x480) iPhone (Original, 3G, 3GS) */
@media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
/* insert styles here */
}
/* (320x480) Smartphone, Portrait */
@media only screen and (device-width: 320px) and (orientation: portrait) {
/* insert styles here */
}