From da2d0f071e5cd37b6f4f04906b5f2006cec57a70 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Tue, 11 Nov 2008 22:10:33 +0100 Subject: updated and added soem things --- bashrun | 3 +- grank | 91 ++++++++ info.pl | 678 ++++++++++++++++++++---------------------------------- logos.pl | 37 +++ pagerank | Bin 0 -> 8930 bytes prank | 35 +++ set-background.sh | 1 + ssh-mount.sh | 4 + ssh-unmount.sh | 1 + 9 files changed, 425 insertions(+), 425 deletions(-) create mode 100755 grank create mode 100644 logos.pl create mode 100755 pagerank create mode 100755 prank diff --git a/bashrun b/bashrun index 99e369c..b571a52 100755 --- a/bashrun +++ b/bashrun @@ -1,5 +1,4 @@ - -#!/bin/dash +#!/bin/bash # # usage: bashrun [geometry] (default: 40x1) # diff --git a/grank b/grank new file mode 100755 index 0000000..3127f3c --- /dev/null +++ b/grank @@ -0,0 +1,91 @@ +#!/bin/bash + +# grank - find your google rank index +# +# 2008 - Mike Golvach - eggi@comcast.net +# +# Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License +# + +if [ $# -lt 2 -a $# -ne 0 ] +then + echo "Usage: $0 URL Search_Term(s)" + echo "URL with or with http(s)://, ftp://, etc" + exit 1 +fi + +if [ $# -eq 0 ] +then + while read x y + do + url=$x + search_terms=$y + $0 $x "$y" + done + exit 0 +else + url=$1 + shift + search_terms=$@ +fi + +base=0 +num=1 +start=0 +multiple_search=0 +not_found=0 + +for x in $search_terms +do + if [ $multiple_search -eq 0 ] + then + search_string=$x + multiple_search=1 + else + search_string="${search_string}+$x" + fi +done + +echo "Searching For Google Index For $url With Search Terms: $search_terms..." +echo + +num_results=`wget -q --user-agent=Firefox -O - http://www.google.com/search?q=$search_string\&hl=en\&safe=off\&pwst=1\&start=$start\&sa=N|awk '{ if ( $0 ~ /of about .*<\/b> for/ ) print $0 }'|awk -F"of about" '{print $2}'|awk -F"" '{print $2}'|awk -F"" '{print $1}'` + +while :; +do + if [ $not_found -eq 1 ] + then + break + fi + wget -q --user-agent=Firefox -O - http://www.google.com/search?q=$search_string\&num=100\&hl=en\&safe=off\&pwst=1\&start=$start\&sa=N|sed 's//\n\1\n/g'|awk -v num=$num -v base=$base '{ if ( $1 ~ /^http/ ) print base,num++,$NF }'|awk '{ if ( $2 < 10 ) print "Google Index Number " $1 "0" $2 " For Page: " $3; else if ( $2 == 100 ) print "Google Index Number " $1+1 "00 For Page: " $3;else print "Google Index Number " $1 $2 " For Page: " $3 }'|grep -i $url + if [ $? -ne 0 ] + then + let start=$start+100 + if [ $start -eq 1000 ] + then + not_found=1 + if [ $not_found -eq 1 ] + then + break + fi + fi + let base=$base+1 + first_page=0 + else + break + fi + + let sleep_time=${RANDOM}/600 + echo "Not In Top $start Results: Sleeping $sleep_time seconds..." + sleep $sleep_time +done + +if [ $not_found -eq 1 ] +then + echo "Not Found In First 1,000 Index Results - Google's Hard Limit" + echo +fi + +echo "Out Of Approximately $num_results Results" +echo +exit 0 diff --git a/info.pl b/info.pl index 0eb1bb1..d29aa95 100755 --- a/info.pl +++ b/info.pl @@ -1,453 +1,285 @@ #!/usr/bin/perl -# http://bbs.archlinux.org/viewtopic.php?pid=395002 -use Switch; -use strict; -use File::Basename; - -#################### -## Config options ## -#################### - -## What distro logo to use to use, Available "Archlinux Debian Ubuntu None" ## -my $distro = "Archlinux"; -my $myArchVersion = "ArchLinux (Core Dump)"; - -## what values to display. Use "OS Kernel DE WM win_theme Theme Font Icons" ## -my $display = "OS Kernel DE WM Win_theme Theme Icons Font Background"; - -## Takes a screen shot if set to 0 ## -my $shot = 0; -## Command to run to take screen shot ## -my $command = "scrot -d 10"; - -## What colors to use for the variables. ## -my $textcolor = "\e[0m"; - -## Prints little debugging messages if set to 0 ## -my $quite = 1; - - +# @title : Theme info script 0.1.2 revisited +# @author: rab +# @date : 08/04/08 +# @commnt: Maybe if people quit forking the hell outta this, it would be easier to maintain + +## Configurations +# On = 1. Off = 0 +my %display = ( + "OS" => 1, # Displays the operating system's name + "KL" => 1, # Displays your kernel version + "DE" => 0, # Displays your desktop environment, if you have one + "WM" => 1, # Displays your window manager + "WMT" => 1, # Displays your window manager's theme + "IC" => 1, # Displays your icon theme, if you have one + "FN" => 1, # Displays your font + "UI" => 1 # Displays your UI theme + ); + +# The command to execute for taking a screenshot +# Escape ' with a backslash, \' +# Leave blank if you don't want a screenshot taken +#my $screenshot = 'scrot screen-%H-%M-%S.png -e \'mv $f ~/media/screens/\''; +my $screenshot = ''; + +# The Color to use for the variables, needs to be global for logos.pl +@colors = ( "\e[38;0;33m", "\e[38;1;37m", "\e[m" ); + +# Debugging +my $debug = 1; +## End of configuration ######################## ## Script starts here ## ######################## -## Define some thing to work with strict ## -my @line = (); -my $found = 0; -my $DE = "NONE"; -my $WM = "Beryl"; - -## Hash of WMs and the process they run ## -my %WMlist = ("Beryl", "beryl", - "Fluxbox", "fluxbox", - "Openbox", "openbox", - "Blackbox", "blackbox", - "Xfwm4", "xfwm4", - "Metacity", "metacity", - "Kwin", "kwin", - "FVWM", "fvwm", - "Enlightenment", "enlightenment", - "IceWM", "icewm", - "Window Maker", "wmaker", - "PekWM","pekwm" ); +@distros = (); +require '/home/flo/bin/logos.pl'; + +my $nocolor = "\e[0m"; +my @info = (); +my ($DE,$WM,$theme,$icon,$font,$cscheme) = ""; +my $distro = &distro; + +## Hash of WMs and the process they run # +my %WMlist = ("Beryl" => "beryl", + "Fluxbox" => "fluxbox", + "Openbox" => "openbox", + "Blackbox" => "blackbox", + "Xfwm4" => "xfwm4", + "Metacity" => "metacity", + "Kwin" => "kwin", + "FVWM" => "fvwm", + "Enlightenment" => "enlightenment", + "IceWM" => "icewm", + "Window Maker" => "wmaker", + "Compiz-Fusion" => "compiz", + "PekWM" => "pekwm", + "Awesome" => "awesome", + "Dwm" => "dwm" ); ## Hash of DEs and the process they run ## -my %DElist = ("Gnome", "gnome-session", - "Xfce4", "xfce-mcs-manage", - "KDE", "ksmserver"); +my %DElist = ("Gnome" => "gnome-session", + "Xfce4" => "xfce-mcs-manage", + "KDE" => "ksmserver"); ## Get Kernel version ## -if ( $display =~ "Kernel"){ - print "\::$textcolor Finding Kernel version\n" unless $quite == 1; - my $kernel = `uname -r`; - $kernel =~ s/\s+/ /g; - $kernel = " Kernel:$textcolor $kernel"; - push(@line, "$kernel"); +if( $display{KL} ) { + print "::$colors[0] Finding Kernel version$nocolor\n" + if $debug; + + my $kernel = `uname -r`; $kernel =~ s/\s+/ /g; + push @info, "$colors[0]Kernel\t\t\t$colors[1]$kernel$nocolor"; } ## Find running processes ## -print "\::$textcolor Getting processes \n" unless $quite == 1; +print "::$colors[0] Getting processes$nocolor\n" + if $debug; my $processes = `ps -A | awk {'print \$4'}`; -## Find DE ## -while( (my $DEname, my $DEprocess) = each(%DElist) ) { - print "\::$textcolor Testing $DEname process: $DEprocess \n" unless $quite == 1; - if ( $processes =~ m/$DEprocess/ ) { + +## Find a Desktop Environment ## +DESKTOP: +goto WINDOWM if !$display{DE}; +while(my($DEname,$DEprocess) = each(%DElist)) { + next if $processes !~ /$DEprocess/s; + $DE = $DEname; - print "\::$textcolor DE found as $DE\n" unless $quite == 1; - if( $display =~ m/DE/ ) { - push(@line, " DE:$textcolor $DE"); - } + print "::$colors[0] Desktop Environment found as $colors[1]$DEname$nocolor\n" + if $debug; + push @info, "$colors[0]Desktop Environment\t$colors[1]$DEname$nocolor"; last; - } } -## Find WM ## -while( (my $WMname, my $WMprocess) = each(%WMlist) ) { - print "\::$textcolor Testing $WMname process: $WMprocess \n" unless $quite == 1; - if ( $processes =~ m/$WMprocess/ ) { +## Find a Window Manager ## +WINDOWM: +goto ICON if !$display{WM}; +while(my($WMname,$WMprocess) = each(%WMlist)) { + next if $processes !~ /$WMprocess/sg; + $WM = $WMname; - print "\::$textcolor WM found as $WM\n" unless $quite == 1; - if( $display =~ m/WM/ ) { - push(@line, " WM:$textcolor $WM"); - } + print "::$colors[0] Window Manager found as $colors[1]$WMname$nocolor\n" + if $debug; + push @info, "$colors[0]Window Manager\t\t$colors[1]$WMname$nocolor"; last; - } } -## Find WM theme ## -if ( $display =~ m/Win_theme/ ){ - switch($WM) { - case "Openbox" { - print "\::$textcolor Finding $WM theme\n" unless $quite == 1; - open(FILE, "$ENV{HOME}/.config/openbox/rc.xml") - || die "\e[0;31m\n"; - while( ) { - if( /(.+)<\/name>/ ) { - while ( $found == 0 ) { - print "\::$textcolor $WM theme found as $1\n" unless $quite == 1; - push(@line, " WM Theme:$textcolor $1"); - $found = 1; - } - } - } - close(FILE); - } - case "Metacity" { - print "\::$textcolor Finding $WM theme\n" unless $quite == 1; - my $gconf = `gconftool-2 -g /apps/metacity/general/theme`; - print "\::$textcolor $WM theme found as $gconf\n" unless $quite == 1; - chomp ($gconf); - push(@line, " WM Theme:$textcolor $gconf"); - } - case "Fluxbox" { - print "\::$textcolor Finding $WM theme\n" unless $quite == 1; - open(FILE, "$ENV{HOME}/.fluxbox/init") - || die "\e[0;31m\n"; - while( ) { - if( /session.styleFile:.*\/(.+)/ ) { - print "\::$textcolor $WM theme found as $1\n" unless $quite == 1; - push(@line, " WM Theme:$textcolor $1"); - } - } - close(FILE); - } - case "Blackbox" { - print "\::$textcolor Finding $WM theme\n" unless $quite == 1; - open(FILE, "$ENV{HOME}/.blackboxrc") - || die "\e[0;31m\n"; - while( ) { - if( /session.styleFile:.*\/(.+)/ ) { - print "\::$textcolor $WM theme found as $1\n" unless $quite == 1; - push(@line, " WM Theme:$textcolor $1"); - } - } - close(FILE); - } - case "Xfwm4" { - print "\::$textcolor Finding $WM theme\n" unless $quite == 1; - open(FILE, "$ENV{HOME}/.config/xfce4/mcs_settings/xfwm4.xml") - || die "\e[0;31m\n"; - while( ) { - if( /