Show newer

Here I am getting schooled again by @darkvinge's answer to yesterday's Linux DFIR command line trivia question.

How do you output an entire directory structure of file paths, sorted in descending by size? Old-school me would have told you to do something like this:

find /some/path -type f -exec wc -c {} \; | sort -nr

It's an interesting example of one time when you want to use "find ... -exec" rather than "find ... | xargs ...".

But then @darkvinge pointed out that you can just use "-printf" instead of "-exec":

find /some/path -type f -printf "%s\t%p\n" | sort -nr

"-printf" has a huge number of handy shortcuts for different file parameters. Here we see "%s" for file size and "%p" for file path.

This is vastly more efficient than executing "wc -c" on each file. Don't believe me? Check out how long the different find commands take on the same directory structure:

# time find /usr -type f -exec wc -c {} \; >/dev/null
real 4m20.615s
user 2m47.897s
sys 1m37.520s

# time find /usr -type f -printf "%s\t%p\n" >/dev/null
real 0m0.306s
user 0m0.068s
sys 0m0.238s

It's not even remotely close.

#Linux #DFIR #CommandLine #Trivia

Show thread

I’m sure my cat is saying “get out of my light fuzzball!”

A hotel in Germany uses 3D carpets to prevent guests from running in the passage...

If at first you don’t succeed……
Than skydiving is not for you.

An oldie but a goodie! This is "Anticipation", which I use for my logo. Acrylics on wood panel, 2018. A colorful pet portrait of an orange and white tabby cat in bright rainbow colors! I started a series of dog and cat paintings in 2018 to create a portfolio for my new pet portrait business.

Prints: rebeccawangart.com/featured/an
RB: redbubble.com/shop/ap/36245309

#Art #MastoArt #FediGiftShop #BuyIntoArt #cat #TraditionalArt #AnimalArt #AcrylicPainting #FantasyArt #ArtAdventCalendar

Create a freeze frame of the action in a video every 7 frames and pause at the end for 50 frames.

mpv --ao=null --vo=image --start=0:1:44.25 --end=0:1:46.6 GUEZCxBcM78.mp4
i=1
for f in 000*.jpg; do
convert -evaluate-sequence Min ${a[@]} $f $f
[[ $((i%7)) == 0 ]] && a=(${a[@]} $f)
i=$((i+1))
l=$f
done
echo 0001{00..50}.jpg |xargs -n1 ln -s $l
cat 000*.jpg |ffmpeg -y -f mjpeg -i - -c:v libx264 -r 24 -pix_fmt yuv420p skier.mp4

People call us stats nerds, but we're really sum of the least squares.

#geekjoke #statistics #data #research

@AgeOfAutumn @MoonLily You deserve plenty of kindness Autumn! Hang in there!

A picture of a post out on the coast of Kerry outside Dingle last summer

Here's an original (circa 1904) rotary AC-DC converter providing power to the (former) IRT subway in NYC. It still works, and is occasionally pressed into service during times of peak load, though most of the system now uses solid-state converters. It is very loud.

Full version at flickr.com/photos/mattblaze/32

#photography

55 years ago #today Jocelyn Bell discovered the first known pulsar -- a star the size of a city, spinning once a second, whipping up intense radio signals that sounded like the beep-beep-beep of an alien signal.

In her own words: cam.ac.uk/stories/journeysofdi #astronomy #discovery

Writing a new dating profile, so far I have “has all own teeth”

#smoo

Show older
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.