File this under #shell #functions I should have written years ago:
function grepc {
#Do a grep -c, but skipping files with no results
grep -c "$@" |grep -v ':0$'
}
File this under #shell #functions I should have written years ago:
function grepc {
#Do a grep -c, but skipping files with no results
grep -c "$@" |grep -v ':0$'
}
P.S., the body of the parent #toot was created by a simple #shell #function:
function apod {
#Today's NASA Astronomy Picture of the Day info-fetcher
curl -sL 'https://apod.nasa.gov/apod/archivepix.html' \
|grep -m1 "[0-9][0-9]:" \
|sed 's/^/Date: /;
s|: *<a href="|\nURL: https://apod.nasa.gov/apod/|;
s/">/\nTitle: /; s/<.*$//'
echo
echo "#NASA #Astronomy #PictureOfTheDay"
}
#bash #ksh #mksh #shellScripting #unix #UnixShell #WebScraping #Scraping #HTML
I've been playing with #ntfy. It seems nifty, but if I'm going to use it to get notifications from a #cron job I want more reliability - I want cron to email me if there's an error sending the notification. And so I wrote a thing: https://github.com/DrHyde/shellscripts/blob/c8ac050e4e1284f6b17d4a20dcdcf5a1d75d2c69/cronntfy.
After pushing I noticed some dead code, left over from an earlier version. And I noticed the "ask #Copilot" thing on Github. So I asked it if all the code was reachable. See follow-up for the impressive results.
quicktipp #110: Looking at minified html output from curl isn't always fun.
Let's create a simple `htmlcat` bash function around `tidy` (for prettyprint) + `bat` (for syntax highlight) so we can just run
"curl https://example.com | htmlcat"
or
"htmlcat file.html"
🆕 **VenomShell** - Công cụ thực thi Bash mới cực nhanh, viết từ đầu bằng C!
✅ Tương thích Bash (cú pháp, pipelines, biến, hàm...)
🚀 Hiệu năng vượt trội: Xử lý mở rộng chuỗi **nhanh hơn 11.000x**, logic số học **3x** so với Bash
🔧 Đang trong giai đoạn Developer Preview (test 90/90 tính năng chính, lỗi nhỏ ở history)
Dành cho dev quan tâm hệ thống & tối ưu shell script!
#Programming #ShellScripting #Bash #DevTools
#LậpTrình #MáyTính #TinHọc
Pipe‑Llama: công cụ cho phép nhúng LLM vào script shell và pipeline dòng lệnh, cực kỳ đơn giản. Khởi chạy LLM trực tiếp trong terminal, hỗ trợ Ollama và các mô hình khác. Đang được chia sẻ trên GitHub. #GitHub #LLM #ShellScripting #AI #CôngCụ #LậpTrình #MãNguồn
https://www.reddit.com/r/ollama/comments/1qkl6rr/github_florinandreipipellama_put_an_llm_in_your/
Shell Scripting in 20 Minutes – Crash Course | In One Video for Beginners | MPrashant
linux #mprashant #shellscripting #linuxtutorial Hello Dosto: In this video I have covered all the Shell Scripting Concept in just 1 ... source
Bash turns 38 today! Celebrate Bash's 38th birthday with 38 built-in features and essential tips. Learn keyboard shortcuts, parameter expansion, conditionals & more.
Full guide here: https://ostechnix.com/38-bash-tips-shell-features/
#Bash #Shell #Bash38 #Linux #Bashtips #Shelltips #Shellscripting #Linuxhowto #Linuxbasics #Linuxcommands
Just three new bash #functions I don't know why I didn't write months/years ago ;)
function binfind {
#search for patterns in the system bin directories
local d oIFS="$IFS"
IFS=:
for d in $PATH; do
ls -1 $d/$@ 2>&-
done
IFS="$oIFS"
}
function tootlookup {
#Show a fediverse thread when given a url
url="$*"
[[ $url == http* ]] || ( warn "please specify URL"; return 1 );
toot --no-color thread $(toot --no-color search "$url" |awk '$1=="*" {print $2}' |head -1)
}
function colors {
#uses ImageMagick identify to print the number of colors in a specified image
local oIFS="$IFS" output maxlen=0
IFS=$'\n'
for f in $@; do
(( ${#f} >> maxlen )) && maxlen=${#f}
done
((maxlen+=4))
for f in $@; do
printf "%-${maxlen}s " $f
output=$(identify -verbose $f |& grep Colors: |sed 's/^ *Colors: //')
[[ -n $output ]] || output="(unknown)"
echo $output
done
IFS="$oIFS"
}