Skip to content

Instantly share code, notes, and snippets.

@ajitid
ajitid / kitty-emoji-wsl2.md
Last active March 19, 2021 06:57
Emoji font for kitty in WSL2
sudo apt install fonts-noto-color-emoji

For themes, use https://github.com/adi1090x/kitty-cat. This modifies config a lot so do this first before applying any kitty config. Mostly it changes font properties and margin.

@ajitid
ajitid / load-script.js
Last active April 27, 2023 05:29
Load scripts in Chrome by putting this in DevTools > Sources > Snippets
'use script'
function loadScript(filePath, cacheBuster = `?bust=${new Date().getTime()}`) {
const scriptTag = document.createElement('script');
scriptTag.onload = () => console.log('loaded');
scriptTag.type = 'text/javascript';
scriptTag.src = `${filePath}${cacheBuster}`;
document.querySelector('head').appendChild(scriptTag);
}
@ajitid
ajitid / check-type.ts
Last active June 1, 2021 20:53
validate string, number and object
export function isNumber(input: unknown): input is number {
return Number.isFinite(input);
}
export function isString(input: unknown): input is string {
return typeof input === 'string';
}
export function isObject(input: unknown): input is object {
return input !== null && typeof input === 'object';
@ajitid
ajitid / readme.md
Last active July 22, 2024 16:24
Up — Go up till you get to a directory that contains the folder name that you've specified

Up

Go up till you get to a directory that contains the folder name that you've specified.

Usage

Using just up results in cd ...

If you have a dir structure like:

@ajitid
ajitid / Default.sublime-commands
Last active June 15, 2022 02:34
Get notification on Git push when using Windows CLIs/Sublime Merge/Fork
[
{
"caption": "Create an Empty Commit...",
"command": "git",
"args": { "argv": ["commit", "--allow-empty", "-m", "$text"] }
},
{
"caption": "Delete Remote Tag (origin)...",
"command": "git",
"args": { "argv": ["push", "--delete", "origin", "$text"] }
@ajitid
ajitid / readme.md
Last active September 26, 2024 08:59
Collection

A collection of interesting and useful things

Other repositories I've created

  • An extension to invoke Sublime Merge commands in VS Code
  • Goparsify - A parser cominator library that lets you parse text and give meaning to the items in it
  • Lastly - Get song link for various music streaming platforms using Last.fm
  • Live server on Python
  • My dotfiles
@ajitid
ajitid / butt.fish
Last active July 29, 2021 14:24
🍑 Butt - Target a dir in PWD
function butt
if [ "$argv[1]" = "" ]
echo "Please provide a dir name"
return 1
end
set -l up_times 0
set -l found 0
set -l path (string sub --start 2 $PWD)
@ajitid
ajitid / parseMdLinks.ts
Last active September 1, 2021 04:39
Parse Markdown links (not safe as its usage might create XSS attack vector)
@ajitid
ajitid / s.fish
Created July 25, 2021 15:06
automate vim using neovim-remote
function jqdoprocessoneach
# https://stackoverflow.com/a/965106/7683365
set -l old_file_path $argv[1]
set -l new_filename $argv[2]"."(echo $argv[1] | sed 's/.*\.//')
echo $old_file_path
# echo $new_filename
# sleep 1
nvr --remote-send '<cmd>e '$old_file_path'<cr>'
sleep 1