Command Line Rename Files And Append To Front Of Name

Command Line Append:

for /f “tokens=*” %a in (‘dir *.tif /b’) do ren “%a” “LE2_%a”

Command Line Remove:

for %a in (LE2_*.tif) do ren “%a” ”    *.tif”     (note: There are 4 spaces in front of *.tif)
for %a in (    *.tif) do ren “%a” %a     (note: There are 4 spaces in front of *.tif)

In a batch file (replace % with %%):

for /f “tokens=*” %%a in (‘dir*.tif /b’) do ren “%%a” “LE2_%%a”


We Got Hacked By… Bingbot?

Actual line from server log file (host ip and domain name altered):

Line 6618: 2017-01-30 21:12:44 W3SVC923663 WEB728 GET /companies.asp remove=1723 443 – HTTP/1.1 Mozilla/5.0+(compatible;+bingbot/2.0;++ – – 200 0 0 24266 352 2515

Web application written using classic asp on IIS7 with SQL Server and hosted remotely.

  • No robots.txt.
  • Forced login only on the index.asp page.
  • All other pages don’t check for authorization.
  • All pages include navigation.asp.
  • Search.asp has <a href=’search.asp?selection=’all”>search all</a>.
  • Companies.asp has <a href=’companies.asp?remove=123′>delete</a>

True story. Today.

Reset 10.5 Leopard & 10.6 Snow Leopard password

Reset 10.5 Leopard & 10.6 Snow Leopard password

  1. Power on or restart your Mac.
  2. At the chime (or grey screen if your chime is turned off), hold down Command+S on your keyboard to enter single-user mode.
  3. This step is optional, but it’s a good idea because it checks the consistency of the hard disk before moving on. At the prompt, type fsck -fy and press Enter/Return. Wait for the checks to complete before going to the next step.
  4. Type mount -uw / and press Enter.
  5. Type launchctl load /System/Library/LaunchDaemons/ and press Enter.
  6. Type ls /Users and press Enter. This lists all of the usernames on the computer – helpful if you don’t know or remember what these are.
  7. Type dscl . -passwd /Users/username password and replace “username” with one of the users displayed in the previous step. Replace “password” with a new password of your choice. Press Enter.
  8. Type reboot and press Enter. 


SQL Select Beginning and End of Months

CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(getdate())-1),getdate()),101) as [Beginning of this month]
,CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(DATEADD(mm,1,getdate()))),DATEADD(mm,1,getdate())),101) as [End of this month]

, CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(DATEADD(mm,1,getdate()))-1),DATEADD(mm,1,getdate())),101) as [Beginning of next month]
,CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(DATEADD(mm,1,getdate()))),DATEADD(mm,2,getdate())),101) as [End of next month]

, CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(DATEADD(mm,1,getdate()))-1),DATEADD(mm,2,getdate())),101) as [Beginning of two months from now]
,CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(DATEADD(mm,1,getdate()))),DATEADD(mm,3,getdate())),101) as [End of two months from now]

, CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(DATEADD(mm,1,getdate()))-1),DATEADD(mm,3,getdate())),101) as [Beginning of three months from now]
,CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(DATEADD(mm,1,getdate()))),DATEADD(mm,4,getdate())),101) as [End of three months from now]