You are not logged in.
looks interesting , but i've no idea what I can do with that output yet
This silver ladybug at line 28...
Offline
Here's a couple of small scripts I wrote for xmms2 to add and select songs
[~/desktop/bin 0] cat menu_play.sh
HISTORY_FILE='/home/hashbox/.playhist'
SELECTION=`cat $HISTORY_FILE | dmenu -p What\? -i -nb black -nf grey40 -sb grey10 -sf grey80 -fn "-*-proggyclean-*-*-*-*-*-*-*-*-*-*-*-*"`
if [ -n "$SELECTION" ]; then
echo $SELECTION | cat - $HISTORY_FILE | sort | uniq -i > $HISTORY_FILE
xmms2 stop
xmms2 clear
xmms2 mlib searchadd "$SELECTION"
xmms2 play
fi
[~/desktop/bin 0] cat menu_play_id.sh
SELECTION=`xmms2 list | dmenu -p What\? -i -nb black -nf grey40 -sb grey10 -sf grey80 -fn "-*-proggyclean-*-*-*-*-*-*-*-*-*-*-*-*"`
if [ -n "$SELECTION" ]; then
ID=`echo $SELECTION | grep -e '[0-9]*/[0-9]*' -o | awk -F / '{print $1}'`
exec xmms2 jump $ID
fi
Also, I don't have much experience with grep and awk regexps, is there a more simple way of doing what I did in the above?
Offline
A quick hack to recompress all tar.gz files to tar.bz2 recursively in the ./ directory.
Yes, there are potential problems with it, like what if you have .tar files also, but this was mainly for http://bbs.archlinux.org/viewtopic.php? … 34#p552334
gunzip `find ./ -name *tar.gz`
bzip2 `find ./ -name *.tar`
Offline
nodisplay: Run this on a file in /usr/share/applications to stop it from showing up in Xfce's menu (and presumably KDE's and GNOME's menus).
#!/bin/bash
if [ "`grep NoDisplay=true "$1"`" == "" ]
then
echo NoDisplay=true >> "$1"
fi
@tomd123: I would do:
find ./ -name *.tar.gz | while read line
do
gunzip "$line"
bzip2 "$line"
done
Offline
@tomd123: I would do:
find ./ -name *.tar.gz | while read line do gunzip "$line" bzip2 "$line" done
This will go wrong because *.tar.gz needs to be quoted or it will expand to archives in the current directory (applies to tomd's too) and bzip2 needs to work on $(basename "$line" .gz)
Offline
This will go wrong because *.tar.gz needs to be quoted or it will expand to archives in the current directory (applies to tomd's too)
I don't experience this problem.
and bzip2 needs to work on $(basename "$line" .gz)
Oh! I didn't think of that. But basename seems to chop of the directory portion of the filename (e.g. "$ basename powder/powder110_src.tar.gz .gz" gives me "powder110_src.tar"). Here is my proposed solution:
find ./ -name *.tar.gz | while read line
do
gunzip "$line"
bzip2 "`echo $line | sed s/.gz//`"
done
Last edited by Killa B (2009-05-14 19:02:28)
Offline
i wrote this just now b/c i realized i had a few *.pacnew files in /etc that i had to take care. i think it'll come in handy time to time...
#!/bin/bash
#
# PacNews
#
# pbrisbin 2009
#
# this script tries to streamline the
# handling of *.pacnew files
#
###
message() {
echo ""
echo "pacnews is designed to streamline dealing with .pacnew files."
echo ""
echo "pacnews must be run as root, and will optionally accept a"
echo "directory on which to act, otherwise /etc will be searched by"
echo "default."
echo ""
echo "all *.pacnew files found will be presented to you one by one; "
echo "you'll have the option of viewing/editing your current config"
echo "file side by side with the pacnew file through vimdiff, then"
echo "you can remove the pacnew file, replace you're existing"
echo "config file with the .pacnew file, or do nothing."
echo ""
echo "answering anything other than \"y\" to the options will"
echo "eventually bring you back without changing your system in any"
echo "way."
echo ""
exit 1
}
display() {
echo -e "\e[1;34m:: \e[1;37m$1\e[0m"
}
errorout(){
echo -e "\e[1;31m==> \e[1;37m$1\e[0m"
exit 1
}
if [ -z $1 ]; then
DIR="/etc"
elif [ "$1" = "--help" ]; then
message
else
[ -d $1 ] || errorout "$1 is not a directory, try --help"
DIR="$1"
fi
[ "$(whoami)" != "root" ] && errorout "You must be root"
for file in $(find $DIR -name '*.pacnew'); do
[ "$file" = "" ] && display "No pacnew files found"
current="$(echo $file | sed 's/\.pacnew//g')"
display "$file found, edit current config? (Y/n) " && read A
[ "$A" = "y" ] && vimdiff $current $file
display "Remove ${file}? (Y/n) " && read A
if [ "$A" = "y" ]; then
rm $file || errorout "Error removing the pacnew file"
display "$file was removed"
else
display "Replace $current with ${file}? (Y/n) " && read A
if [ "$A" = "y" ]; then
cp $current $current.pacsave || errorout "Error backing up existing config"
display "$current saved as $current.pacsave"
mv $file $current || errorout "Error replacing your config file"
display "$current replaced by $file"
fi
fi
done
exit 0
### Created: 200905141304
i used it to view/edit some pacnews today but it's pretty much un-tested... review the code and use at your own risk (considering it plays around in /etc as root .
//github/
Offline
@brisbin33: Thanks, nice script, I just went through the pacnews for the first time in ages.
Offline
@brisbin33: Thanks, nice script, I just went through the pacnews for the first time in ages.
means alot comin from your procyon. glad you liked it.
//github/
Offline
im trying to make a script that will look for googlewacks.
can some on give me a hand, the curl line i have commented out searches for 1 word fine, but the other line doesnt search for both words like i was expecting
can some one give me a hand? thanks Markp1989
#!/bin/bash
while true; do
wordlist=/home/mark/wordlist.txt
word1=$(sort -R "$wordlist" | head -n 1)
word2=$(sort -R "$wordlist" | head -n 1)
#curl -s -A 'Mozilla/4.0' 'http://www.google.co.uk/search?hl=en&q'=$word1 | html2text -ascii -nobs -style compact -width 80 > google.cache
curl -s -A 'Mozilla/4.0' 'http://www.google.co.uk/search?source=ig&hl=en&rlz=&=&q='$word1+$word2 | html2text -ascii -nobs -style compact -width 80 > google.cache
if grep -qw "Results 1 - 1" google.cache; then
echo ------------------------------------
echo google wack found `grep Results google.cache`
echo ------------------------------------
grep Results google.cache >> googlewacks.txt
else
echo Not a google wack `grep Results google.cache`
fi
sleep 30
done
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 used this when running superPI overnight to log the temperature of my cores when testing my over clock .
requires LM sensors
#!/bin/bash
while true; do
echo `date` `sensors | grep "Core 0" | cut -f2 -d'+' | cut -f1 -d'C'` `sensors | grep "Core 1" | cut -f2 -d'+' | cut -f1 -d'C'` >> temp.log
sleep 5
done
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
markp1989, try this
curl -s -A 'Mozilla/4.0' "http://www.google.co.uk/search?source=ig&hl=en&rlz=&=&q=${word1}+${word2}"
i still get the same as before. if i look in the google.cache file after atempting to run the script i get this output
[mark@markspc ~]$ cat google.cache
Google Error
****** Bad Request ******
Your client has issued a malformed or illegal request.
[mark@markspc ~]$
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
odd, this works for me:
> cat .bin/googlewacks
#!/bin/bash
###
word1="dogs"
word2="cats"
curl -s -A 'Mozilla/4.0' "http://www.google.co.uk/search?source=ig&hl=en&rlz=&=&q=$word1+$word2" | html2text -ascii -nobs -style compact -width 80
> googlewacks | grep Results
Web Results 1 - 10 of about 21,300,000 for dogs cats. (0.19 seconds)
i'd rewrite you're version like this and try it:
#!/bin/bash
wordlist="$HOME/wordlist.txt"
while true; do
word1="$(sort -R $wordlist | head -n 1)"
word2="$(sort -R $wordlist | head -n 1)"
curl -s -A 'Mozilla/4.0' "http://www.google.co.uk/search?source=ig&hl=en&rlz=&=&q=$word1+$word2" | html2text -ascii -nobs -style compact -width 80 > google.cache
if grep -qw "Results 1 - 1" google.cache; then
echo ------------------------------------
echo google wack found `grep Results google.cache`
echo ------------------------------------
grep Results google.cache >> googlewacks.txt
else
echo Not a google wack `grep Results google.cache`
fi
sleep 30
done
little style adjustments too ... i think you were just having a quoting issue
Last edited by brisbin33 (2009-05-15 17:01:54)
//github/
Offline
[mark@markspc Desktop]$ wordlist="$HOME/wordlist.txt"
[mark@markspc Desktop]$ word1="$(sort -R $wordlist | head -n 1)"
[mark@markspc Desktop]$ word2="$(sort -R $wordlist | head -n 1)"
[mark@markspc Desktop]$ echo $word1
repartition
[mark@markspc Desktop]$ echo $word2
rumourmonger's
[mark@markspc Desktop]$ curl -s -A 'Mozilla/4.0' "http://www.google.co.uk/search?source=ig&hl=en&rlz=&=&q=$word1+$word2" | html2text -ascii -nobs -style compact -width 80
Google Error
****** Bad Request ******
Your client has issued a malformed or illegal request.
[mark@markspc Desktop]$
i dont understand if there is a problem with my word list file or what, its getting on my nervs lol
i tried setting word1 and word2 manualy to a word like you tried, and it works with that, just doesnt with my wordlist :S
Last edited by markp1989 (2009-05-15 17:23:52)
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
rumourmonger's might eff it up with that ' in it
i tried it and this time it had no puncuation it in. but it still has the same problem :S
[mark@markspc ~]$ wordlist="$HOME/wordlist.txt"
[mark@markspc ~]$ word1="$(sort -R $wordlist | head -n 1)"
[mark@markspc ~]$ word2="$(sort -R $wordlist | head -n 1)"
[mark@markspc ~]$ echo $word1
batboy
[mark@markspc ~]$ echo $word2
astronautic
[mark@markspc ~]$ curl -s -A 'Mozilla/4.0' "http://www.google.co.uk/search?source=ig&hl=en&rlz=&=&q=$word1+$word2" | html2text -ascii -nobs -style compact -width 80
Google Error
****** Bad Request ******
Your client has issued a malformed or illegal request.
[mark@markspc ~]$
anyone got any wordlist files i can try to see if my one is causing the problem?
thanks markp1989
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
mark i'm completely baffled
┌─[ 14:42 ][ blue:~ ]
└─> for word in some random words like this and that; do echo $word >> tempword.lst ; done
┌─[ 14:42 ][ blue:~ ]
└─> word1="$(sort -R tempword.lst | head -n1)"
┌─[ 14:42 ][ blue:~ ]
└─> word2="$(sort -R tempword.lst | head -n1)"
┌─[ 14:42 ][ blue:~ ]
└─> echo $word1 $word2
words random
┌─[ 14:42 ][ blue:~ ]
└─> curl -s -A 'Mozilla/4.0' "http://www.google.co.uk/search?source=ig&hl=en&rlz=&=&q=$word1+$word2" | html2text -ascii -nobs -style compact -width 80 | grep Results
Web Results 1 - 10 of about 28,300,000 for words random. (0.25 seconds)
where is this words list coming from? it seems obvious that with a simple clean listing of words this curl command works fine. somehow i think yours is encoded differently or something.
i don't really know what googlewhacks are so i may be thinking about this the wrong way.
//github/
Offline
mark i'm completely baffled
┌─[ 14:42 ][ blue:~ ] └─> for word in some random words like this and that; do echo $word >> tempword.lst ; done ┌─[ 14:42 ][ blue:~ ] └─> word1="$(sort -R tempword.lst | head -n1)" ┌─[ 14:42 ][ blue:~ ] └─> word2="$(sort -R tempword.lst | head -n1)" ┌─[ 14:42 ][ blue:~ ] └─> echo $word1 $word2 words random ┌─[ 14:42 ][ blue:~ ] └─> curl -s -A 'Mozilla/4.0' "http://www.google.co.uk/search?source=ig&hl=en&rlz=&=&q=$word1+$word2" | html2text -ascii -nobs -style compact -width 80 | grep Results Web Results 1 - 10 of about 28,300,000 for words random. (0.25 seconds)
where is this words list coming from? it seems obvious that with a simple clean listing of words this curl command works fine. somehow i think yours is encoded differently or something.
i don't really know what googlewhacks are so i may be thinking about this the wrong way.
i got it working now, i dont know what was wrong with the wordlist, i copied the words in to a new text file, and im now using this one as the word list. and it works now.
and a google wack is a search using 2 dictionary words, that only has 1 result
thanks for your help
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
ebg() {
$* 1> /dev/null 2> /dev/null &
}
Executes a command in the background and redirects all output to /dev/null. (I hate getting my prompt clobbered.)
Last edited by Peasantoid (2009-05-15 21:01:29)
Offline
Peasantoid that's a good one i have something very similar in my .bashrc
one tip though,
command >/dev/null 2>&1 &
is the shorter version of
command 1>/dev/null 2>/dev/null &
//github/
Offline
Peasantoid that's a good one i have something very similar in my .bashrc
one tip though,
command >/dev/null 2>&1 &
is the shorter version of
command 1>/dev/null 2>/dev/null &
And command &>/dev/null & is yet another shorter and less weird way of doing that.
Last edited by Joshmotron (2009-05-15 21:24:10)
Offline
And command &>/dev/null & is yet another shorter, and less weird, way of doing that.
Thanks, just what I was looking for.
Offline
brisbin33 wrote:Peasantoid that's a good one i have something very similar in my .bashrc
one tip though,
command >/dev/null 2>&1 &
is the shorter version of
command 1>/dev/null 2>/dev/null &
And command &>/dev/null & is yet another shorter and less weird way of doing that.
yeah that doesn't work for me in all cases. good to know though.
//github/
Offline
Joshmotron wrote:brisbin33 wrote:Peasantoid that's a good one i have something very similar in my .bashrc
one tip though,
command >/dev/null 2>&1 &
is the shorter version of
command 1>/dev/null 2>/dev/null &
And command &>/dev/null & is yet another shorter and less weird way of doing that.
yeah that doesn't work for me in all cases. good to know though.
Why not just use "nohup command &" in case you later might want to see the output?
Offline