Apply ZFS driver settings without reboot

Apply your modprobe.d values without rebooting:

egrep -v '^#|^\s*$' zfs.conf \
| while read L; do
   M=($L)
   N=${M[2]}
   P=(${N/=/ })
   echo "${P[1]}" > /sys/module/zfs/parameters/${P[0]}
done

#zfs #linux #bash

Advertisements

lsblk trick

Here’s a fun trick to list the serial numbers and sizes of your hard drives:

 $ lsblk --nodeps -o name,serial,size
NAME SERIAL             SIZE
sda  50026B77640B3E09 223.6G
sdb  50026B77640B4B39 223.6G
sdc  YGGU3EZD           1.8T
sdd  W1E15D5G           1.8T
sde  W1E16ACY           1.8T
sdf  W1E16BJB           1.8T
sdg  W1E5W99Y           1.8T
sdh  YFGR1V3A           1.8T

Updated Bash CPU Meter

In August, I did a post on a pretty simple bash cpu meter. This one is still Intel-only, but is records the range of frequencies used during a report.

#!/bin/bash
COLWID=17
MAXTURBO=4200
function find_lines {
   local i=0
   local j=0
   while read line; do
      if [[ $line =~ cpu\ MHz ]]; then
         cpu[i]=$j
         ((i++))
      fi
      ((j++))
   done < /proc/cpuinfo
}
function get_mhz() {
   mhz=()
   local cpulines=()
   local line hunks m L i c
   for i in `seq 1 15`; do
      c=0;
      readarray cpulines < /proc/cpuinfo
      for L in "${cpu[@]}"; do
          line="${cpulines[$L]}"
          hunks=($line)
          m=${hunks[3]}
          mhz[c]+="${m%.*} "
          ((c++))
       done
       sleep 0.1s
    done
}
# main
find_lines
while [[ 1 = 1 ]]; do
    COLS=`tput cols`
    mhz=()
    get_mhz
    cpunum=0
    for A in ${cpu[@]}; do
       lowest=0
       highest=0
       for H in ${mhz[$cpunum]}; do
         (( $H > $highest)) && highest=$H
         (( $lowest == 0    )) && lowest=$H
         (( $H < $lowest )) && lowest=$H
      done      
      outline=""      
      bars=$(( ($lowest * ($COLS-$COLWID) )/$MAXTURBO))
      for (( L=1; L<=$bars; L++ )); do
         outline=$outline"-"
      done
      bars=$(( (((1+$highest)-$lowest) * ($COLS-$COLWID))/$MAXTURBO))
      for (( L=1; L<=$bars; L++ )); do
         outline=$outline"="
      done
      d=$(($cpunum+9900))
      echo "${d##99} $lowest-$highest $outline"
      ((cpunum++))
   done
   echo ""
   sleep 0.1
done
#

Emulating Web Browsers

Here’s a tedious task for you to consider. When you log-in to your favorite website these days, you’re creating a JSON document and posting it to the service you’re logging into. Long gone are the days when you just posted simple form parameters from a whole post. I work on an emulation platform: one of our features is to use Perl to emulate hundreds of users logging into a captive portal. This requires an economy of memory and time: creating hundreds of “firefox -p ~/.cache/firefox/xzf30d.userprofile” profile sessions is clearly not:

  1. memory efficient
  2. bound to specific network interfaces
  3. time efficient
  4. scriptable

So we use Perl. This requires reading through the F12 -> Networking tab of your browser’s debugging window and emulating the AJAX post to login. Fun once. Wouldn’t want to live there.

customer-tedium

Thot on Linux Video Editing

The other night I ran thru what might be the gamut of video editors because kdenlive was crashing on me. I’m going to run down this list.

Openshot: am finding it doesn’t import clips and align tracks to base audio comfortably. Did not like having to right-click-properties for fade-in, fade-out this and thats.

Pitivi: gave up on almost two years ago. Was not stable, was not useful for aligning base audio and video clips.

Blender: that looks like a lot to wade thru…to much so to just learn about the NLE features I’d use. Would love to…someday.

Avidemux: I guess it’s OK for processing clips or stitching a few together, but what I was interested in was it’s ability to batch-straighten & noise-remove (visual noise) video clips before importing them. This required I spend about a day digging into why their example java script on wiki did not work and had to abandon. Useful if you have one-three clips a day, but I can’t justify that much time to convert 20 clips once a year. Did not get any clips converted. I’m not a shy programmer, just skeptical.

Cinelerra: Oh my. Was this thing created in Borland Turbo Pascal in 1997? It does not support clip alignment except by typing in time offsets. That took two hours to determine…and I gave up.

LiVES: installed easily. Then importing clips and aligning audio became very confusing. Gave up in 45 minutes.

Lightworks: complained about not having Nvidia hardware. Gave up.

Flowblade: they polished this nicely. Really tried to align some video clips to audio but to move things and add spacers was just so unintuitive I had to abandon ship.

Vivia: not in repo, looks abandoned.

Kdenlive: went back to old trick of doing a FULL KDE install on 15.10 and created a new kde user. Finally stopped crashing when I made sure to chown -R kde:kde /home/video. Still wasn’t perfectly stable. Very disappointed that lack of error messages. KDE software loves to spam the terminal console you start it from, so things like “cannot move clip” or “cannot find clip to move” … no root causes. Eventually produced video with 15 clips, one base audio track, and 45 stills.

Kdenlive is probably the easiest to use NLE for Linux I’ve found.