Skip to content

Instantly share code, notes, and snippets.

@memchr
memchr / import_env
Created August 28, 2023 18:43
import_env
#!/usr/bin/env bash
set -e
[[ -n $HYPRLAND_DEBUG_CONF ]] && exit 0
USAGE="\
Import environment variables
Usgae: $0 <command>
Commands:
@juxuanu
juxuanu / auto-protonvpn.md
Last active January 12, 2024 09:22
Systemd user service to autoconnect to ProtonVPN through their the CLI utility

Service definition: ~/.config/systemd/user/auto-protonvpn.service

[Unit]
Description=ProtonVPN Connection
After=network-online.target
BindsTo=network-online.target

[Service]
Type=oneshot
ExecStart=/usr/bin/protonvpn-cli ks --off ; /usr/bin/protonvpn-cli connect -f

yt-dlp termux full installation guide.md

Prepare

  1. Install Termux from Github: https://github.com/termux/termux-app/releases
  2. Download the apk and install it -> Note that installing termux from Play Store is highly discouraged.

In Termux:

pkg update
@quangIO
quangIO / wezterm.lua
Created March 15, 2022 15:08
My wezterm config with tmux-like bindings
local wezterm = require 'wezterm';
return {
color_scheme = "Dracula",
-- colors = {
-- background = "#0c0e14",
-- },
window_decorations = "NONE",
font = wezterm.font("Iosevka"),
font_size = 10.0,
-- dpi = 192.0,
@jsliang
jsliang / yearlyMoc.js
Last active February 13, 2024 12:22
Yearly MOC Generator - Obsidian Templater User Script
/**
* @author Jui-Shan (Jenny) Liang <jsliang.tw@gmail.com>
* @param {Object} tp the `tp` object of the Templater plugin
* @param {Object} options options for configuring the year to generate the MOC and the file name format
* @param {string} options.YEAR what year to generate the MOC; default to the current year
* @param {string} options.YEARLY_FORMAT filename format of yearly notes; format reference: https://momentjs.com/docs/#/displaying/format/
* @param {string} options.QUARTER_FORMAT filename format of quarterly notes; format reference: https://momentjs.com/docs/#/displaying/format/
* @param {string} options.MONTH_FORMAT filename format of monthly notes; format reference: https://momentjs.com/docs/#/displaying/format/
* @param {string} options.WEEK_FORMAT filename format of weekly notes; format reference: https://momentjs.com/docs/#/displaying/format/
* @param {string} options.DAY_FORMAT filename format of daily notes; format reference: https://momentjs.com/docs/#/displaying/format/
@kepano
kepano / obsidian-web-clipper.js
Last active April 26, 2024 00:39
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */
@pooladkhay
pooladkhay / sway.config
Created May 31, 2021 20:48
SwayWM bindings for keyboard backlight
# https://github.com/haikarainen/light
#
# Bindings for keyboard backlight
bindsym XF86KbdBrightnessUp exec light -As "sysfs/leds/smc::kbd_backlight" 10
bindsym XF86KbdBrightnessDown exec light -Us "sysfs/leds/smc::kbd_backlight" 10
```dataviewjs
// find dates based on format [[YYYY-MM-DD]]
const findDated = (task)=>{
if( !task.completed ) {
task.link = " " + "[[" + task.path + "|*]]";
task.date="";
const found = task.text.match(/\[\[([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))\]\]/);
if(found) task.date = moment(found[1]);
return true;
}
@johnrichardrinehart
johnrichardrinehart / nixos_in_virtualbox.md
Last active April 7, 2024 06:40
NixOS from "scratch" as Virtualbox Guest

Steps

New VirtualBox Machine

  1. Create a new disk image (I use VDI for compatibility with VirtualBox)
  2. Allocate some RAM (>6 GiB to start)
  3. Add some video memory and enable 3D acceleration, if needed
  4. Optional: Enable EFI (instead of BIOS)
  5. Attach nixos-minimal ISO for installation
  6. Boot into the ISO

Inside the Live CD

UEFI instructions

@Bugswriter
Bugswriter / cbspells
Created March 23, 2021 00:39
Clipboard magic is a script which run bunch of clipboard related operation
#!/bin/sh
menu(){
printf "1. [URL] Expecto Shorten 🪄: Get a shorten url\n"
printf "2. [URL] Lumbos dl 🪄: Download file in ~/dl\n"
printf "3. [URL] Avada Playdavra 🪄: Play videos in mpv\n"
printf "4. [URL] Listenmora 🪄: Play audio in mpv\n"
printf "5. [Image] Imagum Savum 🪄: Save clipbaord image in ~/pix/save\n"
printf "6. [Text] Sendkulus 🪄: Send clipboard text with tgsend script\n"
printf "7. [Shell] Executa 🪄: This will run any shell command\n"