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"
}
Ahh, seems like vm.stats.vm.v_active_count is the closest to what I want in terms of RAM actually used by processes then, thank you both!! :D
Wait, spoke too soon. XD
Still working it out...
Ok,
echo $(( ($(sysctl -n vm.stats.vm.v_active_count) + $(sysctl -n vm.stats.vm.v_inactive_count) ) * $(sysctl -n hw.pagesize) /1048576 ))
...seems to get me the closest to what I want, and closely matches what systat -vmstat displays, as well as top "Active" + "Inact", although btop disagrees and shows about half as much. XD
Ok guys, I got it. ;)
https://codeberg.org/rldane/scripts/src/branch/main/freebsdfree
(Should hopefully be available by the time you read this. My git push is taking a while, for some reason)
Is there any framework to create shell scriprs?
I'm getting the nerves with so much shell-foo.
#Shell #Bash #SH #Linux #ShellScripting #Scripting #SoftwareDevelopment #ShellDevelopment
I use git in a shell because that's just what I prefer, and I have a lot of aliases set up to shorten commands, e.g. just "g" will be git commit, "gp" is git push etc.
I just realized that this also gives me some safety. I use PageUp to complete the currently typed thing to the last command I executed that starts the same. This will never wrongly complete my aliases to something like "git reset" because I do not have aliases for that and none of my aliases start with "gi".
#git #shellScripting
#PSA regarding #GNU #coreutils #sort's unexpected or at least non-intuïtive behaviour of its --unique (-u) option together with --numeric (-n) or --human (-h).
The output of piping something through
sort -nu
might not be equal to the output of piping the same thing through
sort -n | uniq
as it might miss some lines completely. 🤌
And it's NOT documented in the man page, just in the info page.
Related bug reports:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=61696
https://bugs.debian.org/893524
A brave soul attempts to merge the elegance of #Lisp with the chaos of shell scripting, like trying to paint a masterpiece with a chainsaw. 🖼️🔪 Meanwhile, GitHub's #AI thinks it's helping, but we're just one step closer to replacing #bloatware with bloatedware. 🤖💡
https://github.com/gue-ni/redstart #ShellScripting #GitHub #HackerNews #ngated
A Lisp Interpreter for Shell Scripting
https://github.com/gue-ni/redstart
#HackerNews #Lisp #Interpreter #ShellScripting #Programming #GitHub #Redstart
Fish Shell 4.1.0 è qui! Nuove funzioni, sintassi migliorata e un terminale ancora più intuitivo per Linux. #FishShell #LinuxTerminal #ShellScripting #OpenSource #CLI
https://www.linuxeasy.org/fish-shell-4-1-0-linux/?utm_source=mastodon&utm_medium=jetpack_social
🚀 Introducing the ABSurd Programming #Language 🎉—because who doesn't want to combine the excitement of shell scripting with the thrill of reinventing the wheel? 🛞 With a syntax that borrows "creatively" from every other language, ABS will make you feel right at home...if your home is a chaotic circus of half-baked ideas. 🎪💻
https://www.abs-lang.org/ #ABSurdProgramming #ShellScripting #CodingCreativity #ProgrammingHumor #TechInnovation #HackerNews #ngated
Liebe Folglinge,
ich suche nach einem neuen Job als #iOS und/oder #macOS Entwickler. Ich spreche #ObjectiveC, #Swift (auch Server-Side) und #SwiftUI und nutze die ganzen Tools drumherum (#Xcode, #Git, #GitHub, #GitHubActions, #ShellScripting etc.). Ich bringe 30 Jahre Berufserfahrung als Software-Entwickler mit, davon knapp 20 im #Apple Ökosystem.
Am Idealsten waere eine #Festanstellung zu 100% remote. Sollte es im Raum #Bregenz oder #Dornbirn etwas geben, dann auch gerne vor Ort.
Ich danke euch fuers Teilen. 🙏🏻
LinkedIn: https://www.linkedin.com/in/phranck/
Xing: https://www.xing.com/profile/Frank_Gregor063742/