Skip to content

Instantly share code, notes, and snippets.

View msmafra's full-sized avatar
🥶

Marcelo dos Santos Mafra msmafra

🥶
  • Brazil
  • 14:09 (UTC -03:00)
View GitHub Profile
#!/bin/bash
[[ "$(id -u)" -eq 0 ]] || (echo "Got root?" ; exit 5)
command -v btrfs > /dev/null || (echo "Command not found: btrfs" ; exit 4)
for folder in $* ; do
mount | awk '{print $3}' | grep "$(pwd)/${folder}" && echo "${folder} has a submount?" && exit 1
btrfs sub list . | grep "${PWD##*/}/${folder}" && echo "${folder} has a subvolume?" && exit 2
[ -e ${folder}.temp ] && echo "${folder}.temp already exists?" && exit 3 || true
mv ${folder} ${folder}.temp
btrfs sub create ${folder}
@msmafra
msmafra / get_latest_release.sh
Created May 18, 2025 21:01 — forked from lukechilds/get_latest_release.sh
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4

image

CachyOS Kernel for Fedora with Secure Boot

Did you just install kernel-cachyos and got hit by bad shim signature when booting? Me too. This is how I fixed it.

First, make sure you have Secure Boot with mokutil --sb-state.

Note, there's a second way of doing this by using sbctl, but I didn't want to wipe my Secure Boot keys.

Installing the CachyOS Kernel

@msmafra
msmafra / work-with-multiple-github-accounts.md
Created July 13, 2025 13:15 — forked from rahularity/work-with-multiple-github-accounts.md
How To Work With Multiple Github Accounts on your PC

How To Work With Multiple Github Accounts on a single Machine

Let suppose I have two github accounts, https://github.com/rahul-office and https://github.com/rahul-personal. Now i want to setup my mac to easily talk to both the github accounts.

NOTE: This logic can be extended to more than two accounts also. :)

The setup can be done in 5 easy steps:

Steps:

  • Step 1 : Create SSH keys for all accounts
  • Step 2 : Add SSH keys to SSH Agent
@msmafra
msmafra / using-details-summary-github.md
Created July 13, 2025 15:27 — forked from scmx/using-details-summary-github.md
Using <details> <summary> expandable content on GitHub with Markdown #details #summary #markdown #gfm #html

How to use <details> <summary> expandable content on GitHub with Markdown

Firstly, what is <details> <summary>?

The HTML Details Element (<details>) creates a disclosure widget in which information is visible only when the widget is toggled into an "open" state. A summary or label can be provided using the <summary> element. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details.

Example