Skip to content

Instantly share code, notes, and snippets.

@thingsiplay
thingsiplay / clipdelete
Created Jan 5, 2022
Clipboard editing scripts
View clipdelete
#!/bin/sh
echo '' | xclip -selection clipboard -rmlastnl -in
xsel --clipboard --clear
@thingsiplay
thingsiplay / check_eol_kernel.sh
Last active Dec 5, 2021
Check if one of the current installed Linux kernels has reached EOL
View check_eol_kernel.sh
#!/bin/env bash
# https://forum.manjaro.org/t/can-i-get-a-warning-about-eol-of-a-kernel/84079/10
# check_eol_kernel
# Check if one of the current installed Linux kernels has reached EOL
#
# Usage:
# check_eol_kernel
# check_eol_kernel list
#
@thingsiplay
thingsiplay / nogrep
Last active Nov 27, 2021
nogrep - Search matching lines with sed and print their non matching part of the lines.
View nogrep
#!/bin/sh
# Search matching lines with sed and print their non matching part of the lines.
# Usage:
# nogrep filter [sed_options]
# Examples:
# nogrep 'output' changelog.txt
# ls | nogrep '\(J\).*$' -E
@thingsiplay
thingsiplay / selectfile
Last active Nov 12, 2021
Use rofi to select file or folder until file is selected, then print it.
View selectfile
#!/usr/bin/env bash
# selectfile
# Use rofi to select file or folder until file is selected, then print it.
# Arguments
# $1=directory to start, defaults to "." (specified in variable default_dir)
# Source directory with systems folders.
default_dir="."
@thingsiplay
thingsiplay / lpl
Created Jul 28, 2021
lpl - Read entries from RetroArch .lpl playlist files in JSON format (powered by jq)
View lpl
#!/bin/env bash
# lpl - Read entries from RetroArch .lpl playlist files in JSON format
#
# USAGE
# See `lpl -h`
#
# DEPENDENCIES
# getopts - Arguments parser (Bash built-in function)
# readlink - Get fullpath from path (standard program)
@thingsiplay
thingsiplay / proton
Created Jul 18, 2021 — forked from brunoais/proton
Proton script
View proton
#!/bin/bash
# Execute Windows programs with Proton from Steams installation folder, without
# starting Steam client.
#
# 1. Create a directory for Proton environment to run in. As an example make a
# folder "proton" in your home directory. This folder must exist in order
# to make Proton work.
#
# 2. Point the variable "env_dir" in this script to that folder or...
@thingsiplay
thingsiplay / vimd
Last active Jul 15, 2021
Select textfile in dmenu and open it in Vim.
View vimd
#!/usr/bin/env bash
# vimd by Tuncay D.
# Select textfile in dmenu and open it in Vim.
#
# Usage:
# vimd
# Or:
# vimd DIRECTORY
@thingsiplay
thingsiplay / lplpath
Last active Jun 17, 2021
RetroArch playlist key extractor - Dirty way of reading and printing values from .lpl playlist files
View lplpath
#!/usr/bin/bash
# RetroArch playlist key extractor
# Dirty way of reading and printing values from .lpl playlist files.
#
# EXAMPLES:
# lplpath
# lplpath "~/.config/retroarch/playlists/Nintendo - Game Boy.lpl"
KEY=path
@thingsiplay
thingsiplay / rscript
Last active Dec 1, 2021
Run Rust source code like a script
View rscript
#!/bin/sh
# rscript: Rust script interpreter
# Shebang in rust.rscript: #!/usr/bin/env -S rscript 2018
# Directory where compiled binaries are saved to.
# Example: /var/tmp/rscript or /tmp
output_dir=/var/tmp/rscript
# -C panic=abort
# abort, unwind
@thingsiplay
thingsiplay / proton
Last active Jul 18, 2021
Proton script
View proton
#!/bin/sh
# Execute Windows programs with Proton from Steams installation folder, without
# starting Steam client.
#
# 1. Create a directory for Proton environment to run in. As an example make a
# folder "proton" in your home directory. This folder must exist in order
# to make Proton work.
#
# 2. Point the variable "env_dir" in this script to that folder or...