Compare commits
9 Commits
2019-07-07
...
2020.06.22
Author | SHA1 | Date | |
---|---|---|---|
9c776c3400 | |||
09a53e2681 | |||
129ca17ccd | |||
3bf21a54e6 | |||
4890ff8aaa | |||
5537227fc0 | |||
79ccd05105 | |||
bdf236d067 | |||
bfdf513154 |
2
cptemplate.sh
Normal file → Executable file
2
cptemplate.sh
Normal file → Executable file
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/bash
|
#!/bin/bash
|
||||||
# Copy a file from ~/Templates to a given name
|
# Copy a file from ~/Templates to a given name
|
||||||
#
|
#
|
||||||
# Dependencies:
|
# Dependencies:
|
||||||
|
5
drivetemp.py
Normal file → Executable file
5
drivetemp.py
Normal file → Executable file
@ -54,10 +54,7 @@ def convert_to_celsius(mkel_temp):
|
|||||||
# ========== Main Script ==========
|
# ========== Main Script ==========
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"device",
|
"device", help="device node to retrieve the temperature for", metavar="dev"
|
||||||
help="device node to retrieve\
|
|
||||||
the temperature for",
|
|
||||||
metavar="dev",
|
|
||||||
)
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
25
fedit.py
Normal file → Executable file
25
fedit.py
Normal file → Executable file
@ -13,6 +13,8 @@ import os
|
|||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
from sys import platform
|
||||||
|
|
||||||
# ========== Constants ==========
|
# ========== Constants ==========
|
||||||
# ----- Paths -----
|
# ----- Paths -----
|
||||||
BOOT_DIR = "/boot"
|
BOOT_DIR = "/boot"
|
||||||
@ -24,16 +26,27 @@ E_NOEDITORFOUND = 2
|
|||||||
E_NOFILESELECTED = 3
|
E_NOFILESELECTED = 3
|
||||||
|
|
||||||
# ----- Commands -----
|
# ----- Commands -----
|
||||||
FIND_CMD = "/usr/bin/fd"
|
|
||||||
|
# Options: show hidden files, null terminator, files only
|
||||||
|
# Optional arguments: show vcs files, show every file
|
||||||
|
FIND_CMD = shutil.which("fd")
|
||||||
FIND_OPTS = ["--hidden", "--print0", "--type", "f"]
|
FIND_OPTS = ["--hidden", "--print0", "--type", "f"]
|
||||||
EXTRA_FIND_OPTS = {"no_ignore_vcs": "--no-ignore", "no_ignore": "--no-ignore-vcs"}
|
EXTRA_FIND_OPTS = {"no_ignore_vcs": "--no-ignore", "no_ignore": "--no-ignore-vcs"}
|
||||||
|
|
||||||
LOCATE_CMD = "/usr/bin/locate"
|
# Options: null terminator, ignore case, print names matching all non-option arguments
|
||||||
LOCATE_OPTS = ["--all", "--ignore-case", "--null"]
|
LOCATE_CMD = shutil.which("locate")
|
||||||
|
|
||||||
FZF_CMD = "/usr/bin/fzf"
|
# Options: read null terminator, auto-select if one option, exit if no options, print null terminator
|
||||||
|
FZF_CMD = shutil.which("fzf")
|
||||||
FZF_OPTS = ["--read0", "--select-1", "--exit-0", "--print0"]
|
FZF_OPTS = ["--read0", "--select-1", "--exit-0", "--print0"]
|
||||||
|
|
||||||
|
# Platform-specific options
|
||||||
|
# macOS doesn't support GNU-style long options
|
||||||
|
if platform == "linux":
|
||||||
|
LOCATE_OPTS = ["--all", "--ignore-case", "--null"]
|
||||||
|
elif platform == "darwin":
|
||||||
|
LOCATE_OPTS = ["-0", "-i"]
|
||||||
|
|
||||||
# ----- Misc. -----
|
# ----- Misc. -----
|
||||||
LOCALE = "utf-8"
|
LOCALE = "utf-8"
|
||||||
|
|
||||||
@ -139,6 +152,10 @@ def locate_files(patterns):
|
|||||||
|
|
||||||
# ========== Main Script ==========
|
# ========== Main Script ==========
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
# This script doesn't support Windows
|
||||||
|
if platform == "windows":
|
||||||
|
sys.exit(E_INTERRUPT)
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-b",
|
"-b",
|
||||||
|
2
fless.sh
Normal file → Executable file
2
fless.sh
Normal file → Executable file
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/bash
|
#!/bin/bash
|
||||||
# fless - fuzzy find a file and run less on it
|
# fless - fuzzy find a file and run less on it
|
||||||
# Dependencies
|
# Dependencies
|
||||||
# - fd (soft)
|
# - fd (soft)
|
||||||
|
2
gek.sh
Normal file → Executable file
2
gek.sh
Normal file → Executable file
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/bash
|
#!/bin/bash
|
||||||
# Export a key to a given keyfile
|
# Export a key to a given keyfile
|
||||||
|
|
||||||
echo -n "Enter the name of the output file: "
|
echo -n "Enter the name of the output file: "
|
||||||
|
0
getweather.py
Normal file → Executable file
0
getweather.py
Normal file → Executable file
2
lsgroups.sh
Normal file → Executable file
2
lsgroups.sh
Normal file → Executable file
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/bash
|
#!/bin/bash
|
||||||
# List all groups in the system
|
# List all groups in the system
|
||||||
|
|
||||||
sort <(awk -F ':' '{print $1}' < /etc/group)
|
sort <(awk -F ':' '{print $1}' < /etc/group)
|
||||||
|
2
lsusers.sh
Normal file → Executable file
2
lsusers.sh
Normal file → Executable file
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/bash
|
#!/bin/bash
|
||||||
# List all users on the system
|
# List all users on the system
|
||||||
|
|
||||||
sort --unique <(awk -F ':' '{print $1}' < /etc/passwd)
|
sort --unique <(awk -F ':' '{print $1}' < /etc/passwd)
|
||||||
|
0
misc/quickdel.sh
Normal file → Executable file
0
misc/quickdel.sh
Normal file → Executable file
2
open.sh
Normal file → Executable file
2
open.sh
Normal file → Executable file
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/bash
|
#!/bin/bash
|
||||||
# open - fuzzy find, select, and open a file using xdg-open
|
# open - fuzzy find, select, and open a file using xdg-open
|
||||||
#
|
#
|
||||||
# Dependencies:
|
# Dependencies:
|
||||||
|
0
quickdel.py
Normal file → Executable file
0
quickdel.py
Normal file → Executable file
@ -1,22 +0,0 @@
|
|||||||
# Fuzzy cd from anywhere
|
|
||||||
# Dependencies
|
|
||||||
# * fzf
|
|
||||||
# * mlocate
|
|
||||||
|
|
||||||
# ========== Shortcuts ==========
|
|
||||||
cf() {
|
|
||||||
[[ -z "${*}" ]] && return 1
|
|
||||||
[[ ! -x /usr/bin/fzf ]] && return 1
|
|
||||||
|
|
||||||
dir="$(locate --all --ignore-case --null -- "${@}" | fzf --read0 --select-1 --exit-0)"
|
|
||||||
|
|
||||||
[[ -z "${dir}" ]] && return 1
|
|
||||||
|
|
||||||
if [[ -f "${dir}" ]]; then
|
|
||||||
cd "${dir%/*}"
|
|
||||||
else
|
|
||||||
cd "${dir}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
autoload -Uz cf
|
|
@ -1,15 +0,0 @@
|
|||||||
# Fuzzy find a file and then edit it
|
|
||||||
|
|
||||||
_fedit() {
|
|
||||||
/usr/bin/fedit && zle reset-prompt
|
|
||||||
}
|
|
||||||
|
|
||||||
_etcedit() {
|
|
||||||
/usr/bin/fedit --etc && zle reset-prompt
|
|
||||||
}
|
|
||||||
|
|
||||||
zle -N _fedit
|
|
||||||
bindkey -M viins '^o' _fedit
|
|
||||||
|
|
||||||
zle -N _etcedit
|
|
||||||
bindkey -M viins '^e' _etcedit
|
|
@ -1,7 +0,0 @@
|
|||||||
# Fuzzy-find a file and open it in less
|
|
||||||
fless() {
|
|
||||||
/usr/bin/fless && zle reset-prompt
|
|
||||||
}
|
|
||||||
|
|
||||||
zle -N fless
|
|
||||||
bindkey -M viins '^n' fless
|
|
@ -1,8 +0,0 @@
|
|||||||
# Make a directory, then change into it
|
|
||||||
|
|
||||||
mkcd() {
|
|
||||||
[[ ! -d "${1}" ]] && mkdir --parents -- "${1}"
|
|
||||||
cd "${1}" || exit
|
|
||||||
}
|
|
||||||
|
|
||||||
autoload -Uz mkcd
|
|
Reference in New Issue
Block a user