Monthly Archive for December, 2007

Fix Hosts File (v1.0)

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 4.00 out of 5)
Loading ... Loading ...

Summary: This batch file will make it a bit easier to fix your ‘hosts’ file.

Requirements:

  • Windows 2000 / XP / Vista

Code:

@echo off
cls
echo Fix the Host File
echo By Blake Johnson
echo http://www.blakeanthonyjohnson.com
echo.
echo.
echo Are you blocked from a specific web site?  Find the domain name and
echo if it is in the list, remove it.  Problem should then be solved.
echo. 
pause
echo.
echo Remove Read-only and System attributes from the Hosts file...
attrib -s -r %windir%\system32\drivers\etc\hosts
echo Done.
echo.
echo Open the Hosts file for editing...
notepad %windir%\system32\drivers\etc\hosts
echo Done.
echo.
echo Apply the Read-only and System attributes to the Hosts file...
attrib +s +r %windir%\system32\drivers\etc\hosts
echo Done.
echo.
echo.
echo Assuming you made the changes you intended to make, you should
echo be good to go.
echo.
pause

Backup2Novell (v2.0)

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Summary: Backup2Novell automates the process of archiving a folder or file, and then adding it to a specific folder on a Novell server. It uses 7zip for Unix for it’s archives.

Requirements:

  • ncpfs
  • p7zip

Code:

#!/bin/bash
 
##By Blake Johnson
 
USERNAME="USERNAME" ##Novell Username (this is case sensative to whatever the mounted directory will use.)
CONTEXT="something.something" ##Novell Context w/ out beginning dot.
PASSWORD="PASSWORD" ##Novell Password
 
BACKUPNAME="public_html" ##This must not contain any special characters.
BACKUPSOURCE="${HOME}/public_html/" ##What file or folder would you like to back up?
 
SERVERNAME="SERVERNAME" ##The name of the remote Novell server.
SERVERADDRESS="SERVERIP" ##The address of the remote Novell server.
 
MOUNTDIRECTORY="${HOME}/mnt/MOUNTPOINT" ##The directory where you want to mount the Novell share.
 
BACKUPHOME="${MOUNTDIRECTORY}/STAFF/USERS/Folders/${USERNAME}" ##Directory where you are first able to write.
BACKUPFILENAME="${BACKUPNAME}.`date +\%Y\%m\%d`.7z" ##This must not contain any special characters.
BACKUPDESTINATION="${MOUNTDIRECTORY}/Folders/${USERNAME}/.backup/${BACKUPNAME}" ##Where should the backup file be placed?
 
##Write Date & Time to Log File
echo "-------------------------------------" > ~/.Backup2Novell.log
echo "`date +\%B\ \%d,\ \%Y`" >> ~/.Backup2Novell.log
echo "-------------------------------------" >> ~/.Backup2Novell.log
 
echo -n "Checking if the ncpfs package is installed... "
if [ -x /usr/bin/ncpmount ] ; then
	echo -e "\033[1;32mOK!"
	echo -e "\033[0m"
 
	##Log in to Novell Share and mount it.
	echo -n "Mounting Novell Share... "
	echo "ncpmount -S ${SERVERNAME} -A ${SERVERADDRESS} -U ${USERNAME}.${CONTEXT} -P ${PASSWORD} ${MOUNTDIRECTORY}" >> ${HOME}/.Backup2Novell.log
	ncpmount -S ${SERVERNAME} -A ${SERVERADDRESS} -U ${USERNAME}.${CONTEXT} -P ${PASSWORD} ${MOUNTDIRECTORY} >> ${HOME}/.Backup2Novell.log
 
	##Check to see if userfolder exists.
	if [ -d ${BACKUPHOME} ] ; then
 
		echo -e "\033[1;32mOK!"
		echo -e "\033[0m"
		echo "Backing up ${BACKUPSOURCE}"
		echo "Please Wait..."
 
		##Compress and archive backup source and send it to the Novell Folder.
		echo "7z a "${BACKUPDESTINATION}/${BACKUPFILENAME}" "${BACKUPSOURCE}" >> ${HOME}/.Backup2Novell.log" >>  ${HOME}/.Backup2Novell.log
		7z a "${BACKUPDESTINATION}/${BACKUPFILENAME}" "${BACKUPSOURCE}" >> ${HOME}/.Backup2Novell.log
 
		##Check to see if the file was written.
		if [ -e "${BACKUPDESTINATION}/${BACKUPFILENAME}" ] ; then
			echo -e "~/public_html Backup \033[1;32mSuccessful"
			echo -e "\033[0m"
		else
			echo -e "~/public_html Backup \033[1;31mFailed"
			echo -e "\033[0mUnable to write to destination"
		fi
 
		##Unmount and log out of the Novell share.
		echo -n "Unmounting Novell Share... "
		echo "ncpumount ${MOUNTDIRECTORY}" >> ${HOME}/.Backup2Novell.log
		ncpumount ${MOUNTDIRECTORY} >> ${HOME}/.Backup2Novell.log
 
		if [ -d ${BACKUPHOME} ] ; then
			echo -e "\033[1;31mFailed!"
			echo -e "\033[0m"
		else
			echo -e "\033[1;32mOK!"
			echo -e "\033[0m"
		fi
 
	else
		echo -e "\033[1;31mFailed!"
		echo -e "\033[0m"
	fi
 
