Skip to content

Instantly share code, notes, and snippets.

@sebastiancarlos
sebastiancarlos / get-terminal-cwd.bash
Last active November 10, 2023 16:47
sway-use-workspace-cwd
#!/usr/bin/env bash
# All my gist code is licensed under the MIT license.
# Add this to your PATH
# if calling without arguments or with -h or --help, print usage
if [[ $# -eq 0 ]] || [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then
echo "Usage: get-terminal-cwd <terminal-pid>"
echo " - return the CWD of the terminal with the given PID"
@sebastiancarlos
sebastiancarlos / glibc-charset-aliases.txt
Last active November 2, 2023 12:43
Tree structure of glibc character sets and their aliases.
# Tree structure of glibc character sets and their aliases.
#
# - Generated with: print-glibc-charset-aliases.bash
# - For glibc 2.38
#
# - Format:
# TARGET
# \_ ALIAS
# \_ ALIAS
# ...
@sebastiancarlos
sebastiancarlos / runasm.bash
Last active December 15, 2024 18:36
runasm - run assembly scripts from your terminal without compiling
#!/usr/bin/env bash
# All my gist code is licensed under the MIT license.
# Video demo: https://www.youtube.com/watch?v=kNKuRdoaNII
# runasm - Assemble, link, and run multiple assembly files, then delete them.
if [[ $# -eq 0 ]]; then
echo "Usage: runasm <file1.s> [<file2.s> ...]"
echo " - Assemble, link, and run multiple assembly files, then delete them."
#!/usr/bin/env bash
# All my gist code is licensed under the MIT license.
# Video demo: https://www.youtube.com/watch?v=2tRyBQqJdrc
# Note: In some browsers you need to type "g/" instead of just "g" so it gets
# recognized as a URL and not as a term for the default search engine.
# source of truth for URL aliases
@sebastiancarlos
sebastiancarlos / colorcat.bash
Last active March 21, 2025 16:39
Cross-app URL aliases (like shell aliases) powered by Nginx.
#!/usr/bin/env bash
# All my gist code is licensed under the MIT license.
# Video demo: https://www.youtube.com/watch?v=y542zPAPeG4
# colorcat
# - cats a file, but if any line contains N hex colors, it appends the colors
# (rendered as ansi escape sequences) to the end of the line.
# - input can be stdin, a file, or a hex color in plain text
@sebastiancarlos
sebastiancarlos / rfc.bash
Last active August 21, 2024 00:46
Read RFCs from your terminal
#!/usr/bin/env bash
# All my gist code is licensed under the MIT license.
# Video demo: https://www.youtube.com/watch?v=Ypqf2IFc62I
# rfc
# - fetches and renders an RFC into less
# - from www.rfc-editor.org
# - if called with -l/--list, lists all RFCs in descending order
@sebastiancarlos
sebastiancarlos / fonts.bash
Last active December 15, 2024 18:37
Check your OS fonts from your terminal
#!/usr/bin/env bash
# Video demo: N/A (This script is so dank that YouTube took down my video without explanation)
# Add this to your ~/.bashrc
# custom fc-list
# - sort list
# - add color
# - format table output
@sebastiancarlos
sebastiancarlos / info-man.bash
Last active October 27, 2023 10:34
Efficient info command, interoperable man command
#!/usr/bin/env bash
# All my gist code is licensed under the terms of the MIT license.
# Video demo: https://www.youtube.com/watch?v=ISKzBlzXRWE
# Add this to your .bashrc:
# get the texinfo node for a command
# - takes a command name, like 'cat'
@sebastiancarlos
sebastiancarlos / diffc-diffh.bash
Last active August 15, 2024 06:07
Custom variations of diff: diffh (diff history) and diffc (diff commands)
#!/usr/bin/env bash
# All my gist code is licensed under the terms of the MIT license.
# Video demo: https://www.youtube.com/watch?v=nf3ddQniw-o
# diffc - diff commands
# - allows to call as: diffc 'command one' 'command two'
# instead of: diff <(command one) <(command two)
# (Just to save typing a few characters. Lol I'm a lazy programmer)
@sebastiancarlos
sebastiancarlos / useradd-color.bash
Created September 11, 2023 09:30
Custom version of useradd which adds color and extra information to "useradd --defaults"
#!/usr/bin/env bash
# All my gist code is licensed under the terms of the MIT license.
### Make sure this file is visible from your $PATH and called 'useradd'
# Video demo: https://www.youtube.com/watch?v=Nzl2YzYDFlI
### Sample output:
#