scripting

Pinging all subnets of a wireless network

I'm trying to satiate my curiosity by doing a small network reachability test. I want to try to ping all subnets of a wireless network at my school from the subnet that I am connected to. So, suppose the network has 4 subnets (a,b,c,d) and I am connected to 'a', I want to try to ping at least 1 computer in subnets 'b','c', and 'd'. Once ...

Hide a div when another is empty

Hi, its my fisrt question, cause i dont find a answer in the search... Its possible to hide a div, when another is empty? Here is the case: <div id='TwitterTrackbacksWrapper'> <h4><img align='bottom' alt='Twitter Trackbacks' src='http://Imagens/twitter-bird.png'/&gt; twitter trackbacks</h4> <div class='twitter-trackbacks' id='twitter-t...

Bash Scripting " [!: not found " errors, and how to write an or statement [Solved]

[Solved] See post by Dave Kirby. EDIT: Here is my updated code: #!/bin/sh files=`ls` if [ $# -ne 1 -o -f $1 ] then echo "Usage: $0 <directory>" exit 1 fi if [ ! -e $1 ] then echo "$1 not found" exit 1 elif [ -d $1 ] then cd $1 for f in $files do if [ ! -d "$f" ] then if [ ! -...

How to send status to the VIM status line after calling custom VIM (Python) function

I've just created my first VIM script, I wrote it in Python. It's a simple script to switch color schemes from a directory (/vim/etc/colors). I would like to know how to send a notification after the color scheme changed with the name of the selected color scheme to the vim 'statusline'. rson gave an answer to my question, here is an up...

identify error in if statement

Here is the complete code.. What I'm trying to do is this - > I'm trying to find the average of the values in the second column of the files . If the file has 2.54 in its name, I want to find averages from files called file_2.54_even.xls and file_2.54_odd.xls . If the fiename does not have 2.54 in its name, then simply find the avera...

Error with redirection

I'm trying to find average of values in 2nd column in some files. Filenames have following pattern eg: tau_2.54_even_v1.xls tau_2.54_odd_v1.xls tau_1.60_v1.xls tau_800_v1.xls The other filenames can be obtained by replacing variable file with oter variables pmb , xhpl etc .. Here is the script I've written .. Can anyone kindly find ...

printing variable inside awk

In this script , I want awk to print the variables $file, $f, $order and sum/NR (all in a single row) #!/bin/bash for file in pmb_mpi tau xhpl mpi_tile_io fftw ; do for f in 2.54 1.60 800 ;do if [ ${f} = 2.54 ] then for order in even odd ; do # echo ${file}_${f}_${order}_v1.xls >> P-state-summary.xls awk '{s...

Finding out how when google last crawled

I'd like to find out how current google's cached copy of a large set of pages is. I think I need to look in the logs for IP's, check to find user-agent "googlebot", then export a list that says each page and when it was last visited. I imagine this could be a cron job that runs weekly. If this is right, how would I write the s...

accessing data from the model using script/console (Ruby on Rails)

I'm looking to write a Ruby script which I can load into the Rails Console which will access data from the models I have created. I created a model called student using the following command and populated it with data: script/generate scaffold student given_name:string middle_name:string family_name:string date_of_birth:date grade_point...

How to print variable inside awk

I want the awk to interpret the variable as follows #!/bin/bash file=tau f=2.54 order=even awk '{sum+=$2}; END {print '${file}_${f}_${order}_v1.xls', sum/NR}' ${file}_${f}_${order}_v1.xls >> safe/P-state-summary.xls I want the desired output as follows - tau_2.54_even_v1.xls sum/NR Can anybody help me out with this ? ...

Automatic Documentation - Best method for creating a quick parser

I have a large script that end-users need to edit so it requires somewhat redundant commenting. I use a layout for my files similar to this //******************** // // FileName // This script contains: // - Function X - does something // - Function Y - does something else // //******************** //******************** // Fu...

run command/script when lock/unlock windows station?

Hi, I have Windows 7 pro at work. my problem is i keep on forgetting to clock in/clock out (using the intranet timesheet system). is there a way to run a script or command to automatically open the timesheet page each time i lock/unlock my station? tyvm. ...

C# Scripting language

This is a somewhat odd question. I want to provide a scripting language for modding games that I build for XNA. If I was deplying these games for the PC then I would just be able to use C# files, compiled at runtime (Using reflection.emit) as scripts and that would be fine - a nice simple way to mod the game. However, the .net compact f...

How to refresh page on resize?

Is there a script to make the browser refresh when a page is re-sized? More specifically, one that emulates the browser refresh button or F5? I've found two, but they don't quite do what I'm looking for; <script type="text/javascript"> var currheight = document.documentElement.clientHeight; window.onresize = function(){ if(currheigh...

Python, PowerShell, or Other?

What are the advantages of Python, PowerShell, and other scripting environments? We would like to standardize our scripting and are currently using bat and cmd files as the standard. I think Python would be a better option than these, but am also researching PowerShell and other scripting tools. The scripts would be used to trigger pr...

many people remove the copyright from my script , what i can do ?

many people remove the copyright from my script , what i can do ? best wishes it is a php script and open source :D ...

Groovyscript grails system commands

Hi, Is there a possibility of running my "grails run-app" command from my groovy script? I tried "cmd /c dir".execute() and it was working but "cmd /c grails run-app" doesn't seem to work :( Can anybody help me? I dont know how to see the output too :( ...

PowerShell: Links to interesting sites or blog posts

In this question Alan posted links to interesting pages about PowerShell. I found also some interesting pages: http://channel9.msdn.com/wiki/windowspowershellquickstart/ (cheatsheet) http://technet.microsoft.com/en-us/library/bb978525.aspx (core reference) http://devcentral.f5.com/weblogs/Joe/archive/2009/01/05/powershell-abcs---k-is-f...

How to write bash script to search for IP's in a file and put write them to another file?

I need to write a bash script that will take a grepable nmap output file that displays IP addresses with port 80 open and copy the IPs that have port 80 open to another text file. The output looks similar to this: # Nmap 4.76 scan initiated Thu Dec 3 13:36:29 2009 as: nmap -iL ip.txt -p 80 -r -R -PN --open -oA output Host: 192.168.1....

Windows Shell: Pipe to a script...

Dear Experts, I'm writing a script that should process a contents of a file, but should be file-independent. The second step would be using the script few times in pipe as follows: type input.txt|script.bat ...|script.bat ...|script.bat ... > output.txt Is it possible to use either of the following syntax: type input.txt|script.bat ...