Skip to content

Instantly share code, notes, and snippets.

View thingsiplay's full-sized avatar

Tuncay thingsiplay

View GitHub Profile
@thingsiplay
thingsiplay / vimh.sh
Created February 18, 2022 21:33
vimh - Open Vim in help page directly from terminal (fzf edition)
#!/bin/env bash
# vimh - Open Vim in help page directly from terminal (fzf edition)
#
# Usage:
# If no argument is given, then a fuzzy finder search is initiated.
#
# vimh [tag]
# vimh ''
# vimh '<c-p>'
@thingsiplay
thingsiplay / clipdelete
Created January 5, 2022 08:37
Clipboard editing scripts
#!/bin/sh
echo '' | xclip -selection clipboard -rmlastnl -in
xsel --clipboard --clear
@thingsiplay
thingsiplay / check_eol_kernel.sh
Last active November 3, 2022 16:59
Check if one of the current installed Linux kernels has reached EOL
#!/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 November 27, 2021 22:52
nogrep - Search matching lines with sed and print their non matching part of the lines.
#!/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 April 3, 2024 22:38
Use rofi to select file or folder until file is selected, then print it.
#!/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 July 28, 2021 17:42
lpl - Read entries from RetroArch .lpl playlist files in JSON format (powered by jq)
#!/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 July 18, 2021 18:44 — forked from brunoais/proton
Proton script
#!/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 July 15, 2021 13:00
Select textfile in dmenu and open it in Vim.
#!/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 December 20, 2023 22:49
RetroArch playlist key extractor - Dirty way of reading and printing values from .lpl playlist files
#!/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 December 1, 2021 15:12
Run Rust source code like a script
#!/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