This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LOCATION="$1" | |
[ -z "$LOCATION" ] && { echo "Usage: $0 LOCATION"; exit; } | |
FILE=$( | |
find $LOCATION -type f -exec ls --full-time {} \; |\ | |
cut -f6- -d' ' |\ | |
sort -r |\ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
B="/sys/class/backlight/intel_backlight/brightness" | |
[ ! -f "$B" ] && { echo "Brightness can't be changed"; exit 0; } | |
[ -z "$1" ] && { echo "Usage: 0 value"; echo "where 1 < value < 937 "; exit 0; } | |
[ "$1" = 0 ] && { echo "Hmmm, you shouldn't do that, please use 1 instead"; exit 0; } | |
echo $1 | sudo tee $B |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
[ -z "$1" ] && { echo "Usage: $0 [0-100]"; exit 0; } | |
re='^[0-9]+$' | |
if ! [[ "$1" =~ $re ]] ; then # this is not work in dash! | |
echo "error: Not a number" >&2 | |
exit 1 | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
MPS=`amixer contents | grep 'Master Playback Switch' | cut -f1 -d,` | |
amixer cset $MPS 1 > /dev/null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
MPS=`amixer contents | grep 'Master Playback Switch' | cut -f1 -d,` | |
amixer cset $MPS 0 > /dev/null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SVR="8.8.8.8" | |
HOST="ftp.coe.psu.ac.th" | |
SLEEPTIME=10 | |
[ "$1" ] && HOST="$1" | |
while true; do | |
DATE=`date +%Y%m%d` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w- | |
use strict; | |
use warnings; | |
my $HOME = "http://www.dailynews.co.th"; | |
my $PAGEURL = "$HOME"; | |
unlink "newspaper" if -f "newspaper"; | |
system("wget -q -O newspaper $PAGEURL"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w- | |
use strict; | |
use warnings; | |
my $HOME = "http://www.thairath.co.th"; | |
my $PAGEURL = "$HOME/newspaper"; | |
unlink "newspaper" if -f "newspaper"; | |
system("wget -q -O newspaper $PAGEURL"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
USER="YOUR-PASSPORT-ID" | |
PASSWD="YOUR-PASSPORT-PASSWORD" | |
COOKIES="cookies.txt" | |
/usr/bin/curl \ | |
--connect-timeout 10 \ | |
--max-time 10 \ | |
-s -k \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
LOG="$HOME/.my_password_generator.log" | |
echo -n "Enter [Key]: " | |
stty -echo | |
read key | |
stty echo | |
# echo "[$key]" # -- for debug only -- # | |
echo "*******************" |