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)


Tuesday, December 23, 2014

Resize VirtualBox vmdk disk

(From http://stackoverflow.com/questions/11659005/how-to-resize-a-virtualbox-vmdk-file)

VBoxManage clonehd "source.vmdk" "cloned.vdi" --format vdi
VBoxManage modifyhd "cloned.vdi" --resize 51200
VBoxManage clonehd "cloned.vdi" "resized.vmdk" --format vmdk

Migrate VMWare box to VirtualBox

(from http://ctors.net/2014/07/17/vmware_to_virtualbox)
The instructions below will guide you through the converting process.

VMWare

  • Boot the VM
  • Uninstall vmware tools
  • Shutdown
  • Edit VM settings -> remove the HD
  • Edit the_machine.vmdk
  • change ddb.adapterType from "buslogic" or "lsilogic" to "ide"
  • Edit VM settings -> add an HD, type IDE from existing file the_machine.vmdk
  • Boot the VM
  • Shutdown
Now you can convert the box from VMWare to Open Virtualization Format.
$ ovftool -o the_machine.vmx the_machine.ovf Opening VMX source: the_machine.vmx Opening OVF target: the_machine.ovf Writing OVF package: the_machine.ovf Transfer Completed Completed successfully

VirtualBox

The last step is to import the OFV in VirtualBox and install guest additions.
  • File -> import appliance -> the_machine.ovf
  • VM settings -> storage -> add attachment -> CD drive
  • Boot the VM
  • install guest additions from CD

Monday, September 22, 2014

Windows Explorer history - how to modify the Previous Locations pulldown

I've gotten frustrated that I can not control the list of entries in the "Previous Locations" pulldown in Windows Explorer.  Finally figured out how...

Using regedit, edit the following location:

HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Explorer\TypedPaths

Modify the value of the entries in that folder accordingly.

Wednesday, September 3, 2014

myCloud - configure ssh access for non-root users

From a post in a forum:

- Enable ssh:
http://<mybooklive>/UI/ssh


- Create shares, users, set passwords and permissions via dashboard

- Allow Users to SSH:
edit file /etc/ssh/sshd_config
Change "AllowUsers" line by adding user names such as:
AllowUsers root user1 user2


- Optional: Set users home dir: edit file /etc/passwd
The following will set home dir to "Public"
Change from "/shares:/bin/sh" to "/shares/Public:/bin/sh"


- Restart ssh deamon or reboot:
/etc/init.d/ssh restart


Test ssh for your users within the home network. If all works, then proceed to:
- Set your router to forward port TCP 22
- Set DDNS on your router

Friday, May 30, 2014

BGinfo display only active IP address

One of the pains of using BGinfo is that it lists too many non functional IP addresses.  To solve this (partly), this post talks about using a custom entry:

http://www.renjithmenon.com/how-to-set-bginfo-to-display-only-the-active-network-cards-ip-address/

This, for me, is only a partial solution as I want to show only the active network card information for things like the DNS, Subnet etc.  To do this, I created custom fields in BGinfo and (sort of replaced) the existing fields.

Here are the details:

I clicked Custom > New > WMI Query > Browse.  For the Identified (name) I use the same name as exists, but I do 2 things differently so that I don't overwrite the existing BGinfo entry.  First, I use 2 spaces in the name.  This means the identifier looks the same, but doesn't replace it. So now, in the list of fields, it appears as though there are 2 IP Address entries.  The seocnd thing I do so that I can tell the different in I use a lower case letter for the second word.  Therefore, I have an "IP Address" entry and a "IP  address".  The now look very similar, but I can tell the difference.

At this point, you can build the necessary query string using the interface to (first) select the right WMI Class (Win32_NetworkAdapterConfiguration) and (second) select the Class Property (for example IPAddress).  At this point, click Evaluate to see the list (since there are multiple IP addresses).

Next, limit the list using the WHERE clause.  For example, in my case the only IP addresses I want happen to be both active as well as have DHCP enabled.  So I use:


SELECT IPAddress FROM Win32_NetworkAdapterConfiguration Where IPEnabled=True and DHCPEnabled=True

For me, this returns just the IP address I'm interested in.  I replace the "IP Address" entry in BGinfo with my "IP  address" entry.

I create the following custom entries:


  • DNS  serverSELECT DNSServerSearchOrder FROM Win32_NetworkAdapterConfiguration Where IPEnabled=True and DHCPEnabled=True
  • IP  address - SELECT IPAddress FROM Win32_NetworkAdapterConfiguration Where IPEnabled=True and DHCPEnabled=True
  • Network  card - SELECT Description FROM Win32_NetworkAdapterConfiguration Where IPEnabled=True and DHCPEnabled=True
  • Subnet  maskSELECT IPSubnet FROM Win32_NetworkAdapterConfiguration Where IPEnabled=True and DHCPEnabled=True
Here is the end result:




Here is the bgi file that was saved: https://drive.google.com/file/d/0B35FDpn8GEl0RFhTZExIdjlRQm8/edit?usp=sharing



Mount ftp site as nfs mount point

For numerous purposes, not least of which is using rsync for backups.  Here is an article:

http://pingbin.com/2012/01/howto-rsync-backup-ftp-server/
Here is the short version:

  • apt-get install curlftpfs
  • mkdir /mnt/backup_server
  • emacs /etc/fstab
  • add the following line(s):
#curlftpfs#user:pass@ip-address /local/directory fuse rw,allow_other,uid=user-id 0 0
curlftpfs#pingbin:1234@10.0.0.1 /mnt/backup_server fuse rw,allow_other,uid=1000 0 0

  •  mount /mnt/backup_server


Saturday, May 24, 2014

Adding NFS entry to myCloud

Mounting an nfs volume on my Ubuntu VM (where I am running ownCloud) to access data on myCloud:

mkdir  /shared

mount yourMyCloudIP:/nfs /shared

emacs etc/fstab

add these lines at the end of fstab file:

#Entry for MyCloud NFS
yourMyCloudIP:/nfs /shared nfs default 0 0

save and exit editor.

Wednesday, May 21, 2014

Lenovo W530 - webcam doesn't work

The webcam keeps disappearing from the OS and from Skype.  It comes up with a message saying that the camera is in use by another application.

I've read a number of posts in the various Lenovo forums, and they indicate that lots of others are having similar issues.  Typically I'm able to fix this by going into Fn-F6 and tweaking something in there... but that is no longer working for me (the dialog no longer comes up).

So:

- to manually bring up that dialog, instead us Start > Lenovo - Web Conferencing or Start > Communications.

(still testing these to see if they help)

- Set the privacy to Normal

- Disable Activate Camera Plus (under Detailed settings)

Fix waiting / hung installs on iOS / iPhone / iPad

Several times, our old iPads get stuck updating their apps.  The application get into a state where they are waiting to be updated, but no progress is being made.  There seems to be no way to 'kick-start' them either.  Reboots don't help.

I've only figured out two 'fixes':

- Delete the offending app and re-install.  Of course this means you lose all of your state (not a good thing).

- Use a free application called i-FunBox.  This gives you direct access to the iPad file system (caveat emptor - you risk breaking things).  Plug in the iPad and run i-FunBox.  In the left most tab (iFunbox Classic), browse to iPad > Raw File System > Downloads... delete all the contents.  Finally, reboot the iPad.

That should do it...

Saturday, May 17, 2014

Windows custom hotkeys / shortcut keys

Trying to create hotkeys for things within Windows 7.  According to the docs, it seems as though you should be able to create a shortcut to the executable and add shortcut keys.  Not so much...

This seems to work OK when you have your shortcut on the desktop.  But, if that shortcut is moved of just created in another location, no such luck... the shortcut keys no longer work.

I found the post below which provides a suggestion, an explanation and some discussion.  In short:


Create a folder called:
C:\Users\username\AppData\Roaming\Microsoft\Windows\Start Menu\_hotkeys
Hotkey assignments within shortcuts in there are remembered/restored at next login.
http://www.sevenforums.com/customization/34091-custom-keyboard-shortcut-key-not-working-properly-2.html

Friday, May 16, 2014

Installing packages on myCloud

I really like my new WD myCloud and all that it can do.  But I really don't like the fact that emacs was not included on the base Debian OS.

So, the question is, how to install a new package on Debian.  Here is an example of getting emacs installed on the myCloud.  

First connect with ssh as root.

> apt-get update 
> apt-get install emacs

The first command updates the list of packages the system knows about.  The list is defined by the list of source in the file /etc/apt/sources.list.

vi cheat-sheet

As much as a loath the vi editor (clearly emacs is FAR superior), here is a decent cheat-sheet to cover the basics:

http://www.atmos.albany.edu/daes/atmclasses/atm350/vi_cheat_sheet.pdf

Friday, April 11, 2014

XP activation key warnings issue - solution

The DETAILS:

- rename C:\WINDOWS\system32\WgaLogon.dll    to C:\WINDOWS\system32\_WgaLogon.dll  (or anything)

- rename C:\WINDOWS\system32\WgaTray.exe   to     C:\WINDOWS\system32\_WgaTray.exe  (or anything)

- reboot

Monday, March 17, 2014

Setting up RDP on a different (non standard port)

If you want/need to set up RDP on a non standard port, here is how.


Why would you want to?  Perhaps you have a number of machines behind a NAT router that need to use port forwarding.

The standard port for RDP is going to be 3389.

1 - Start by enabling RDP on the local machines:

  • Right-click on My Computer > Properties
  • In left nav bar, click Remote settings
  • In the Remote tab, select Allow connections from computers running any version of Remote Desktop
  • Click OK.

2 - At this point, RDP is enabled.  Now change the default port by editing the system registry.


  • Start regedit: Start > run regedit.exe
  • Navigate to:
    • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp
  • Edit the key: PortNumber 
  • Change the value accordingly
  • Reboot the computer

3 - Deal with any firewall issues.  Either make sure your firewall is off OR make sure that the ports that are using are allowed through the OS firewall.  If you are using the Windows firewall, you can add a new inbound rule like this:



  • Start > Firewall with Advanced Security on Local Computer
  • Select Inbound Rules on the left
  • Click New Rule... on the right
  • Go through the wizard: select Port as the rule type and specify the port value








4 - The next step is to access the system.  Bring up the Remote Desktop client and specify the IP address along with the port in the form <ip>:<port>.  In the example below, the port is 3390.




5 - Finally, if necessary, configure your router to do the appropriate port forwarding based on the specific port. (those steps are going to be dependent on the router and are not documented here)

Thursday, February 6, 2014

Headphone volume gets reduced

On occasion, I find that the volume on my USB headphones gets reduced... I can not get them to go to the real max volume.  

A number of things can cause this, but one fix that I've used is the following:

  • Go to the Sounds interface
  • Select the sound device in question and click Properties 
  • On the Levels tab, set level to 100%
  • On the Enhancements tab, enable Loudness Equalization
  • Click Apply
That sound increase (at least in some cases) the max volume of your device.

Thursday, September 26, 2013

Adding RHEL6 installation DVD as yum repository

In building a RHEL6 VM (VMware Workstation), I wanted to define the install DVD ISO as a yum repository.


  • Mount the ISO through workstation as a DVD
  • Verify your path to the disk.  Easiest way... try right-clicking on the DVD desktop icon and select "Open in Terminal".  Use pwd to see the path.
  • Create the file /etc/yum.repos.d/dvd.repo
      [RHEL6-DVD-Server] 
      mediaid=xxxxxxxxxx.xxxxxx
      name=RHEL6 DVD Server
      baseurl=file:///media/RHEL_6.0\ x86_64\ Disc\ 1/Server
      enabled=1
      gpgcheck=1

  • Replace xxxxxxxxxx.xxxxxx with number in /path/to/DVD/.discinfo
      # cat /media/RHEL_6.0\ x86_64\ Disc\ 1/.discinfo
      1285193176.460470
      Red Hat Enterprise Linux 6.0
      x86_64
      1
  • rpm --import /path/to/DVD/RPM-GPG-KEY-redhat-release
      rpm --import /media/RHEL_6.0\ x86_64\ Disc\ 1/RPM-GPG-KEY-redhat-release

At this point, the yum repository should be visible and ready to use.  Try the following commands to confirm:
  • yum repolist
  • yum grouplist

Wednesday, September 25, 2013

Building a new RHEL6 VM using kickstart

There are main things I need here:

  1. A new VM -  Pretty easy, just use workstation and create a new VM without installing the OS.  
  2. The RHEL6 install disk - Mount the RHEL6 install disk ISO in the new VM.  
  3. The kickstart file - this is the tricky part.  Two things are critical here... a) the kickstart cfg file needs to be accessible to the new VM, and b) the kickstart cfg file needs to define where to get the install bit. 
