You are not logged in.
You could also do that using ffmpeg:
ffmpeg -i filename 2>&1 | grep -F "Duration"
or maybe a bit cleaner:
ffmpeg -i filename 2>&1 | sed -e '/Duration/!d' -e 's/\ //' -e 's/\,.*//g'
Offline
# Swap two files
swap() {
if [ -f $1 ] ; then
if [ -f $2 ] ; then
mv $1 $1.swapcopy;
mv $2 $1;
mv $1.swapcopy $2;
else
echo "'$2' is not a valid file!"
fi
else
echo "'$1' is not a valid file!"
fi
}
Made this when I found I had to swap files fairly often, simplistic and not original but I didn't copy :3
mu @ freenode - Last.fm
Offline
Just a quick menu (using dmenu-vertical-xft from AUR) for some common tasks.
The mydmenu() function could be useful elsewhere : it makes dmenu appears at the center on the screen, using the input to calculate the needed dimensions and positions.
I tried to write it in a Bourne-shell compatible way, so it can works on systems which don't have bash by default (e.g. *BSD).
Tell me if you have any recommendation to improve the script (it's my first non-trivial shell script).
#!/bin/sh
mydmenu() {
dmenu_in=`awk '(NR < 10) { printf " "} /./ { print " " NR ") " $0 }'`
lines=`echo "$dmenu_in" | wc -l`
width=`echo "$dmenu_in" | wc -L`
lines=`expr $lines + 1`
width=`expr $width '*' 8 + 4 '*' 17`
resolution=`xrandr -q | awk '/\*/ { print $1 }'`
posx=`echo "$resolution" | sed 's/x.*//'`
posy=`echo "$resolution" | sed 's/.*x//'`
posx=`expr '(' $posx - $width ')' / 2`
posy=`expr '(' $posy - $lines '*' 17 ')' / 2`
echo "$dmenu_in" \
| dmenu -x $posx -y $posy -w $width -l $lines -fn 'xft:Deja Vu Sans Mono-10' -nb '#333333' -nf '#ffffff' -sb '#555555' -sf '#ffffff' \
| sed 's/^ *\(.*\)).*$/\1/'
}
nl='
'
lsdvd_out=`lsdvd 2>/dev/null`
if test "$lsdvd_out"; then
dvd_track=`echo "$lsdvd_out" | awk '/^Longest track/ { print $NF }'`
dvd_title=`echo "$lsdvd_out" | awk '/^Disc Title/ { print $NF }'`
menu="${menu}Lire le DVD \"$dvd_title\"$nl"
todo="${todo}exec mplayer dvd://$dvd_track$nl"
fi
menu="${menu}Lancer l'émulateur Super Nintendo$nl"
todo="${todo}exec zsnes$nl"
menu="${menu}Lancer Windows XP dans une machine virtuelle$nl"
todo="${todo}exec qemu-run $HOME/.qemu/winxp.qcow$nl"
if test -e /var/run/daemons/transmissiond; then
menu="${menu}Arrêter le client BitTorrent$nl"
todo="${todo}sudo /etc/rc.d/transmissiond stop$nl"
else
menu="${menu}Lancer le client BitTorrent$nl"
todo="${todo}sudo /etc/rc.d/transmissiond start$nl"
fi
if test -e /var/run/daemons/lighttpd; then
menu="${menu}Arrêter le serveur Web$nl"
todo="${todo}sudo /etc/rc.d/lighttpd stop$nl"
else
menu="${menu}Lancer le serveur Web$nl"
todo="${todo}sudo /etc/rc.d/lighttpd start$nl"
fi
if test -e /var/run/daemons/mysqld; then
menu="${menu}Arrêter le serveur MySQL$nl"
todo="${todo}sudo /etc/rc.d/mysqld stop$nl"
else
menu="${menu}Lancer le serveur MySQL$nl"
todo="${todo}sudo /etc/rc.d/mysqld start$nl"
fi
if test -e /var/run/daemons/privoxy -a -e /var/run/daemons/tor; then
menu="${menu}Naviguer sur le Web avec Tor et Privoxy$nl"
todo="${todo}exec chromium --proxy-server=localhost:8118 --user-data-dir=$XDG_CONFIG_HOME/chromium-tor$nl"
menu="${menu}Désactiver Tor et Privoxy$nl"
todo="${todo}sudo /etc/rc.d/privoxy stop && sudo /etc/rc.d/tor stop$nl"
else
menu="${menu}Activer Tor et Privoxy$nl"
todo="${todo}sudo /etc/rc.d/privoxy start && sudo /etc/rc.d/tor start$nl"
fi
menu="${menu}Déconnexion$nl"
todo="${todo}killall X$nl"
menu="${menu}Redémarrer sous Windows XP$nl"
todo="${todo}sudo grub-set-defaults 2 && sudo reboot$nl"
menu="${menu}Redémarrer$nl"
todo="${todo}sudo reboot$nl"
menu="${menu}Éteindre$nl"
todo="${todo}sudo halt$nl"
choice=`echo "$menu" | mydmenu`
test "$choice" && command=`echo "$todo" | awk "NR == $choice { print \\\$0 }"`
eval "$command"
I bound this script to the mod+shift+p key combination in dwm.
Here's how it looks like :
Last edited by pokraka (2010-07-19 16:37:57)
Offline
On the theme of dwm and fun uses for dmenu, I would be grateful to get feedback on this little kluge I hacked up, with some ideas lifted from the post above: dlayoutmenu.
I am too lazy to put much effort into remembering the keyboard shortcuts for the various layouts in my patched version of dwm, so I tossed together this script which reads a file with the available layouts into dmenu and then uses xdotool to send the keyboard shortcut for the desired layout:
#!/bin/bash
#LAYOUTLIST="$HOME/tarballs/dwm-sprinkles/dwm-layouts"
NL='
'
LAYOUTLIST="${LAYOUTLIST}ntile$NL"
LAYOUTLIST="${LAYOUTLIST}float$NL"
LAYOUTLIST="${LAYOUTLIST}monocle$NL"
LAYOUTLIST="${LAYOUTLIST}gaplessgrid$NL"
LAYOUTLIST="${LAYOUTLIST}grid$NL"
LAYOUTLIST="${LAYOUTLIST}spiral$NL"
LAYOUTLIST="${LAYOUTLIST}dwindle$NL"
layout=$(echo "$LAYOUTLIST" | dmenu ${1+"$@"})
case "$layout" in
'ntile')
xdotool key "super+shift+t"
;;
'float')
xdotool key "super+shift+f"
;;
'monocle')
xdotool key "super+shift+m"
;;
'gaplessgrid')
xdotool key "super+shift+g"
;;
'grid')
xdotool key "super+shift+r"
;;
'spiral')
xdotool key "super+shift+p"
;;
'dwindle')
xdotool key "super+shift+d"
;;
esac
I tweaked dwm's config.h to add a keybinding which spawns this script with the same font and colours as dwm's status bar:
static const char *layoutmenucmd[] = { "dlayoutmenu", "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL };
{ MODKEY|ControlMask, XK_space, spawn, {.v = layoutmenucmd } },
Not the most elegant thing ever, but it (mostly) works (there is an annoying blank entry on the menu before the first layout on the list that I don't know how to fix). Aside from that, the use of xdotool feels like a somewhat kluge-y way to change the layouts.
Anyone have thoughts on how to implement this more elegantly? Might there be a way to have the script read config.h directly to find the available layouts? Is there some other way to set layouts other than xdotool? Other ways in which this might be improved? AdvTHANKSance.
Offline
Here's a .bashrc/.zshrc function I wrote, similar to the makescript function, but used for quickly compiling single-file source code.
compile(){
if [[ "$1" == "c" ]]; then (gcc -o "$2" "$2"'.c' && return 0) || return 1; fi
if [[ "$1" == "cpp" ]]; then (g++ -o "$2" "$2""$1" && return 0) || return 1; fi
if [[ "$1" == "cc" ]]; then (g++ -o "$2" "$2""$1" && return 0) || return 1; fi
if [[ "$1" == "cxx" ]]; then (g++ -o "$2" "$2""$1" && return 0) || return 1; fi
if [[ "$1" == "bas" ]]; then (fbc -o "$2" "$2""$1" && return 0) || return 1; fi # FreeBASIC compiler
if [[ "$1" == "f" ]]; then (gfortran -o "$2" "$2""$1" && return 0) || return 1; fi
if [[ "$1" == "" ]]; then echo "Error: no arguments specified"; return 1; fi
echo "Error: invalid compiler specified"
return 1
}
I don't have every single GCC front end, so it's easily expandable.
One more, useful in the .*shrc of root's shell when there's a preceding "umask 077".
function domask(){ umask $1; $2; umask 077 }
Last edited by Bushman (2010-07-23 19:28:39)
Offline
Lately I have been working on a command line C app named flo that keeps track of events, deadlines and todos. Each item is stored as a tab-separated line in a file named ~/.flo.
$ flo clean apartment
0 clean apartment
$ flo eat lunch@some cafe,221200-221245
0 2010-07-22 12:00 eat lunch@some cafe
2010-07-22 12:45
1 clean apartment
$ flo a deadline@uni-10011200
0 2010-07-22 12:00 eat lunch@some cafe
2010-07-22 12:45
d 1 2010-10-01 12:00 a deadline
2 clean apartment
You can get it at http://github.com/alexanderte/flo.
Last edited by alexanderte (2010-07-22 13:47:01)
Offline
I use this as a custom-action in Thunar filemanager. It searches tineye.com for the selected image, and opens the result in your default webbrowser. Useful for example when you want to search for a more hi-res version of an image that is already on your harddisk.
URL=$(curl -s --form image=@%f http://www.tineye.com/search | grep -m 1 'href=\"http://www.tineye.com/search/' | sed 's/.*\(http:.*\)\".*/\1/'); xdg-open "$URL"
Last edited by rwd (2010-07-25 13:31:42)
Offline
Here's something I worked up recently as an interface PoC for a larger utility I'm writing in python. I does work, but there are some bugs I will iron out in its final version. So just for the sake of posting, here: (I apologize for the horrific nature of the code)
#!/bin/bash
# System Information
bar="ߊߊߊߊߊߊߊߊߊߊ"
full="❰- FULL -❱"
high="\033[1;33m"
low="\033[0;37m"
reset="\033[0m"
IFS=$(echo -e "\n")
echo
# Info ----------------------
echo | awk \
-v high="$high" \
-v low="$low" \
-v reset="$reset" \
-v kernel=$(uname -r) \
-v proc=$(uname -p) \
-v boot=$(who -b | awk '{print $3" "$4}') \
-v freq=$(cat /proc/cpuinfo | awk '/MHz/ {print substr($4/1000,1,3)"GHz"}') \
-v up=$(uptime | awk '{
split($5,a,":");
split($1,b,":");
printf "%sd %sh %sm %ss",$3,a[1],int(a[2]),b[3];
}') '{
split("Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",m,",");
split(boot,tmp," ");
split(tmp[1],d,"-");
split(tmp[2],t,":");
hour = (t[1]>12)?t[1]-12:t[1];
mer = (t[1]>12)?"pm":"am";
min = t[2];
printf high"GNU/Linux "reset"%-15s %38s "high"%6s\n"reset,kernel,proc,freq;
printf "Uptime: "low"%-17s"reset" %23s "low"%3s. %2s, %4s %2s:%2s%2s\n\n"reset,
up,"Last Reload:",m[int(d[2])],d[3],d[1],hour,min,mer;
}'
# Users ---------------------
echo -e $high"Username TTY Since Home Size ACT PN"$reset
who -u | awk \
-v low="$low" \
-v reset="$reset" \
'BEGIN{
while("cat /etc/passwd" | getline>0){
split($0,l,":");
home[l[1]]=l[6];
}
}{
"ps -u"$1" | wc -l" | getline pn;
"du -hs "home[$1] | getline line
split("Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",m,",");
split($3,d,"-");
split(line,size," ")
printf "%-12s %6s %-3s. %2s, %4s %-18s %6s "(($5=="old")?low:"")" %4s"reset" %3s\n",
$1,$2,m[int(d[2])],d[3],d[1],home[$1],size[1],($5=="old")?"idle":$5,pn-1;
}'
echo
# Network -------------------
echo -e $high"Interface IPv4 Address RX Packets Bytes TX Packets Bytes"$reset
ifconfig -a | awk \
-v high="$high" \
-v low="$low" \
-v reset="$reset" \
'BEGIN{
line = 1;
}{
if($0==""){
if(NR!=1){
printf ((stat)?(name=="lo"?high:""):low)"%-8s "reset,name;
printf ((stat)?"":low)"%18s %10sK %8sM %10sK %8sM\n",
addr"/"cidr,int(RXP/1000),int(RXB/1048576),
int(TXP/1000),int(TXB/1048576);
}
name = "";
stat = "";
addr = "0.0.0.0";
cidr = "32";
mac = "00:00:00:00:00:00";
TXP = ""; TXB = "";
RXP = ""; RXB = "";
line = 1;
}else{
if(line==1){
name=$1;
for(i=3;i<NF;i++){if($i=="HWaddr") mac=$i+1};
}
if($1=="UP") stat=1;
if($1=="TX") TXP=substr($2,9);
if($1=="RX" && substr($2,1,1)=="p") RXP=substr($2,9);
if($1=="RX" && substr($2,1,1)=="b"){RXB=substr($2,7);TXB=substr($6,7)};
if($1=="inet"){
addr=substr($2,6);
split(substr($4,6),m,".");
for(i=0;i<4;i++){
bit=7;
while(1){
if(!m[i]) break;
m[i]-=2^bit--;
cidr++;
}
}
}
line++;
}
}'
ip=$(wget -O - -o /dev/null http://checkip.dyndns.com/ | awk '{print substr($6,1,match($6,"<")-1)}')
whois $ip | awk \
-v high=$high \
-v low=$low \
-v reset=$reset \
-v ip=$ip \
'/OrgName:/ {
printf high"%-8s"reset" %15s/32 "low"%11s %9s %11s %9s\n\n",
tolower($2),ip,"n/a","n/a","n/a","n/a";
}'
# Memory and Storage --------
dev=$(df -hT | awk 'NR!=1')
mem=$(free -mo | awk '/Mem:/ {print "/dev/mem none "$2"M "$3"M "$4"M "int($3/$2*100)"% mem"}')
swp=$(cat /proc/swaps | awk 'NR!=1 {
total = int($3/1024)
used = int($4/1024)
free = int(($3-$4)/1024)
perc = int($4/$3*100)
printf "%s swap %sM %sM %sM %s swap",$1,total,used,free,perc"%";
}')
echo -e $high"Device Type Free Used Total Capacity Location"$reset
echo -e "$dev\n$mem\n$swp" | sort | awk \
-v bar="$bar" \
-v full="$full" \
-v high="$high" \
-v low="$low" \
-v reset="$reset" \
'{
highlight = ($7=="mem" || $7=="/" || $7=="swap")?high:"";
lowlight = ($2=="none")?low:"";
capacity = substr(bar,1,int(int($6)/10+0.5));
printf lowlight"%-11s %7s "low"%6s %6s %7s ",$1,$2,$5,$4,$3;
printf high"[%-10sߊ%4s] "(reset)(lowlight)(highlight)"%s"reset"\n",
(int($5)<5)?full:capacity,$6,$7;
}'
echo
At least it rendered a nice template:
Last edited by GraveyardPC (2010-07-25 14:29:51)
Offline
GraveyardPC, the output looks very nice. Which font are you using?
Offline
Set a random, gradient-based wallpaper using hsetroot:
#!/bin/bash
COLOUR_LIST=$HOME/.hsetroot_colours
rndcolour() {
cat $COLOUR_LIST | shuf | head -n 1
}
rndangle() {
echo $((RANDOM % 360))
}
hsetroot -add "$(rndcolour)" -add "$(rndcolour)" -add "$(rndcolour)" -gradient $(rndangle)
Requires a list of newline-separated colours in a file (here called .hsetroot_colours). These colours can be arbitrary, but here is my list:
#000000
#111111
#000033
#000055
#000077
#0000aa
#0000cc
#0000ff
#0011ff
#0033ff
#0055ff
#0077ff
#00bbff
#00ddff
#00ffff
Despite the limited number of colours, there is a fair bit of variety possible in the wallpapers generated by this script, and the colours all go together, so every wallpaper is unique and pretty.
Offline
GraveyardPC, the output looks very nice. Which font are you using?
DejaVu Sans Mono
Offline
Thanks.
Offline
Here's one I use to copy music to my sansa without the excess cruft of album art and stuff, but I guess it would work for any player using MSC Mode.
#! /bin/bash
# Just copies music (files named *.mp3 and *.ogg) to $1
find . -iname *.ogg -type f -printf "%h/%f\n " > /tmp/justmusic.txt
find . -iname *.mp3 -type f -printf "%h/%f\n " >> /tmp/justmusic.txt
cat /tmp/justmusic.txt | while read line; do
cp "$line" "$1" -v --parents
#echo $line
done
And a bashrc function to randomize your wallpaper:
# Pick a random wallpaper and set it with esetroot
randomwallpaper(){
Esetroot -fit "`find $HOME/Wallpapers/* | shuf | sed -ne '$p'`"
}
Edit: Posted prematurely. Stupid design flaw fixed.
Last edited by alexandrite (2010-07-25 23:37:58)
Offline
this is for making a html page to access virtual machines. i run this on my kvm/web server, and it makes a small webpage with access to most of my virtual machines (it exculdes one with clone or srv in the machine name)
you will need to have mozilla-virt-viewer installed on the client machine, i have it on ubuntu , i need to find the package for arch.
server=192.168.1.x
user=username
quantity=$(virsh list --all | cut -c5-20 | grep -v clone |grep -v srv| wc -l )
cutno=$(echo $(( $quantity - 2 )))
rm /var/www/virtualmachines.html
for i in $( virsh list --all | cut -c5-20 | grep -v clone | grep -v srv | tail -n $cutno)
do
echo "$i:</br><embed type="application/x-virt-viewer"
width="640"
height="480"
uri="qemu+ssh://$user@$server/system" name="$i">
</embed> </br><br>" >> /var/www/virtualmachines.html
done
here is a pic of the basic webpage, with firefox naggin me that i need a plugin. i plan to add more formating soon.
http://marko1989.no-ip.org/pics/virtweb.jpg
the only problem i have with it right now, is that virt-viewer asks for the ssh password 2 times for every machine on the page.
Last edited by markp1989 (2010-07-26 20:20:44)
Desktop: E8400@4ghz - DFI Lanparty JR P45-T2RS - 4gb ddr2 800 - 30gb OCZ Vertex - Geforce 8800 GTS - 2*19" LCD
Server/Media Zotac GeForce 9300-ITX I-E - E5200 - 4gb Ram - 2* ecogreen F2 1.5tb - 1* wd green 500gb - PicoPSU 150xt - rtorrent - xbmc - ipazzport remote - 42" LCD
Offline
I guess it's as much mine as anyone's now: nm-util from python-networkmanager (AUR)
[git] | [AURpkgs] | [arch-games]
Offline
I changed the code slightly.
this is for making a html page to access virtual machines. i run this on my kvm/web server, and it makes a small webpage with access to most of my virtual machines (it exculdes one with clone or srv in the machine name)
you will need to have mozilla-virt-viewer installed on the client machine, i have it on ubuntu , i need to find the package for arch.
server=192.168.1.x
user=username
quantity=$(virsh list --all | cut -c5-20 | grep -vE 'clone|srv' | wc -l )
cutno=$(($quantity - 2))
rm /var/www/virtualmachines.html
for i in $(virsh list --all | cut -c5-20 | grep -vE 'clone|srv' | tail -n $cutno)
do
echo "$i:</br><embed type="application/x-virt-viewer"
width="640"
height="480"
uri="qemu+ssh://$user@$server/system" name="$i">
</embed> </br><br>" >> /var/www/virtualmachines.html
done
Last edited by steve___ (2010-07-26 20:39:48)
Offline
#!/bin/bash
rsync -arpvog --delete --ignore-errors --exclude '.Trash' --exclude '.local/share/Trash' /home/myuser/ /media/backup/myuser/
where myuser is my user and /media/backup is my external hd
and there is the second (funnier) one
#!/bin/bash
rsync -arpvog --delete --ignore-errors --exclude '.Trash' -e "ssh" /home/2nduser/ 2nduser@192.168.1.1:/media/backup/2nduser/
same thing using ssh towards a remote machine's storage device ( remote IP is 192.168.1.1)
both commands launched via cron every midnight
Last edited by scar (2010-07-26 21:01:35)
“The future has already arrived. It's just not evenly distributed yet.”
― William Gibson
Offline
I changed the code slightly.
thanks, i was looking for away to remove the double grep
Desktop: E8400@4ghz - DFI Lanparty JR P45-T2RS - 4gb ddr2 800 - 30gb OCZ Vertex - Geforce 8800 GTS - 2*19" LCD
Server/Media Zotac GeForce 9300-ITX I-E - E5200 - 4gb Ram - 2* ecogreen F2 1.5tb - 1* wd green 500gb - PicoPSU 150xt - rtorrent - xbmc - ipazzport remote - 42" LCD
Offline
This one is a labeled swatch of all 256 colors in a 256 color terminal. The output fits within 80 columns and takes up 26 lines.
Screenshot of output: http://omploader.org/vNTJjZA
#!/usr/bin/env python
fg = '\033[38;5;'
bg = '\033[48;5;'
cStrings=[]
for i in range( 0, 256):
n = str(i)
fgstr = fg + n + 'm' + n + ' '
bgstr = bg + n + 'm' 'XXX'
cStrings.append(fgstr + bgstr + '\033[0m')
for i in range( 0, 10):
cStrings[i] = ' ' + cStrings[i]
for i in range( 10, 100):
cStrings[i] = ' ' + cStrings[i]
x = 0
while x <= 25:
print ' '.join(cStrings[x:256:26])
x = x + 1
EDITED: Updated to eliminate some redundant code and take up one less line.
Last edited by Square (2010-07-27 21:47:38)
Offline
Connects to and executes a command on a client machine connected to an SSH session.
#!/bin/bash
if [ -z "$SSH_CLIENT" ]; then
echo "<ssh-rcmd> No client connected."
exit 1
fi
if [ "$1" = "-p" ]; then
echo -n "<`basename "$0"`@$HOSTNAME> "
shift
fi
client=($SSH_CLIENT)
ssh ${client[0]} $*
Offline
@Square. For some reason the outpupt had a little break in it, beginning from the ten, because the whitespace before the 9 and the 10 was the same, and 10 is wider than 9. (I'm not sure whyy there was no such thing at the switch from 99 to 100). Putting an extra whitespace in the first ' ' in the first for loops
fgstr = ' ' + fg + n + 'm' + n + ' '
fixed it for me.
(I simply tried it out and now the output's fine. I have no idea why really)
Ogion
(my-dotfiles)
"People willing to trade their freedom for temporary security deserve neither and will lose both." - Benjamin Franklin
"Enlightenment is man's leaving his self-caused immaturity." - Immanuel Kant
Offline
I just recently got a couple of new(to me) MP3 players and have rockboxed them. So my old RB daily download script had to be revamped as all I had was an e200 before.
#!/bin/bash
# This script will download the daily build of rockbox in your flavor.
# It's already preloaded with a some of the dailies that I normally use
# Variables
SAVE_FOLDER=/path/to/save/to
case "$1" in
#Sansa e200v1
'e200')
BUILD_NAME="Sansa e200"
BUILD_URL=sansae200
;;
#Sansa e200v2
'e200v2')
BUILD_NAME="Sansa e200v2"
BUILD_URL=sansae200v2
;;
#Sansa Clip
'clip')
BUILD_NAME="Sansa Clip"
BUILD_URL=sansaclip
;;
#Sansa Fuze
'fuze')
BUILD_NAME="Sansa Fuze"
BUILD_URL=sansafuze
;;
#iPod Video 30GB
'ipodvid')
BUILD_NAME="iPod Video 30GB"
BUILD_URL=ipodvideo
;;
#A blank template for the case used, if you want to add a new player
#'')
#BUILD_NAME=""
#BUILD_URL=
#;;
*)
echo
echo "Usage: $0 [e200|e200v2|fuze|clip|ipodvid]"
echo
exit 1
;;
esac
# The meat
# Send notification
notify-send -t 2500 -u normal -i stock_download Rockbox\ Download "$BUILD_NAME Daily Build Download started..."
# Move to the directory
cd $SAVE_FOLDER
# Show the user what you are doing
echo
echo "cd $SAVE_FOLDER"
echo
# Download
wget -t 3 -N http://download.rockbox.org/daily/$BUILD_URL/rockbox-$BUILD_URL.zip
# Using the wget return value see if it worked or not
if [ $? -eq 0 ]
then
# Added terminal acknowledgement
echo Daily Build $BUILD_NAME complete!
echo
notify-send -t 2500 -u normal -i info Rockbox\ Download "$BUILD_NAME Daily Download Complete. <a href=\"file://$SAVE_FOLDER\">Click to open folder...</a>"
else
# Fail! Added Terminal acknowledgement
echo Daily Build $BUILD_NAME failed!
echo
notify-send -t 2500 -u critical -i error Rockbox\ Download "$BUILD_NAME Daily Download Error!!!"
fi
exit
Probably not pretty and the comments are a side effect of the local community colleges draconian need for programming students to comment up the wazoo, as well as my own scatterbrainedness.. It seems to do a great job though.
Offline
Just some advice: whoever makes you comment like that is completely ignorant of how to write readable code. Don't do that shit in the real world. ಠ_ಠ
Comments should explain why, not what. Your variable and function names should explain the what.
[git] | [AURpkgs] | [arch-games]
Offline
Just some advice: whoever makes you comment like that is completely ignorant of how to write readable code. Don't do that shit in the real world. ಠ_ಠ
Comments should explain why, not what. Your variable and function names should explain the what.
Oh believe me, this has been a topic of discussion in numerous classes there. But it's what they want, and it's a hard habit to break when you are in between homework assignments. Stupid one track mind that I have.
Offline
Here's a .bashrc/.zshrc function I wrote, similar to the makescript function, but used for quickly compiling single-file source code.
(...)
Hey
I believe you can achieve the same result by just doing:
make foo.c
make foo.cpp
etc...
Offline