Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .config/hypr/source/keybinds.lua
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,20 @@ hl.bind(
{ description = "Close Window" }
)

-- /user_scripts/tools/workspace/close-workspace.sh -- Working Feature but Unsure
-- hl.bind(
-- "SUPER + SHIFT + C",
-- hl.dsp.exec_cmd(dusky_scripts .. "tools/workspace/close-workspace.sh"),
-- { description = "Close Workspace" }
-- )

-- /user_scripts/tools/workspace/close-workspace.sh -- Working Feature but Unsure
-- hl.bind(
-- "SUPER + SHIFT + B",
-- hl.dsp.exec_cmd(dusky_scripts .. "tools/workspace/close-workspace.sh"),
-- { description = "Safety Close Window" }
-- )

hl.bind(
"SUPER + A",
hl.dsp.window.fullscreen({ mode = "fullscreen", action = "toggle" }),
Expand Down
3 changes: 3 additions & 0 deletions user_scripts/tools/.unsorted/aesdec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
[[ $# -ne 3 ]] && { echo "Usage: $0 <filename> <key> <output>"; exit 1; }
openssl enc -aes-128-cbc -d -in "$1" -out "$3" -pass pass:"$2" 2>/dev/null || echo "OpenSSL required"
3 changes: 3 additions & 0 deletions user_scripts/tools/.unsorted/aesenc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
[[ $# -ne 3 ]] && { echo "Usage: $0 <filename> <key> <output>"; exit 1; }
openssl enc -aes-128-cbc -salt -in "$1" -out "$3" -pass pass:"$2" -e 2>/dev/null || echo "OpenSSL required"
3 changes: 3 additions & 0 deletions user_scripts/tools/.unsorted/argon2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 '<password>'"; exit 1; }
python3 -c "import argon2; print(argon2.PasswordHasher().hash('$1'))"
3 changes: 3 additions & 0 deletions user_scripts/tools/.unsorted/base642str.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 '<base64>'"; exit 1; }
echo "$1" | base64 -d
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/base64dec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
openssl base64 -d < "$1"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/base64enc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
openssl base64 -A < "$1"
3 changes: 3 additions & 0 deletions user_scripts/tools/.unsorted/bcrypt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 '<password>'"; exit 1; }
python3 -c "import bcrypt; print(bcrypt.hashpw('$1'.encode(), bcrypt.gensalt()).decode())"
3 changes: 3 additions & 0 deletions user_scripts/tools/.unsorted/bin2dec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <num>"; exit 1; }
python3 -c "print(int('$1',2))"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/bin2hex.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
xxd -p "$1" | tr -d '\n'
3 changes: 3 additions & 0 deletions user_scripts/tools/.unsorted/caesar.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
[[ $# -ne 2 ]] && { echo "Usage: $0 '<text>' <shift>"; exit 1; }
echo "$1" | tr 'A-Z' "$(echo {A..Z} | tr ' ' '\n' | sed -n "$2,\$p;1,$(( $2 - 1 ))p" | tr '\n' ' ' | sed 's/ //g')" | tr 'a-z' "$(echo {a..z} | tr ' ' '\n' | sed -n "$2,\$p;1,$(( $2 - 1 ))p" | tr '\n' ' ' | sed 's/ //g')"
3 changes: 3 additions & 0 deletions user_scripts/tools/.unsorted/charcount.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 '<text>'"; exit 1; }
echo "$1" | sed 's/\(.\)/\1\n/g' | awk 'BEGIN{OFS="\n"}{print $0}' | grep -c .
3 changes: 3 additions & 0 deletions user_scripts/tools/.unsorted/chardist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 '<text>'"; exit 1; }
echo "$1" | sed 's/./&\n/g' | sort | uniq -c | sort -rn
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/charlen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
awk '{print length}' "$1"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/chars.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
wc -c "$1"
3 changes: 3 additions & 0 deletions user_scripts/tools/.unsorted/checkport.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
[[ $# -ne 2 ]] && { echo "Usage: $0 <host> <port>"; exit 1; }
timeout 5 bash -c "echo '' > /dev/tcp/$1/$2" 2>/dev/null && echo "OPEN" || echo "CLOSED"
6 changes: 6 additions & 0 deletions user_scripts/tools/.unsorted/checksum.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
echo "MD5: $(md5sum "$1" | cut -d' ' -f1)"
echo "SHA1: $(sha1sum "$1" | cut -d' ' -f1)"
echo "SHA256: $(sha256sum "$1" | cut -d' ' -f1)"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/collapse_spaces.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
sed 's/ */ /g' "$1"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/comments.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
grep '^#' "$1"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/countdups.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
sort "$1" | uniq -c | sort -rn
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/countsubstr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 2 ]] && { echo "Usage: $0 '<text>' '<search>'"; exit 1; }
count=$(echo "$1" | grep -o "$2" | wc -l)
echo "Found: $count"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/crlf2lf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
sed -i 's/\r$//' "$1"
3 changes: 3 additions & 0 deletions user_scripts/tools/.unsorted/cronvalidate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 '<cron expression>'"; exit 1; }
python3 -c "from croniter import croniter; croniter('$1',0)" 2>/dev/null && echo "Valid" || echo "Invalid"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/csv2json.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
awk -F, 'BEGIN{print "["} NR>1{printf "%s{\"col1\":\"%s\",\"col2\":\"%s\"}",(NR>2?",":""),$1,$2} END{print "]"}' "$1"
3 changes: 3 additions & 0 deletions user_scripts/tools/.unsorted/dec2bin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <num>"; exit 1; }
python3 -c "print(bin(int('$1',10))[2:])"
3 changes: 3 additions & 0 deletions user_scripts/tools/.unsorted/dec2hex.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <num>"; exit 1; }
python3 -c "print(hex(int('$1',10))[2:])"
3 changes: 3 additions & 0 deletions user_scripts/tools/.unsorted/dec2oct.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <num>"; exit 1; }
python3 -c "print(oct(int('$1',10))[2:])"
3 changes: 3 additions & 0 deletions user_scripts/tools/.unsorted/diff.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
[[ $# -ne 2 ]] && { echo "Usage: $0 <file1> <file2>"; exit 1; }
cmp -s "$1" "$2" && echo "IDENTICAL" || echo "DIFFERENT"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/dupn.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
awk 'BEGIN{for(i=1;i<=100;i++)printf "%s%s", $0, (i%10?"":ORS)}' "$1"
12 changes: 12 additions & 0 deletions user_scripts/tools/.unsorted/entropy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
python3 -c "
import sys, math, collections
text = open('$1').read()
freq = collections.Counter(text)
total = len(text)
entropy = -sum((f/total)*math.log2(f/total) for f in freq.values())
print(f'Entropy: {entropy:.4f} bits/char')
print(f'Total bytes: {total}')
print(f'Unique chars: {len(freq)}')
"
2 changes: 2 additions & 0 deletions user_scripts/tools/.unsorted/epoch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
date +%s
3 changes: 3 additions & 0 deletions user_scripts/tools/.unsorted/epoch2date.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 '<seconds>'"; exit 1; }
python3 -c "import datetime; print(datetime.timedelta(seconds=${1}))"
15 changes: 15 additions & 0 deletions user_scripts/tools/.unsorted/factors.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <num>"; exit 1; }
python3 -c "
import sys
n=int('$1')
factors=[]
d=2
while d*d<=n:
while n%d==0:
factors.append(d)
n//=d
d+=1
if n>1: factors.append(n)
print(' x '.join(map(str,factors)))
"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/filestat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
stat --printf="Size: %s bytes\nModified: %y\nAccess: %x\n" "$1"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/filetype.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
file "$1"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/first10.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
sed -n '1,10p' "$1"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/firstline.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
sed -n '1p' "$1"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/firstnonempty.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
grep -v '^$' "$1" | head -1
3 changes: 3 additions & 0 deletions user_scripts/tools/.unsorted/gcd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
[[ $# -ne 2 ]] && { echo "Usage: $0 <num1> <num2>"; exit 1; }
python3 -c "print('GCD:',eval('import math;math.gcd($1,$2)'))"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/gencert.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 3 ]] && { echo "Usage: $0 <host> <days> <outfile.crt>"; exit 1; }
openssl req -x509 -newkey rsa:2048 -keyout "$3".key -out "$3" -days "$2" -nodes -subj "/CN=$1" 2>/dev/null
echo "Cert: $3, Key: $3.key"
3 changes: 3 additions & 0 deletions user_scripts/tools/.unsorted/genkey.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <bits>"; exit 1; }
openssl rand -hex "${1:-32}"
3 changes: 3 additions & 0 deletions user_scripts/tools/.unsorted/genpass.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <length>"; exit 1; }
openssl rand -base64 "${1:-32}" | tr -d '\n=/' | cut -c1-"$1"
5 changes: 5 additions & 0 deletions user_scripts/tools/.unsorted/genrsa.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
[[ $# -ne 2 ]] && { echo "Usage: $0 <bits> <output_prefix>"; exit 1; }
openssl genrsa -out "$2".pem "${1:-2048}" 2>/dev/null
openssl rsa -in "$2".pem -pubout -out "$2".pub.pem 2>/dev/null
echo "Keys: $2.pem (private), $2.pub.pem (public)"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/hashfile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
openssl dgst -sha256 "$1"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/hex2bin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
xxd -r -p "$1"
3 changes: 3 additions & 0 deletions user_scripts/tools/.unsorted/hex2str.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 '<hex>'"; exit 1; }
echo "$1" | xxd -r -p
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/hexdump.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
xxd "$1"
3 changes: 3 additions & 0 deletions user_scripts/tools/.unsorted/hmac.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
[[ $# -ne 2 ]] && { echo "Usage: $0 <key> <message>"; exit 1; }
python3 -c "import hmac,hashlib,sys; print(hmac.new(b'$1',b'$2',hashlib.sha256).hexdigest())"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/htmldecode.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
python3 -c "import html,sys; print(html.unescape(sys.stdin.read()))" < "$1"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/htmlencode.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
python3 -c "import html,sys; print(html.escape(sys.stdin.read()))" < "$1"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/ipsort.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
sort -t. -k1,1n -k2,2n -k3,3n -k4,4n "$1"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/json2csv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
python3 -c "import csv,sys,json; r=csv.DictReader(sys.stdin); print(json.dumps(list(r)))" < "$1"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/jsonfmt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
python3 -m json.tool "$1" 2>/dev/null || jq . "$1" 2>/dev/null || echo "Error: json tool or jq required"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/jsonmin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
python3 -c "import json,sys; print(json.dumps(json.load(sys.stdin), separators=(',',':')))" < "$1"
3 changes: 3 additions & 0 deletions user_scripts/tools/.unsorted/jsontokv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 '<json>'"; exit 1; }
python3 -c "import json,sys; d=json.loads('$1'); [print(k,'=',v) for k,v in d.items()]"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/last10.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
tail -10 "$1"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/lastline.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
tail -1 "$1"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/lastnonempty.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
grep -n '[[:alnum:]]' "$1" | sed 's/:.*//' | sort -n | tail -1
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/lastnonempty2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
grep -v '^$' "$1" | tail -1
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/lastnonemptyline.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
awk '/./{line=FNR} END{print line}' "$1"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/line5.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
sed -n '5p' "$1"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/linecount.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
wc -l "$1" && echo "Lines with non-empty:" && grep -c . "$1"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/linenumbers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
awk '{print NR": "$0}' "$1"
4 changes: 4 additions & 0 deletions user_scripts/tools/.unsorted/lines.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
[[ $# -ne 1 ]] && { echo "Usage: $0 <filename>"; exit 1; }
[[ ! -f "$1" ]] && { echo "Error: File '$1' not found."; exit 1; }
wc -l "$1"
Loading