To address the first issue (a), the simplest way to tackle this is to create a kickstart cfg file and make it available locally on the network via http.  I did this by bringing up a second VM and simply using a local httpd and copying the ks.cfg into the htdocs directory.

To address the second issue (b), the kickstart file needs to point the installer to the repo (or DVD) with the RHEL6 install bits.  As mentioned above in point 2, the disk was already made available through the virtual DVD (it could also be made available through the httpd that is being used for the ks.cfg file).  But just because the ISO is available doesn't mean that kickstart knows to use it.  So, if the following line is part of the ks.cfg file, kickstart will look to the local booted source as the DVD.

    #repo --name="Red Hat Enterprise Linux"  --baseurl=file:///mnt/source --cost=100

You are now ready to start the kickstart process.

  • Boot the new VM (off of the DVD ISO - use F2 to set the boot order)
  • On the screen where you are given a choice of where to boot from or where to install from, accept the first option "Install or upgrade an existing system" and hit TAB to edit the options
  • Add the following to the end of the existing line (vmlinuz initrd=initrd.img is already there):
    • vmlinuz initrd=initrd.img ks=http://<httpd-ip-addr>/ks.cfg
  • Hit enter to continue.
  • Accept whatever else the wizard offers you
    • Use All Space or Replace Existing Linux

Saturday, September 21, 2013

Avoid emacs split window at startup

If the variable inhibit-startup-screen is non-nil, Emacs does not display the startup screen.

Set the setting in your .emacs file. 

(setq inhibit-startup-screen t)