You are not logged in.
dmenu application launcher, with your most used applications listed first and you can append a ";" to start the program in a terminal.
Nice and simple. Very nice.
archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson
Offline
this 1 checks the weather from the bbc site, then uses feh to change the wallpaper accordiingly. i have this set to run every hour in cron.
#!/bin/bash curl http://feeds.bbc.co.uk/weather/feeds/rss/obs/world/0008.xml >/dev/null 2>&1 > .weatherfeedrs ##Set wallpaper depending on current conditions. if grep -qw rain .weatherfeedrs ; then feh --bg-scale /home/mark/weatherwallpapers/rain.jpg elif grep -qw cloudy .weatherfeedrs ; then feh --bg-scale /home/mark/weatherwallpapers/cloudy.jpg elif grep -qw clear .weatherfeedrs ; then feh --bg-scale /home/mark/weatherwallpapers/clear.jpg elif grep -qw sunny .weatherfeedrs ; then feh --bg-scale /home/mark/weatherwallpapers/sunny.jpg else echo other fi echo `date` `cat .weatherfeedrs | tail -n 13 | head -n 1 |cut -f1 -d'.'` >> ~/weatherhistory
there is probably a lot better way to do this, but this is working for me atm. i have it keep a list of previous weather stats, so i know what syntax bbc use, so i can update the greps accordingly .
This sounds great - I'll give it a go (and ditch nitrogen). Thank you.
LXDE installed on an Intel E5200 (oc to 3.25ghz), Gigabyte GA-73PVM-S2 motherboard (GEForce 7100 graphics), 2GB 800mhz RAM & a 320GB WD SATA HD.
Offline
dmenu application launcher, with your most used applications listed first and you can append a ";" to start the program in a terminal.
Thanks for this. I took out the cache part, but i have a suggestion. Add $@ behind $DMENU so you can pass it the same options as you would natively.
archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson
Offline
b3n wrote:dmenu application launcher, with your most used applications listed first and you can append a ";" to start the program in a terminal.
Thanks for this. I took out the cache part, but i have a suggestion. Add $@ behind $DMENU so you can pass it the same options as you would natively.
#!/bin/sh
TERMI="urxvt -e sh -c"
CACHE="$HOME/.dmenu_cache_recent"
MOST_USED=`sort $CACHE | uniq -c | sort -rn | colrm 1 8`
RUN=`(echo "$MOST_USED"; dmenu_path | grep -vxF "$MOST_USED") | dmenu "$@"` &&
(echo $RUN; head -n 99 $CACHE) > $CACHE.$$ && mv $CACHE.$$ $CACHE
case $RUN in
*\;) exec $TERMI "$RUN";;
*) exec $RUN;;
esac
Last edited by b3n (2009-04-10 17:34:31)
Offline
so i have my custom aurget script in this thread somewhere that just automates wget/tar/pacman -U to quickly get an aur package.
well, this is a companion script that will check the version of your currently aur-installed packages (pacman -Qm) against the PKGBUILDs' pkgver/pkgrel from aur.archlinux.org.
it prints a nicely formatted list of your aur packages, green for matching version/release (up to date) and red for mismatches (out of date).
#!/bin/bash
#
# AurCheck V 0.1
#
# pbrisbin 2009
#
# script parses aur.archlinux PKGBUILDs and compares
# it to `pacman -Qm` outputs to find out if you've
# got the latest aur package installed
#
###
# Set up a working directory
WD="/tmp/aurcheck"
[ -d $WD ] || mkdir $WD
# print a header row
echo ""
line="$(echo Package Available Installed | \
awk '{printf "%-30s %20s %20s\n", $1, $2, $3}')"
echo -e "\e[1;37m$line\e[0m"
# list out foreign packages and check the versions
pacman -Qm | while read pack; do
name="$(echo $pack | awk '{print $1}')"
pkgver="$(echo $pack | awk '{print $2}' | cut -d "-" -f 1)"
pkgrel="$(echo $pack | awk '{print $2}' | cut -d "-" -f 2)"
URL="http://aur.archlinux.org/packages/${name}/${name}/PKGBUILD"
wget -q -O $WD/PKGBUILD "$URL"
pkgverN="$(grep ^pkgver $WD/PKGBUILD | cut -d "=" -f 2 | tr -d '"')"
pkgrelN="$(grep ^pkgrel $WD/PKGBUILD | cut -d "=" -f 2 | tr -d '"')"
line="$(echo $name ${pkgverN}-${pkgrelN} ${pkgver}-${pkgrel} | awk '{printf "%-30s %20s %20s\n", $1, $2, $3}')"
if [ "${pkgver}-${pkgrel}" = "${pkgverN}-${pkgrelN}" ]; then
echo -e "\e[0;32m$line\e[0m"
else
echo -e "\e[1;31m$line\e[0m"
fi
done
echo ""
# cleanup
[ -d $WD ] && rm -rf $WD
exit 0
edit: slight optimization.
Last edited by brisbin33 (2009-04-10 17:21:42)
//github/
Offline
Can someone help me make an alias/script that will check if a partition is mounted, and if not it will mount it and vice versa (if it is mounted, it will unmount it)?? My path is /media/tera. It's an external drive connected via eSata and many automounting solutions haven't worked consistently thus far, and I'd probably rather do it via shell anyhow.
Offline
Can someone help me make an alias/script that will check if a partition is mounted, and if not it will mount it and vice versa (if it is mounted, it will unmount it)?? My path is /media/tera. It's an external drive connected via eSata and many automounting solutions haven't worked consistently thus far, and I'd probably rather do it via shell anyhow.
i have a check like this in my backup scripts. just make a lock file on the drive (touch /media/tera/.lock). then use this:
#!/bin/bash
DRIVE="/media/tera"
if [ -z $DRIVE/.lock ]; then
mount $DRIVE
else
umount $DRIVE
fi
this is if there's an fstab line for it. being root may be required depending on your setup as well.
//github/
Offline
Thanks a lot brisbin33, that looks awesome. I do have a line for it in fstab (w/noauto). I just tried the script however and it seems to only umount. If the .lock file is there, then it should be unmounted, if it's not there then it should be mounted, no? I tried reversing them and it mounted but then didn't umount. Ack, I'm still a scripting noob so bare with me lol
Offline
no worries, sometimes i have issues wrapping my head around when -z (if does not exist) works or not when it's acting on files ($DRIVE/.lock). try this version instead:
#!/bin/bash
DRIVE="/media/tera"
if [ -f $DRIVE/.lock ]; then
umount $DRIVE
else
mount $DRIVE
fi
Last edited by brisbin33 (2009-04-10 20:37:25)
//github/
Offline
Egg-sealant! Works like a charm, thanks a ton
Offline
Why the extra file?
#!/bin/bash
DRIVE="/media/tera"
if mount | grep -q $DRIVE; then
umount $DRIVE
else
mount $DRIVE
fi
Offline
Always many ways to skin a cat huh I added it as function to bash, works great dudes.
I am also trying to add a function that uses find for a string, then copies all results to a specified dir. I have this but it's not working:
findcp() {
find -iname "$1" -exec cp '{}' $2/ \;
}
So I'd like to use it as "find invoices backup/".
Last edited by colbert (2009-04-11 00:06:05)
Offline
Thanks brisbin33 I realized I wasn't telling find where to look, and also the -iname string was missing the asterisks. This works now:
find $1 -iname "*$2*" -exec cp '{}' $3 \;
Now however I am trying to get it to print the results of the files that have been found and copied over, however I tried -print0 and -printf after checking man find but neither worked.
Offline
Here's a small script to use on these forums to search for text references. When you search, it'll provide you the forum, but not the page with the keyword. On long threads, this is annoying.
#!/usr/bin/python
# FindPost.py
# Forum Search
import urllib
url = raw_input("Enter url: "); #like http://bbs.archlinux.org/viewtopic.php?id=[THREADID]&p=
pages = raw_input("How many pages is the thread? ");
user = raw_input("String to search: ");
for i in range(1,int(pages)+1):
page = urllib.urlopen(url+str(i)).read()
if(page.find(user)!=-1):
print url+str(i)
Offline
In my .bashrc - to start a random shoutcast stream, optionally after searching for content.
radio() {
killall mpg123; shoutcast-search -n 1 -t mpeg -b ">63" --sort=ln10r $* | xargs mpg123 -q -@ &
}
To start a station playing chill:
$ radio chill
See http://bbs.archlinux.org/viewtopic.php?id=69399 or http://code.k2h.se for more info.
Last edited by halhen (2009-04-12 09:57:01)
Offline
Builds from the ABS. I made it when I started getting into Gentoo.
#!/bin/bash
# Archaeon -- Small ABS Building Script
# By Vithon <ratm@archlinux.us>
if [ "$1" = "" ] ; then
echo "Archaeon v0.3"
echo "USAGE:"
echo "`basename $0` [PACKAGE NAME]"
echo
exit 0
fi
ABS_PKG_DIR=`find /var/abs -name "$1"`
ROOT_BUILD_DIR="/tmp/archaeon_build"
PKG_DIR="$ROOT_BUILD_DIR/$1/"
echo "[-] Archaeon starting."
if [ "ABS_PKG_DIR" = "" ] ; then
echo "[-] ERROR: No packages exist with the name '$1'."
exit 1
fi
echo "[+] Making build directory..."
mkdir -p "$PKG_DIR"
cd "$PKG_DIR"
echo "[+] Copying files..."
rsync -r "$ABS_PKG_DIR/" "$PKG_DIR/"
echo "[+] Building package..."
makepkg &>build.log
if [ ! -e *.pkg.tar.gz ] ; then
echo "[-] ERROR: $1 package not built. Check $PKG_DIR/build.log."
exit 1
fi
echo "[+] Installing $1..."
sudo pacman -U *.pkg.tar.gz &>/dev/null
echo "[+] Cleaning up..."
rm -rf $PKG_DIR
echo "[-] Archaeon finished."
Offline
Builds from the ABS. I made it when I started getting into Gentoo.
#!/bin/bash # Archaeon -- Small ABS Building Script # By Vithon <ratm@archlinux.us> if [ "$1" = "" ] ; then echo "Archaeon v0.3" echo "USAGE:" echo "`basename $0` [PACKAGE NAME]" echo exit 0 fi ABS_PKG_DIR=`find /var/abs -name "$1"` ROOT_BUILD_DIR="/tmp/archaeon_build" PKG_DIR="$ROOT_BUILD_DIR/$1/" echo "[-] Archaeon starting." if [ "ABS_PKG_DIR" = "" ] ; then echo "[-] ERROR: No packages exist with the name '$1'." exit 1 fi echo "[+] Making build directory..." mkdir -p "$PKG_DIR" cd "$PKG_DIR" echo "[+] Copying files..." rsync -r "$ABS_PKG_DIR/" "$PKG_DIR/" echo "[+] Building package..." makepkg &>build.log if [ ! -e *.pkg.tar.gz ] ; then echo "[-] ERROR: $1 package not built. Check $PKG_DIR/build.log." exit 1 fi echo "[+] Installing $1..." sudo pacman -U *.pkg.tar.gz &>/dev/null echo "[+] Cleaning up..." rm -rf $PKG_DIR echo "[-] Archaeon finished."
thats cool, thanks for this
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
It's barely a "Thank you" thing. It can only install one app at a time and messes up when something like this happens:
┌─[andy @ vithon]-[9:28:18]
└─[~]-[$]> find /var/abs -name "vim"
/var/abs/local/vim
/var/abs/extra/vim
Offline
dmenu launcher that displays the friendly names instead of the executable names for applications.
#!/bin/sh apps='/usr/share/applications' dmen="dmenu -i -b -fn '-*-terminus-*-r-normal-*-*-120-*-*-*-*-iso8859-*' -nb #000000 -nf #9999CC -sb #000066" name=$(grep -h "^Name=" $apps/*.desktop | sed 's:Name=::' | $dmen) if [[ "$name" != "" ]]; then dfile=$(grep -l "^Name=$name$" $apps/*.desktop) if [[ $(echo "$dfile" | wc -l) > 1 ]]; then dfile="$apps/$(echo -e "$dfile" | sed "s:${apps}/::" | $dmen -p "Which $name?")" fi xdg-open $dfile fi
Here's another version that combines both friendly and executable names:
#!/bin/sh apps='/usr/share/applications' dmen="dmenu -i -b -fn '-*-terminus-*-r-normal-*-*-120-*-*-*-*-iso8859-*' -nb #000000 -nf #9999CC -sb #000066" name=$(echo -e "$(grep -h "^Name=" $apps/*.desktop | sed 's:Name=::')\n$(dmenu_path)" | $dmen) if [[ "$name" != "" ]]; then dfile=$(grep -l "^Name=$name$" $apps/*.desktop) if [ $dfile ]; then if [[ $(echo "$dfile" | wc -l) > 1 ]]; then dfile="$apps/$(echo -e "$dfile" | sed "s:${apps}/::" | $dmen -p "Which $name?")" fi xdg-open "$dfile" else which "$name" &> /dev/null && exec "$name" & fi fi
My shell script skills aren't that clean, so if there's a more efficient way to write those, I'd like to hear the corrections.
in trying to use the top one , and when i run it i get error saying that xdg-open command not found, what package is this part of ?
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
[marst@xeon afc]$ pacman -Qo `which xdg-open`
/usr/bin/xdg-open is owned by xdg-utils 1.0.2-1
Offline
You should also check out pkgfile, available in community/pkgtools. It can help you find what package owns a file, among other things.
[git] | [AURpkgs] | [arch-games]
Offline
I made this little script to extract and convert the audio from flv videos to mp3, so I can use it in my car CD player.
Maybe something like this already exists, but I took the opportunity to practice a little at bash scripting
#! /bin/bash
# ************************************
# ** flv to mp3 converter script **
# ************************************
# If no filename specified. Print error message and exit
if [ $# != 1 ]
then
echo Usage: $0 inputfile >&2
exit 1
fi
# If wrong filetype specified. Print error message and exit
if [[ $1 != *.flv ]]
then
echo FLV file expected!
echo Usage: $0 inputfile >&2
exit 1
fi
# Create variable with filename extension removed
FILNAME=${1%.[^.]*}
# Extract audio from flv file using mplayer (placed in same folder as the original file)
mplayer "$1" -vo null -ao pcm:file="$FILNAME.wav"
# Compress extracted file to mp3 using lame (placed in same folder as original file)
lame --preset standard "$FILNAME.wav" "$FILNAME.mp3"
# Remove wav file
rm "$FILNAME.wav"
MadEye | Registered Linux user #167944 since 2000-02-28 | Homepage
Offline
Mine is fucking awsome! (I'm sure someone else must have post this)
while true
do
mpc | grep - | wmiir create /rbar/mpd
sleep 2
done
You start it trough ~/mpdScript.sh (if you have saved it to mpdScript.sh in your homefolder) and you close by rebooting(?)
It display the song playing in mpd on the wmii statusbar, omg this is awesome, altough i'll be back with improvement laters
EDIT: i had forgotten the "create" after wmiir... fixed now
Last edited by jumzi (2009-04-13 11:29:43)
Offline