For mass-resseting usb devices I use this small script:
#!/bin/bash for d in `find /dev/bus/usb/ -type c` do echo $d /usr/local/bin/usbreset $d done
Here I'm going to publish some computer-related notes. Areas supposed to be covered here: linux, chemoinformatics, tips... I hope it will be useful not only for me, but also for others.
#!/bin/bash for d in `find /dev/bus/usb/ -type c` do echo $d /usr/local/bin/usbreset $d done
gpg --versionand jump to the section "ciphers" or "symmetric":
Symetryczne: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH, CAMELLIA128, CAMELLIA192, CAMELLIA256
#!/bin/bash algos="TWOFISH AES256 CAMELLIA256 BLOWFISH CAST5" # list of ciphers to use # -----------------------------------------------------# # clearing variables pass="" pass2="" # entering passwords echo -n "Password: " read -s pass echo echo -n "Re-enter password: " read -s pass2 echo # does passwords match? if [ "$pass" == "$pass2" ]; then echo "Passwords mach. Encrypting." echo input=`cat "$1"` for algo in $algos do ((i++)) echo "*** ($i) $algo" input=`echo "$input" | gpg --no-tty --batch -a --symmetric --cipher-algo "$algo" --passphrase "$pass" -o-` done echo "$input" > "$1".asc.$i echo "Encrypted message saved to $1.asc.$i" # clearing passwords and inputs input="" pass="" pass2="" else echo "Passwords doesn't match" fi
encrypt-multiple.sh file.txt
#!/bin/bash pass="" # entering passwords echo -n "Password: " read -s pass echo input=`cat "$1"` # list of Ciphers are not necesary as gpg detects it; read from file extension algos="${1##*.}" echo "Encrypted $algos times. Decrypting..." for i in `seq 1 $algos` do echo "*** $i" input=`echo "$input" | gpg --no-tty --batch -d --passphrase "$pass" -o-` done echo "Decrypted message:" echo "---------------------------------------" echo "$input" # clearing passwords and inputs input="" pass="" pass2=""
knock example.com 120:tcp 121:udp 122:tcp && sleep 1s && ssh username@example.com
gpg -a --symmetric --cipher-algo TWOFISH command.txt(cipher algorithm here is TWOFISH, but can be anything else). New file command.txt.asc should be created.
#!/bin/bash command=`gpg -d command.txt.asc 2> /dev/null` eval "$command"This command will ask for the passphase and after successfull decryption will run desired command.
#!/bin/bash OUT=webcam.dat echo "#i h s v r g b" > $OUT for image in *.jpg do ((i++)) hsb=`convert "$image" -colorspace hsb -resize 1x1 txt:- | sed 1d | tr '()%,:' ' '` h=`echo $hsb | awk '{print $8}'` s=`echo $hsb | awk '{print $9}'` v=`echo $hsb | awk '{print $10}'` rgb=`convert "$image" -colorspace rgb -resize 1x1 txt:- | sed 1d | tr '()%,:' ' '` r=`echo $rgb | awk '{print $3}'` g=`echo $rgb | awk '{print $4}'` b=`echo $rgb | awk '{print $5}'` echo "$i $h $s $v $r $g $b" >> $OUT done
set pointsize 2 # Line style for axes set style line 80 lt rgb "#808080" # Line style for grid set style line 81 lt 0 # dashed set style line 81 lt rgb "#808080" # grey set grid back linestyle 81 set border 3 back linestyle 80 set xtics nomirror set ytics nomirror set xlabel "frame number" set terminal png nocrop enhanced font "Gill Sans,8" size 700,500 plik='webcam.dat' set ylabel "HSB [%]" set output "out/hsv-csplines.png" plot plik using 1:2 smooth csplines title "Hue" lt rgb "red" lw 1,\ plik using 1:3 smooth csplines title "Saturation" lt rgb "green" lw 1,\ plik using 1:4 smooth csplines title "Brightness" lt rgb "blue" lw 1 set output "out/hsv-bezier.png" plot plik using 1:2 smooth bezier title "Hue" lt rgb "red" lw 1,\ plik using 1:3 smooth bezier title "Saturation" lt rgb "green" lw 1,\ plik using 1:4 smooth bezier title "Brightness" lt rgb "blue" lw 1 set ylabel "RGB" set output "out/rgb-csplines.png" plot plik using 1:5 smooth csplines title "Red" lt rgb "red" lw 1,\ plik using 1:6 smooth csplines title "Green" lt rgb "green" lw 1,\ plik using 1:7 smooth csplines title "Blue" lt rgb "blue" lw 1 set output "out/rgb-bezier.png" plot plik using 1:5 smooth bezier title "Red" lt rgb "red" lw 1,\ plik using 1:6 smooth bezier title "Green" lt rgb "green" lw 1,\ plik using 1:7 smooth bezier title "Blue" lt rgb "blue" lw 1
#!/bin/bash rrdtool create hsb-rgb.rrd \ --step 300 \ DS:h:GAUGE:600:0:100 \ DS:s:GAUGE:600:0:100 \ DS:j:GAUGE:600:0:100 \ DS:r:GAUGE:600:0:255 \ DS:g:GAUGE:600:0:255 \ DS:b:GAUGE:600:0:255 \ RRA:AVERAGE:0.5:1:288 \ RRA:AVERAGE:0.5:6:336 \ RRA:AVERAGE:0.5:24:732 \ RRA:AVERAGE:0.5:144:14600 \ RRA:MIN:0.5:1:288 \ RRA:MIN:0.5:6:336 \ RRA:MIN:0.5:24:732 \ RRA:MIN:0.5:144:14600 \ RRA:MAX:0.5:1:288 \ RRA:MAX:0.5:6:336 \ RRA:MAX:0.5:24:732 \ RRA:MAX:0.5:144:14600
hsb=`convert "$OUT_FILE" -colorspace hsb -resize 1x1 txt:- | sed 1d | tr '()%,:' ' '` h=`echo $hsb | awk '{print $8}'` s=`echo $hsb | awk '{print $9}'` v=`echo $hsb | awk '{print $10}'` rgb=`convert "$OUT_FILE" -colorspace rgb -resize 1x1 txt:- | sed 1d | tr '()%,:' ' '` r=`echo $rgb | awk '{print $3}'` g=`echo $rgb | awk '{print $4}'` b=`echo $rgb | awk '{print $5}'` # update rrd database: rrdtool update hsb-rgb.rrd "N:$h:$s:$v:$r:$g:$b"
#!/bin/bash BAZA=hsb-rgb.rrd rrdtool graph hsb-24h.png \ --imgformat PNG \ --start "now-24h"\ --title="HSB [%]" \ --height 240 \ --width 420 \ --lazy \ --alt-autoscale \ --alt-y-grid \ DEF:h=$BAZA:h:AVERAGE \ DEF:s=$BAZA:s:AVERAGE \ DEF:j=$BAZA:j:AVERAGE \ LINE2:h#FF0000:"Hue"\ LINE2:s#00FF00:"Saturation"\ LINE2:j#0000FF:"Brightness"</pre> <a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFCZoyRIhEXYQEgSiiI3RGEZFtSfnJog6hNDprEf8JzjU7_1v8DCDAnxSUuxBcq3tqSYGJkfdr4UoZ2rHV-BBREHFU8KE4Flnob8XnD7_5PhWOzuxG9B8sidzWmhX8PGtMGFU0Rlo_l7XL/s1600/HSB-24h.png" imageanchor="1" ><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFCZoyRIhEXYQEgSiiI3RGEZFtSfnJog6hNDprEf8JzjU7_1v8DCDAnxSUuxBcq3tqSYGJkfdr4UoZ2rHV-BBREHFU8KE4Flnob8XnD7_5PhWOzuxG9B8sidzWmhX8PGtMGFU0Rlo_l7XL/s320/HSB-24h.png" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyGserUs6dUyqdudZA5_UagqTuZTj_weClykD_LKd_6ENAYSKw5tuqsugFVGbGH73rxJAH1kDhs2dCF_DBLB_H_dxZsD6k7XRRYFcdzP9uVgJKxIdA675z53hNIAeX0BXE2UsswMLBRK9D/s1600/RGB-24h.png" imageanchor="1" ><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyGserUs6dUyqdudZA5_UagqTuZTj_weClykD_LKd_6ENAYSKw5tuqsugFVGbGH73rxJAH1kDhs2dCF_DBLB_H_dxZsD6k7XRRYFcdzP9uVgJKxIdA675z53hNIAeX0BXE2UsswMLBRK9D/s320/RGB-24h.png" /></a>
#!/bin/bash # ---- config. knocks_number=5 knocks_types=('udp' 'tcp'); port_min=1000 port_max=2000 # ---- config end dport=$(( $port_max - $port_min )) for i in `seq 1 $knocks_number` do sequence=$sequence$[`shuf -i $port_min-$port_max -n 1` ]":"${knocks_types[ $[($RANDOM % 2)] ]}"," done echo echo "# A sequence for knockd.conf:" echo "sequence = $sequence" | sed 's/,$//g' echo "# A sequence to use with knock" echo "knock \$ADDRESS $sequence" | sed 's/,/ /g'
# A sequence for knockd.conf: sequence = 1460:udp,1344:tcp,1997:tcp,1712:udp,1304:udp # A sequence to use with knock knock $ADDRESS 1460:udp 1344:tcp 1997:tcp 1712:udp 1304:udp
*/5 * * * * /home/jabber/bin/jabber/wrapper.sh 1> /dev/null 2> /dev/null