Saturday, October 24, 2015

Recusivly finding files by extension in DOS

Need to find all files of a specific extension in DOS.  Here is a command that will recursively look through a directory structure and list only those files with that exact extension:
dir /s/b *.mp3 | findstr /v .mp3.

Tuesday, September 15, 2015

RDP and autologin - disconnect every 2 minutes

I discovered something that annoying about RDP... I was getting dropped from RDP every 2 minutes.  After looking around, I discovered some information that it was related to the fact that autologon was configured on the remote machine.

In essence, as I understand it, after 2 minutes Windows would attempt to ensure that the default user was logged in.  For some reason this forces the RDP to get logged out (check the event viewer).

SOLUTION: disable autologon.

ANOTHER SOLUTION:  This seemed to work.  Delete the key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon\ForceAutoLogon

Tuesday, April 21, 2015

Moving uTorrent seeds (bencode)

DRAFT (incomplete)

Introduction:

One of the major pains of trying to seed a bittorrent client (in this case, I will be sticking to a uTorrent client) is moving a seed.  There are a number of use-cases where this problem comes up:


  • You need to move the machine where a torrent is being seeded
  • You want to change which hard drive or folder location of a seed
  • You would like to create additional seeds
Creating the new seeds is actual fairly easy... but it is time consuming.  You can either just copy the files being seeded and recreate the torrent (although that is a problem if you want to stick with a single torrent), or you can copy the files and the torrent itself and let the torrent client validate the torrent file.

The Problem:

The problem with either approach is that it takes a fair amount of time (especially if the size of the torrent or number of torrent is large).

So, this approach allows you to 'resume' a torrent on a different machine or different file path.  By using this approach, a lot of time can be saved.  For example, the specific needs I had included the following:


  • I had a number of large virtual machines that I needed to distribute to many machines in a short period of time
  • I wanted to compute / create the torrent files early in the process 
  • I wanted to be able to duplicate the seeding machine across a number of machines
When I created the initial set of torrent files, it took many hours.  With that time invested, I did not want to repeat that time consuming process for each torrent seed that I deployed.

The 'time' that is required is sort of like computing (or validating) an md5 checksum.  These are rather computationally intense and are slow especially if there are multiple running at the same time on a single machine.

The Solution:

When a uTorrent client starts, it looks at a local configuration file to see what it needs to resume.  When it resumes a torrent, it trusts that the seeds it previously had running (perhaps before a system reboot) was valid and requires not further validation... so the process is rather fast.

The 'trick' is to leverage this resume process to allow the loading of these seeds without going the full blown (time consuming) validation process.

The Details:

Monday, February 16, 2015

rsync - pulling to Window / cygwin from FreeNAS

Using rsync to pull files from a freeNAS box to a local Windows box.

  rsync.exe -avSP --delete root@9.55.51.124:/mnt/zBackup/tordev/* .

Here is what each of these do:

-a, --archive               Archive mode

-v, --verbose               Increase verbosity

-S, --sparse                Handle sparse files efficiently

-P                          equivalent to --partial --progress
     --partial               Keep partially transferred files
     --progress              Show progress during transfer

--delete        Delete files that don't exist on the sending side

Tuesday, February 3, 2015

Cousins and uncles... removed and such

Confused by what twice removed means when someone says "he was my 3rd cousin twice removed"?  The picture does a better job than most explaining the relationships through a single graphic
.

Friday, January 9, 2015

Clear All Windows 2008 R2 event logs

If you want to clear the event logs in a Windows Server system, you can fire up Event Viewer, browse to the desired log and from the Actions menu select Clear Log.... But if you want to clear all the System and Application logs at once, you'd better use the `wevtutil' command line utility Microsoft offers. A Windows PowerShell command like this will do the job: 


wevtutil el | foreach { wevtutil cl $_ }

(from http://skalkoto.blogspot.com/2011/08/clear-all-windows-2008-r2-event-logs.html)