Saturday, August 13, 2011

Relinking URLs

Relink.exe (wu, fs)
Relink [options] html_file [local paths to scan]

Converts hrefs to local urls
Html file backed up with .orig extension

Options:
-c list conversions
-u list unconverted urls
-n no conversion (-u -n lists all hrefs)
-d leave URIs decoded in the html source (converts %##)
This 3kb command line tool converts/fixes the url links in an html or hhc file to local links if the file exists locally. It treats anything that comes after href=, src= or value= as urls. It scans the xxx_files\ folder and the source folder of the html file. Additional paths to scan can be specified. e.g. relink abc\index.html img src will relink urls in index.html to use existing local files in the following folders: img\, src\, abc\index_html\, and abc\

It can only convert one file at a time but this is easily remedied using the recursive for command e.g. for /r %f in (*.html) do relink "%f". It is free, portable, uses very little memory (~110kb) while running, and does not modify any registry entries. Virustotal report 0/43. Download links: wu, fs

Friday, August 12, 2011

File repository

This is my temporary file repository. Currently it uses Wupload, Filesonic, and Megaupload.

HTML Tools
Relink.exe (wu, fs): Tool to convert urls in html files to link to existing local files

Saturday, August 6, 2011

Batch recursion

Here are 3 short scripts to demonstrate directory recursion
Script 1
@echo off
::demonstrates relative directory recursion
::does not detect hidden files

:main
for %%v in (*.*) do echo %%v
for /d %%v in (*.*) do call :sub "%%v"
goto :eof

:sub
for %%f in ("%~1\*.*") do echo %%f
for /d %%d in ("%~1\*.*") do call :sub "%%d"
goto :eof
Script 2
@echo off
::demonstrates directory recursion
::does detect hidden files but outputs fullpath
for /r %%v in (*.*) do echo %%v
Script 3
@echo off
::demonstrates directory recursion
::detects hidden files & outputs relative path

setlocal enabledelayedexpansion
for /r %%v in (*.*) do set n=%%v&echo !n:%CD%\=!

Sunday, July 3, 2011

Right click lock for Dungeon Siege III

This is an autohotkey script for people who don't like to hold the right mouse button down all the time to move the character. It basically enables right clicklock. The current duration to hold the right mouse key down to activate click lock is 350ms but can obviously be modified to something that is not 350. I've noted that sometimes the game can crash and the right click can remain locked (left click should clear it but may not always work), so use this script at your own caution and make sure you don't have any vital program running before you run this script.
; Right click lock (Rt mouse button will be kept held down with a long click -- short clicks allowed for short movements)

#IfWinActive, Dungeon Siege III
#MaxThreadsPerHotkey 3

; Force the keyboard hook to be used, which as a side-effect prevents the Send command from triggering hotkeys.
#UseHook

~Lbutton::HoldRMB = 0

~Rbutton::
TC := A_TickCount
KeyWait, RButton ;wait for right mouse button to be released
If HoldRMB || (A_TickCount-TC) < 350
{
HoldRMB = 0
Return
}
HoldRMB = 1
Loop {
Send {RButton down}
Sleep 40
if !HoldRMB
break
}
Send {RButton up}
HoldRMB = 0
return
To have this script execute automatically, you can create a batch file in the game directory
start c:\progra~1\AutoHotkey\AutoHotkey.exe /r "ds3.ahk"
start "Dungeon Siege III" "Dungeon Siege III.exe"
exit
and point the Dungeon Siege III play shortcut to it (instead of the executable)

Saturday, June 18, 2011

Getting password in batch file

This batch script gets the password without displaying user input. Tested only in XP. Vbs script is required.
@echo off
echo wscript.echo CreateObject("ScriptPW.Password").GetPassword()>%temp%\getpwd.vbs
set pwd=Password: <nul
for /f "delims=" %%i in ('cscript /nologo %temp%\GetPwd.vbs') do set pwd=%%i
echo.
echo "%pwd%"
The last line shows the user password for testing purposes. Note that password must be enclosed in double quotes to prevent bad inputs that contains &.

Saturday, February 26, 2011

Pathology Quiz Websites

Pathorama: Lung cytology, urinary cytology, serrated polyps, EIN
John Hopkins: Surgical Pathology, GIT Pathology, Cytology
Bethesda

Tuesday, January 25, 2011

Adding favicon to Firefox bookmarklets on the bookmarks bar

This bookmarklet loads a PubMed search into UCT's e-journal search engine. It also has a favicon using the technique from Restafarian.org » Adding an Icon to Your Bookmarklet. To create the bookmarklet, first create a bookmark on the Firefox bookmark toolbar. Right click the bookmark, select Properties, and change URL to:
javascript:if(window.location.href.indexOf('file:///C:/')==0){'%3Chtml%3E%3Clink%20rel="icon"%20href="http://www.ncbi.nlm.nih.gov/favicon.ico"%3E';}else{metaTags=document.getElementsByName('ncbi_uidlist');i=metaTags.length;if(i>0){location='http://uctsfx.hosted.exlibrisgroup.com.ezproxy.uct.ac.za/uct?rft_id=info:pmid/'+metaTags[0].content}else{location.href='http://www.ncbi.nlm.nih.gov/pubmed'}}

Afterwards go to C drive and click on bookmarklet to load the icon. Thereafter you can go to any site (other than C drive) and the bookmarklet will execute the javascript. You can change the icon location to e.g. file:///C:/pub/firefox/favicons/pubmed.ico. The javascript for the actual bookmarklet function can also be changed and is located inside the else {} statement.