Skip to content

Instantly share code, notes, and snippets.

View cesalazar's full-sized avatar
👾
404 - Status not found

Carlos E. Salazar cesalazar

👾
404 - Status not found
View GitHub Profile
@cesalazar
cesalazar / playerctl-notification.sh
Created August 30, 2021 00:37
Display playerctl's metadata in a notification
#!/bin/bash
#
# Display playerctl's metadata in a notification
# Debug options
# set -euxo pipefail
metadata=$(playerctl metadata)
notification_icon=${1}
@cesalazar
cesalazar / coln.sh
Last active September 1, 2021 19:58
Create symlinks inside of an Obsidian vault, pointing to files located outside of the vault
#!/bin/bash
#
# Create inside of an Obsidian vault symlinks to files located elsewhere
# Debug options
# set -euxo pipefail
# Obsidian vault where the symlinks will be created
vault=${HOME}/Sync/obsidian/obsidian-vault/no-sync
@cesalazar
cesalazar / auto-switch-node-version.zsh
Last active December 7, 2021 22:44
Automatically changes NodeJS version using `n` node package in zsh
# hooks onto `chpwd` with the official util `add-zsh-hook`
# `export N=false` to disable auto-switching versions
function auto-switch-node-version() {
# track if the version changed
local changed=false
# exit early
[[ ${N} == false || ! $(command -v n) ]] && return
# attempt to change the version based on the "engine" entry in package.json
@cesalazar
cesalazar / switch-screenlayout.sh
Last active March 22, 2022 17:39
Switch the layout of the connected monitors
#!/bin/bash
#
# ╔═════╗ ╔═══╗
# ║ S ║ ║ V ║ Screen Layout Switcher
# ╚═════╝ ║ ║
# ╔═════╗ ╚═══╝ Handle switching the layout of the connected monitors:
# ║ P ║ (S)econdary, (V)ertical, and (P)rimary
# ╚═════╝ Usage: ./switch-screenlayout.sh [1-4]
# Debug options
@cesalazar
cesalazar / user-overrides.js
Created August 6, 2022 11:37 — forked from MagicalDrizzle/user-overrides.js
my personal overrides for every new firefox profile
/* my overrides */
// https://github.com/arkenfox/user.js/
/* override recipe: enable session restore ***/
/* 0102: set startup page [SETUP-CHROME]
* 0=blank, 1=home, 2=last visited page, 3=resume previous session
* [NOTE] Session Restore is cleared with history (2811, 2812), and not used in Private Browsing mode
* [SETTING] General>Startup>Restore previous session ***/
user_pref("browser.startup.page", 3);
/* 1003: disable storing extra session data [SETUP-CHROME]
@cesalazar
cesalazar / git-clone-and-auto-cd
Last active September 27, 2022 10:56
Clone a git repository and cd into its directory
#!/bin/bash
#
# Clone a git repository and cd into it
#
# NOTE: this file needs to be *sourced*. E.g.
# alias gclin="source /path/to/git-clone-and-auto-cd.sh"
#
# (my personal mnemonic for (g)it (cl)one (in))
# gclin https://github.com/cesalazar/.vim.git my_vim
@cesalazar
cesalazar / fix-qt.sh
Last active October 13, 2023 15:39
Fix qt after upgrading packages
#!/bin/bash
#
# Packages installed from AUR that use anything Qt related, fail to start after
# upgrading.
#
# So far this seems to be the solution, that I had googled now at least 3 times
# after breaking some apps:
# "Reinstall qt5-styleplugins from scratch. Do NOT use the cached download"
yay -S --answerclean All --answerdiff None --answeredit None \
@cesalazar
cesalazar / pimp-yt-player.css
Last active December 25, 2023 22:03
Hides some YouTube annoyances, and add some visual tweaking.
/* Rules for Stylus
* https://addons.mozilla.org/en-US/firefox/addon/styl-us/
*/
/* Hide the annoying (i) button on the top-right corner */
.ytp-chrome-top-buttons {
display: none;
}
/* Display the controls and title only on hover */
@cesalazar
cesalazar / .gitaliases
Last active April 21, 2024 12:13
My git aliases
# Use in ~/.gitconfig like this:
#
# [include]
# path = ~/.gitaliases
[alias]
# Attempt to write to the clipboard using xsel or xclip; fails silently
set-clipboard = !xsel -ib &> /dev/null || \
xclip -selection clipboard -in &> /dev/null
@cesalazar
cesalazar / c
Created April 21, 2024 12:35
Open config files in $EDITOR
#!/bin/bash
#
# Provides easy access to editing config files.
files=
list_configs() {
printf "%s\n" "Configs available:" " "
sed -n '/case $i in/,/esac/p' "$0" \