use Digest::MD5;
use IO::File;
my $chk = Digest::MD5->new();
foreach my $file (@ARGV)
{
$chk->addfile(IO::File->new($file));
print "$file -> ",$chk->hexdigest,"\n";
}
The additional details could be found on IBM site
use Digest::MD5;
use IO::File;
my $chk = Digest::MD5->new();
foreach my $file (@ARGV)
{
$chk->addfile(IO::File->new($file));
print "$file -> ",$chk->hexdigest,"\n";
}
The additional details could be found on IBM site
print -n "Enter Your password:"
stty_orig=`stty -g`
trap "stty ${stty_orig}; exit" 1 2 3 15
stty -echo >&- 2>&-
read PASS
stty ${stty_orig} >&- 2>&-
trap 1 2 3 15
print
trap :catches interruptions. I.e. if the user presses Ctrl+C, the normal stty mode is set before stopping the program
stty -echo :switches off the display echo
>&- 2>&- :helps to avoid “stty: Not a typewriter” message for non-interactive scripts.
How to get the text from the clipboard
set objIE = CreateObject("InternetExplorer.Application")
objIE.Navigate("about:blank")
textFromClipboard = objIE.document.parentwindow.clipboardData.GetData("text")
objIE.Quit
WScript.Echo textFromClipboard
How to put the text into clipboard
textIntoClipboard = "Some text" & VbCrLf & "Some more text"
Set objIE = WScript.CreateObject("InternetExplorer.Application")
objIE.Navigate "about:blank"
Do Until objIE.ReadyState = 4
WScript.Sleep 100
Loop
objIE.document.ParentWindow.ClipboardData.SetData "text", textIntoClipboard
objIE.Quit
The detailed explanation could be found here.
It’s not possible to get the value of the loop variables in some versions of ksh.
Example:
#!/bin/ksh
num=0
cat $0 | while read line ; do
let num=num+1
done
echo "Number=$num"
This script will return “Number=0” as the result on some Linux machines.
Here is the workaround for the problem: You should change the redirection method for the input file.
#!/bin/ksh
l=0
while read line ; do
let l=l+1
done < $0
echo "Number=$l"
The last script will return the correct result: "Number=9"
Another possibility is to use the named pipe:
#!/bin/ksh
TMPPIPE=/tmp/thepipe.$$
mkfifo $TMPPIPE
cat $0 > $TMPPIPE &
num=0
while read line ; do
let num=num+1
done < $TMPPIPE
echo "Number=$num"
Here is small bookmarklet, which allows to edit the web page for any site (ok, You could save the results on Your local machine only).
javascript:document.body.contentEditable='true'; document.designMode='on'; void 0
There is a special algorithm for comparision strings, which sound similar (Soundex).
Here is JavaScript Soundex implementation:
function soundex ( s_src )
{
var s_rez = "0000" ;
var new_code, prev, idx
a_codes = { "bfpv": 1, "cgjkqsxz":2, "dt": 3, "l": 4, "mn": 5, "r": 6 };
s_src = s_src.toLowerCase().replace(/ /g,"")
if ( s_src.length < 1) {
return(s_rez);
}
s_rez = s_src.substr(0,1);
prev = "0";
for ( idx = 1 ; idx < s_src.length ; idx++) {
new_code = "0";
cur_char = s_src.substr(idx,1)
for (s_code in a_codes)
if (s_code.indexOf(cur_char) >= 0)
{ new_code = a_codes[ s_code ] ; break ; }
if (new_code != prev && new_code != "0" ) {
s_rez += new_code;
}
prev = new_code;
}
s_rez = s_rez + "0000"
return s_rez.substr(0,4);
}
Dim objAPP, sMsg
On Error Resume Next
Set objAPP = GetObject(, "PowerPoint.Application")
If TypeName(objAPP) = "Empty" Then
sMsg = "not started"
Else
sMsg = "started"
End If
MsgBox "PowerPoint is " & sMsg, vbInformation, "PowerPoint"
if sMsg = "started" then objAPP.Visible = true
strComputer = "."
Set objWMIService=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
For Each objclass in objWMIService.SubclassesOf()
intCounter=0
If Left(objClass.Path_.Class,5) = "Win32" Then
For Each Qualifier in objClass.Qualifiers_
If UCase(Trim(Qualifier.Name)) = "ASSOCIATION" Then
intCounter = 1
End If
Next
If x = 0 Then
strComputer = "."
Set objWMIService = GetObject _
("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set strClass = objWMIService.Get(objClass.Path_.Class)
Wscript.Echo "PROPERTIES:"
For each strItem in strClass.properties_
Wscript.Echo objClass.Path_.Class & vbTab & strItem.name
Next
Wscript.Echo "METHODS:"
For Each strItem in strClass.methods_
Wscript.Echo objClass.Path_.Class & vbTab & strItem.name
Next
End If
End If
Next
Other scripts could be found here
Option Explicit
On Error Resume Next
Dim strComputer, objWMIService
Dim colItems, objItem
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
For Each objItem in colItems
WScript.Echo "Machine Name: " & objItem.CSName & VbCr & _
"===================================" & vbCr & _
"Description: " & objItem.Description & VbCr & _
"Manufacturer: " & objItem.Manufacturer & VbCr & _
"Operating System: " & objItem.Caption & VbCr & _
"Version: " & objItem.Version & VbCr & _
"Service Pack: " & objItem.CSDVersion & VbCr & _
"CodeSet: " & objItem.CodeSet & VbCr & _
"CountryCode: " & objItem.CountryCode & VbCr & _
"OS Language: " & objItem.OSLanguage & VbCr & _
"CurrentTimeZone: " & objItem.CurrentTimeZone & VbCr & _
"Locale: " & objItem.Locale & VbCr & _
"SerialNumber: " & objItem.SerialNumber & VbCr & _
"SystemDrive: " & objItem.SystemDrive & VbCr & _
"WindowsDirectory: " & objItem.WindowsDirectory & VbCr & _
""
Next
Option Explicit
On Error Resume Next
Dim strComputer, objNetwork, objWMIService
Dim colItems, objItem
Set objNetwork = WScript.CreateObject("WScript.Network")
strComputer = objNetwork.ComputerName
WScript.Echo "Computer = " & strComputer
Set objWMIService=GetObject("winmgmts:{impersonationLevel=impersonate}!\\"&strComputer&"\root\cimv2")
Set colItems = objWMIService.ExecQuery ("Select * from Win32_ComputerSystem")
For Each objItem in colItems
Wscript.Echo "Domain = " & objItem.domain
Next
There is also WMI FAQ on Microsoft site.