else
	echo -e "\033[1;31mFailed."
	echo -e "\033[0mYou must install the ncpfs package in order for this script to work."
	echo
fi
 
echo "This script will self-destruct in 5 seconds."
sleep 5s

WavPack Frontend (v0.8)

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Summary: Tired of using the command line switches to convert a song to the Wavpack format? This will make your life a bit easier.

Requirements:

Code:

@echo off
 
::
::Set wavpackexe to the path of the WavPack exe on your system.
::
 
set wavpackexe="C:\Program Files\WavPack\wavpack.exe"
 
::
::Other Variables
::
 
set target= 
 
 
echo -------------------------
echo   WavPack Frontend v0.8
echo -------------------------
echo     By Blake Johnson
 
if exist %2 goto alert2files
if exist %1 goto pass2
goto pass1
 
 
:pass1
echo.
echo.
echo First of all, where is your file located?
echo (Feel free to drag and drop it in this box.)
echo.
Set /p source=Location of file:
cls
goto menu
 
 
:alert2files
echo.
echo.
echo You have selected more than one file, only one file will be used.
echo File being used: %1
goto pass2
 
 
:pass2
echo.
echo.
set source=%1
goto menu
 
 
:menu
echo.
echo.
echo Here are some more options.
echo.
echo 1. Choose other destination.
echo 2. Tag the file.
echo 3. Convert to WavPack.
echo.
echo 4. Exit.
 
set /p option=What option do you want? 
 
cls
 
if "%option%"=="1" goto cngtarget
if "%option%"=="2" goto tag
if "%option%"=="3" goto convert2wv
if "%option%"=="4" goto exit
 
cls
echo %option%
echo.
echo. You did not choose a valid option.
echo. Please try again.
goto menu
 
 
:cngtarget
echo.
echo.
echo Choose a new destination. (Physical path to file only.)
echo USE QUOTES!!!
echo.
echo To cancel, just press enter.
echo.
echo.
set /p target=Destination:
cls
goto menu
 
 
:tag
echo.
echo.
echo Enter the following information for tagging.
echo If you leave one blank, it will not exist as a tag.
echo.
set /p artist=Artist:
set /p title=Title:
set /p album=Album:
set /p year=Year:
set /p track=Track #:
set /p genre=Genre:
echo.
echo.
echo If the following is not correct, exit the batch file and try again.
echo.
if not "%artist%"=="" echo Artist: %artist%
if not "%title%"=="" echo Title: %title%
if not "%album%"=="" echo Album: %album%
if not "%year%"=="" echo Year: %year%
if not "%track%"=="" echo Track: %track%
if not "%genre%"=="" echo Genre: %genre%
echo.
echo.
pause
cls
goto menu
 
:convert2wv
echo.
echo.
%wavpackexe% -w "Artist=%artist%" -w "Title=%title%" -w "Album=%album%" -w "Year=%year%" -w "Track=%track%" -w "Genre=%genre%" -h %source% %target%
 
 
:exit
exit

The Process Killer (v0.7)

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Summary: Have a process that won’t die? Maybe this will help remedy the situation. It does not always works, but it’s worth a shot if the Windows Task Manager fails to deliver.

Requirements:

  • Windows XP Professional

Code:

@echo off
echo ---------------------------
echo  The Process Killer v0.7
echo ---------------------------
echo      By Blake Johnson
echo.
echo.
 
:home
echo Type 'v' to view open processes and their PIDs, or type a PID to continue.
echo.
set /p command=Command or PID:
if "%command%"=="v" goto viewpids
if not "%command%"=="v" goto kill
 
:viewpids
tasklist | more
echo - - - - - -
echo.
goto home
 
:kill
ntsd -p %command% -c "q"
pause




User Agent: CCBot/1.0 (+http://www.commoncrawl.org/bot.html)
Character Encoding: UTF-8
Generated: 09/07/2010 22:53:00 UTC
Rendering Time: 1.232 seconds.