Skip to content

Instantly share code, notes, and snippets.

View CodesOfRishi's full-sized avatar
🏠
Working from home

Rishi K. CodesOfRishi

🏠
Working from home
View GitHub Profile
@CodesOfRishi
CodesOfRishi / .caps-lock-delay-fix.sh
Created December 7, 2021 03:53
Linux Caps-Lock Delay Fix
#!/bin/sh
xkbcomp -xkb "$DISPLAY" - | sed 's#key <CAPS>.*#key <CAPS> {\
repeat=no,\
type[group1]="ALPHABETIC",\
symbols[group1]=[ Caps_Lock, Caps_Lock],\
actions[group1]=[ LockMods(modifiers=Lock),\
Private(type=3,data[0]=1,data[1]=3,data[2]=3)]\
};\
#' | xkbcomp -w 0 - "$DISPLAY"
@CodesOfRishi
CodesOfRishi / overload-relational-stl.cpp
Created December 7, 2021 03:56
Overloading Relational Operator for a STL Class
// overloading relational operator for a STL class
bool operator<(const Name &rhs) const { return value < rhs.value; }
bool operator==(const Name &rhs) const { return value == rhs.value; }
@CodesOfRishi
CodesOfRishi / dbg-macro-features.md
Created December 7, 2021 04:06
Usage description of dbg-macro

Reference

MULTIPLE ARGUMENTS

You can pass multiple arguments to the dbg(…) macro. The output of dbg(x, y, z) is same as dbg(x); dbg(y); dbg(z);:

dbg(42, "hello world", false);

Note that you have to wrap "unprotected commas" in parentheses:

@CodesOfRishi
CodesOfRishi / san.ps1
Last active July 23, 2022 05:01
Sanitize/Un-sanitize URL/IP
# Sanitize/Un-sanitize a URL/IP - RishiK.
while (1) {
if ($args[0]) {
$url=$args[0]
}
else {
$url = Read-Host "Enter URL/IP >>"
}
@CodesOfRishi
CodesOfRishi / RishiPowerShell.psm1
Last active October 3, 2023 05:37
PowerShell Custom Module
# Location: ($env:PSModulePath | ForEach-Object { ([string]$_).Split(";")[0] })\RishiPowerShell
# Rishi K. (CodesOfRishi)
# Bulk nslookup
function Resolve-Host {#{{{
param (
[Parameter(Mandatory=$false)]
[string]$OutputSeparator = "`n",
[switch]$ChangeList,