createpw.exe (week #23)

Tuesday, June 4, 2013 Labels: ,
This is a simple utility to create unique passwords from a key (such as a website name) and a master password. The idea for the code came from ss64.com.

USAGE: createpw.exe [options] [key|site-name]

  key|site-name      Any unique key that you will remember.
                     If you’re using this for a website, put in
                     the url (such as: amazon or amazon.com).
                     If omitted, you will be prompted for it.

OPTIONS: 

  --clip             Put the newly created password onto the clipboard. 
                     This is the default behavior.
  --no-clip          Output the new password to the console.
  --no-symbols       Do not output symbols in the new password.

When it asks for the user name, you can just press enter to bypass/skip it. JUST be sure that you are consistent in supplying a user name with keys or not.

Here are a couple of examples:

    $ createpw amazon.com
    Enter the username:         user
    Enter the master password:  ********

    password = (put into clipboard)

    $ createpw
    Enter the site name or key: amazon.com
    Enter the username:         user
    Enter the master password:  ********

    password = (put into clipboard)

    $ createpw --no-clip
    Enter the site name or key: amazon.com
    Enter the username:         user
    Enter the master password:  ********

    password = #ZJ~EEUmXuYVdMEMUK7CVbgxqY

For the last example I typed `12345678` for the password. You should get the same result!

Check out the source code at GitHub!

sortxml (week #22)

Tuesday, May 28, 2013 Labels: ,
This is a very simple utility that prettifies and sorts xml file nodes and attributes.

It is simple to use.


USAGE: sortxml.exe [options] infile [outfile]

  infile      The name of the file to sort, etc.
  outfile     The name of the file to save the output to.
              If this is omitted, then the output is written to stdout.

OPTIONS:

  --pretty    Ignores the input formatting and makes the output look nice.
  --sort      Sort both the nodes and attributes.
  --sortnode  Sort the nodes.
  --sortattr  Sort the attributes.

(prefix an option with ! to turn it off.)

The default is to output pretty and sorted nodes and attributes. So, given the following:

    $ type sample.xml
    <root><node attr="name" value="one"></node></root>
Would output the following:

    $ sortxml.exe sample.xml
    <root>
        <node attr="name" value="one">
        </node>
    </root>
I created this utility so I can use it as a File Format in Beyond Compare. Here is the gist of the File Format in BC3.

    Helpers\sortxml.exe --pretty --sortnode --!sortattr %s %t

Check out the source code at GitHub!

jQuery.deepShow()

Wednesday, May 22, 2013

I wrote this little snippet earlier today that ensures an object is shown even if one of its parent objects is currently being hidden. It does this, of course, by going through its parents and checking for the 'display:none' property..

/// <summary>
/// Shows the object and clears any style="display:none;" /// styles on all of its parents.
/// </summary>
jQuery.fn.deepShow = function() {
    $(this).parents().each(function() {
        if ($(this).css("display") === "none") {
            $(this).css("display", "");
        }
    });
    $(this).show();
}

menustack (week #21)

Tuesday, May 21, 2013 Labels: ,
menustackA nifty dynamically loaded menu, one menu item per file, useful for docking onto your taskbar for easy access to lots of applications/shortcuts.

It also includes a search field at the top, so when the menu opens you can immediately start typing to filter out menu items.

It is simple to use.

Just create a shortcut (link) to the menustack.exe file. Then edit the shortcut properties, specifically the target. This is the default syntax:

    menustack.exe --f filepattern filepath

The options are:

    --f filepattern

Specifies the files to show in the menu. This is generally a wildcard, such as *.exe, *.lnk, *.sln, etc.

    filepath

Specifies the directory to look for the files to include. This can be anywhere on your system. Be sure to include paths with spaces within double-quotes.

Here is an example:

    "...\MenuStack.exe" --f *.lnk "%UserProfile%\Dropbox\Shortcuts"

This will create a menu item for each file (*.lnk) in the Shortcuts directory.

File system details:

The files in filepath are automatically sorted alphabetically. However, you can customize that also. You can basically separate the sort key from the displayed menu text (file name) using the `]` symbol. For instance, in the screen shot above, the menu items are not alphabetical. This is because the files (the .lnk files) are named as follows:

    10] Chrome – Default.lnk
    10] Chrome (Profile 2).lnk
    10] Chrome (Profile 3).lnk
    20] Beyond Compare.lnk
    30] Sublime Text.lnk
    30] Visual Studio 2013.lnk
    50] Personal Projects.lnk
    60] Putty.lnk
    61] Winamp.lnk

It works pretty well. The search/filter is extremely inefficient and a bit wonky. But, it does the job!

Check out the source code at GitHub!

SublimeCycleWhiteSpace (week #19)

Tuesday, May 7, 2013 Labels: ,

Cycle's through Sublime Text's three options for displaying white space: none, selection, and all.

Many thanks to skuroda for his extremely helpful comment on Stack Overflow.

Check out the MIT-licensed source code on GitHub.

Features

  • Configure which options to cycle through in the settings.

Installation

Clone into your sublime packages directory.

Sorry, I haven't even looked at using Package Control yet.

Configuration

CycleThroughWhitespace.sublime-settings

Turn each option on or off here. If you want to alternate all three view options from your shortcut key, then set each to true. If you only want to alternate between selection and all, set only those two properties to true.

{
"cycle_whitespace_none": true,
"cycle_whitespace_selection": true,
"cycle_whitespace_all": true
}

Default (Windows).sublime-keymap

My default key bindings mirror that of Visual Studio. Feel free to change it to whatever you want.

[
{ "keys": ["ctrl+r", "ctrl+w"], "command": "cycle_through_whitespace" }
]

encrypt / decrypt (week #18)

Tuesday, April 30, 2013 Labels: ,

Simple utility that will copy newer and/or missing files from the source folder to the destination folder.

Please note that openssl is required! These two batch files just wrap it.

Check out the source code on GitHub!

> encrypt /?
o
8
.oPYo. odYo. .oPYo. oPYo. o o .oPYo. o8P
8oooo8 8' '8 8 ' 8 '' 8 8 8 8 8
8. 8 8 8 . 8 8 8 8 8 8
'Yooo' 8 8 'YooP' 8 'YooP8 8YooP' 8
:::.....:..::..:.....:..:::::....8 8 ....:::..:::
::::::::::::::::::::::::::::::ooP'.8 ::::::::::::
::::::::::::::::::::::::::::::...::..::::::::::::

simple wrapper using openssl to encrypt files
batch file created by wasatchwizard

USAGE:

$ encrypt file

Performs in-place encryption of 'file'.
WARNING: This overwrites existing file!

$ encrypt infile outfile

Encrypts 'infile' and saves to 'outfile'.


> decrypt /?

8 o
8 8
.oPYo8 .oPYo. .oPYo. oPYo. o o .oPYo. o8P
8 8 8oooo8 8 ' 8 '' 8 8 8 8 8
8 8 8. 8 . 8 8 8 8 8 8
'YooP' 'Yooo' 'YooP' 8 'YooP8 8YooP' 8
:::.....::.....::.....:..:::::....8 8 ....:::..:::
:::::::::::::::::::::::::::::::ooP'.8 ::::::::::::
:::::::::::::::::::::::::::::::...::..::::::::::::

simple wrapper using openssl to decrypt files
batch file created by wasatchwizard

USAGE:

$ decrypt file

Performs in-place decryption of 'file'.
WARNING: This overwrites existing file!

$ decrypt infile outfile

Decrypts 'infile' and saves to 'outfile'.

Older Posts Newer Posts