Imagine that you are waiting for marks from exam. Lecturer is going to publish them on his website, but you don’t know when.
I’ve created following script, because I don’t like pressing F5 for hours ![]()
You have to provide address of website, and if website changes, script will open firefox and show notification.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #!/bin/sh # Wojtek Jamrozy www.wojtekrj.net if [ $# != 1 ]; then echo "usage: $0 <url of website> " exit 1 fi hash=`wget -q -O - $1 | md5sum` while [ 1 ]; do if [ "`wget -q -O - $1 | md5sum`" != "$hash" ]; then firefox $1 notify-send "Change on the website $1" exit 0 fi echo "Nothing has changed" sleep 120 done |
Before I have setted up my encrypted partitions I had to fill them with random sequention of data.
I’ve noticed that dd if=/dev/urandom of=DEVICE is very slow. It has 3-4 MB/second on my computer.
I wanted to make it faster. Here is my solution:
1. Create in tmpfs located in RAM memory large file (about 100 MB) made of pseudo-random sequence (/dev/urandom).
2. Write this file from memory sequentially to the disk.
Speed of this approach is even 34 MB/s – 10 times faster!!.
Unfortunately, this aproach might not be as secure as dd if=/dev/urandom of=DEVICE
Before you do anything backup your data and be sure what are you doing!!!
My implementation: Read More
Here is a script for generating random alphanumeric passwords:
#!/bin/bash # passwords.sh if [ $# != 2 ]; then echo "usage: $0 <length of passwords> <number of passwords> " exit 1 fi tr -cd '[:graph:]' < /dev/urandom | fold -w $1 | head -$2
dd is a great tool for low-level copying and conversion of raw data. It can be also used for data erasure. Unfortunately, it doesn’t show any information about progress of copying.
Here is my little, but useful script:
1 2 3 4 5 6 7 8 9 10 | #!/bin/bash # dd.sh Author: Wojtek Jamrozy (www.wojtekrj.net) dd $* & pid=$! sleep 10 while [ -e "/proc/$pid" ] ; do kill -USR1 $pid sleep 10 done |
Here is my script for auto-purging of removed packages (the script deletes remaining configuration files of package) in Ubuntu:
#!/bin/sh for i in `dpkg -l | grep ^rc | cut -f 3 -d ' '` do dpkg -P $i; done