Skip to content

Instantly share code, notes, and snippets.

@flee2free
flee2free / Toggle Theme.sh
Last active June 2, 2021 23:43
Alacritty - NVim : Upadate Light/Dark Mode
alacritty_theme() {
theme=$1
config_path=~/.config/alacritty/color.yml
if ! test -f "$config_path"; then
echo "$config_path does not exists"
return
fi
sed -i "" -e "s/^colors: \*.*/colors: *$theme/g" $config_path
@flee2free
flee2free / Config
Created May 7, 2021 13:22
Keyboard Maestro Launcher Macro
gre:
C1:
name: F14 Finder
hot_key: F14
code: 107
bundle: com.apple.finder
path: /System/Library/CoreServices/Finder.app
C2:
name: F15 Brave
hot_key: F15
@flee2free
flee2free / Anki Sequenced Renamer.py
Created April 22, 2021 09:56
Export the randomly generated study card as a PDF
import json
import os
import sqlite3
import zipfile
import glob
import re
import shutil
'''Renaming the ANKI media file with its original filename, once you rename upload these
to Google Drive - get the url mapped with file name and run tag_drive_path()'''
@flee2free
flee2free / rename.sh
Last active April 11, 2021 14:25
[Terminal File Rename] Renaming files in sequece using numeric sort #bash
ls | sort -n | rename -n 's/.+/our $i; sprintf("%02d.jpeg", 1+$i++)/e'
@flee2free
flee2free / anki_image_renamer_json.sql
Last active April 10, 2021 14:05
[ANKI Image File Rename] Extract the image resource, rename preserving the sort order #sql #anki
SELECT json_group_object(
trim(file_name), sequence_id
) AS json_result
FROM (select t2.sfld as file_name, t1.due, row_number() over (order by t1.due) as sequence_id
from cards t1
inner join (
select id, flds, sfld, mid
from notes
) t2
on t1.nid = t2.id
@flee2free
flee2free / image2pdf.sh
Last active April 11, 2021 14:24
[Image into PDF] Converting Images into PDF using PDF Make #javascript #bash
#!/bin/zsh
DIR=/Users/bbudhathoki/_Projects/Rejoice/create-pdf
rm -rf "$DIR/data/" "$DIR/pdfs/" 2> /dev/null
mkdir -p $DIR/{data,pdfs} 2> /dev/null
cp -rf ./ "$DIR/data/"
cd $DIR || exit
node ./index.js