Skip to content

Instantly share code, notes, and snippets.

@sahal
sahal / REMAP_KEYBOARD_KEYS.md
Last active March 7, 2024 21:30
Now that Wayland is default in KDE6, I have to find an alternative way to remap keys
@sahal
sahal / 00_redact_and_rasterize.md
Created March 2, 2024 17:14
Split PDF using Okular, pdfimages, ImageMagick, pdfchain to resize, grayscale, and combine pdfs

Okular

Multi-platform, fast and packed with features, Okular allows you to read PDF documents, comics and EPub books, browse images, visualize Markdown documents, and much more.

Okular

Redact

Use Okular (or similar) to add annotations that cover up the parts of the PDF that you want to redact (i.e. passwords, socials, etc)

@sahal
sahal / Generate Anki Decks for CLEP Biology Essentials Exambusters Flash Cards.md
Last active December 30, 2023 03:02
Generate Anki Decks for CLEP Biology Essentials Exambusters Flash Cards

Note

I'm not including the original epub or the resultant Anki deck as I'm sure its still copyrighted. I'm sure you can find what you need elsewhere.

1. Use Calibre to convert the epub to pdf

See https://manual.calibre-ebook.com/en/conversion.html

2. Rename the file to make it easier to work with on the CLI

@sahal
sahal / netctl wifi restart script.md
Last active December 30, 2023 03:02
netctl wifi restart script

restart-wifi.sh

I use this script because netctl is kinda annoying to use otherwise.

Change Wifi Device state

I've been turning off my wifi device using ip as follows:

@sahal
sahal / youtube-dl-options.md
Last active July 17, 2023 21:27
youtube dl options

youtube-dl options

How to use an external downloader aria2c rather than internal http client. See also: ytdl-org/youtube-dl#6923

This seemed to work at the following commit hash. YMMV.

$ git remote show origin
* remote origin
 Fetch URL: git@github.com:ytdl-org/youtube-dl.git
@sahal
sahal / mycolorscheme.vim
Created July 27, 2022 19:02
mycolorscheme.vim
" ~/.vim/colors/mycolorscheme.vim
" https://stackoverflow.com/questions/2019281/load-different-colorscheme-when-using-vimdiff
highlight DiffAdd cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red
highlight DiffDelete cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red
highlight DiffChange cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red
highlight DiffText cterm=bold ctermfg=10 ctermbg=88 gui=none guifg=bg guibg=Red
@sahal
sahal / update-branch-name.sh
Created July 27, 2022 18:59
Github suggestion when you rename a branch
git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a
@sahal
sahal / README.md
Created July 14, 2022 23:16
concatonate (merge) mp4s using ffmpeg

Get a list of files

  • Assuming the files have some sort of number indicating their order in their filename.
find $(pwd) -maxdepth 1 -type f -name "*.mp4" | xargs -I "{}" echo file \'"{}"\' | sort | tee output.txt

FFmpeg

@sahal
sahal / jenkins-dump-credentials.groovy
Last active August 13, 2020 19:18 — forked from jbouse/jenkins-dump-credentials.groovy
Dump jenkins credentials - use in script console
import com.cloudbees.plugins.credentials.*
import com.cloudbees.plugins.credentials.common.*
import com.cloudbees.plugins.credentials.domains.*
import com.cloudbees.plugins.credentials.impl.*
import org.jenkinsci.plugins.plaincredentials.impl.*
domain = Domain.global()
store = SystemCredentialsProvider.getInstance().getStore()
for (credential in store.getCredentials(domain)) {