/ walking bear:D / some shell scripts

some shell scripts

2021-01-31 posted in [筆記]

rp_monitor.sh — play streamming videos

#!bin/sh

url=http://192.168.0.6:3000/stream.mjpg 

pipe=$(mktemp)
rm -v $pipe
mknod $pipe p

if [ ! -p $pipe ] ; then 
	echo mknod $pipe p
	exit
fi

wget --no-cache $url -O $pipe >/dev/null 2>&1 &
ffplay -vf "rotate=PI" $pipe 

rm -v $pipe

rp_reset_usb.sh — reset wireless kb/mice hub without unpluging then pluging

#!/bin/bash

port="1-1.4" # as shown by lsusb -t: {bus}-{port}(.{subport})

bind_usb() {
  echo "$1" >/sys/bus/usb/drivers/usb/bind
}

unbind_usb() {
  echo "$1" >/sys/bus/usb/drivers/usb/unbind
}

if [ $# = 0 ] ; then
  port="1-1.4"
else
  port=$1
fi

echo unbind_usb "$port"
unbind_usb "$port"

echo sleep 1 # enable delay here
sleep 1 # enable delay here

echo bind_usb "$port"
bind_usb "$port"

borrow from stackoverflow

while read line ; do
	echo $lnhe
done << __EOF__
path1
path2
path3
__EOF__

following command also useful

tar cvf /tmp/FIFO -T filelist.txt

// Have Fun!

walking bear:DRSS feed

关于

wkliang

Clarke's Three Laws:

  • When a distinguished but elderly scientist states that something is possible, he is almost certainly right. When he states that something is impossible, he is very probably wrong.
  • The only way of discovering the limits of the possible is to venture a little way past them into the impossible.
  • Any sufficiently advanced technology is indistinguishable from magic.
  • 版权申明

    知识共享许可协议

    Fork me on GitHub

    Powered by

    Disqus, GitHub, Google Custom Search, Gravatar, HighlightJS, jekyll