Welcome to my website. I am always posting links to photo albums, art, technology and other creations. Everything that you will see on my numerous personal sites is powered by the formVistaTM Website Management Engine.

icon.linkedin.jpgicon.twitter.jpg

  • Subscribe to this RSS Feed
  • Installing Chrome Extensions Without Signing in With a Google Account
    06/27/2014 10:49AM

    Google requires that you login with a Google account before you can install any Chrome extensions.

    The following is how to install an extension without logging in (under Windows.  The same should work under Linux and Mac):

    1. Find the ID for the extension.  When you browse the extension in the store you will see a URL similar to the following:  https://chrome.google.com/webstore/detail/cookies/iphcomljdfghbkdcfndaijbokpgddeno?hl=en.   The hash string after the 'cookies' string (the name of the extension) up to the ? is the id.
    2. Download the .crx extension file.  Use the following URL and replace the <ID> string with the ID for your extension:  https://clients2.google.com/service/update2/crx?response=redirect&x=id%3D<ID>%26uc.  Chrome will complain that the extension cannot be added from this site.  Just ignore/OK it and you will be able to download it.
    3. Download and install (if you don't already have it) 7zip.
    4. Create a directory and move the .crx file into it.  Go into that dir, rename the .crx file to .zip and use 7zip to extract the file.
    5. Then back in chrome enter the following URL:  chrome://extensions/
    6. Towards the top-right of the page, check the "Developer Mode" checkbox.
    7. Then click on the "Load unpacked extension..." button and navigate to the directory that contains the unpacked .crx file and select it and it should install the extension for you.
  • Removing The Last N Character From a String in Bash Script
    06/19/2014 5:28PM
    Here is a quick one-liner for trimming a specific number of characters from the end of a string under bash:

    # Remove the last 5 characters
    $ echo "somestringwith12345" | sed "s/.....$//g"
    $ somestringwith

    # Remove the last 3 characters
    $ echo "somestringwith12345" | sed "s/...$//g"
    $ somestringwith12
  • Running Multiple Instances of Notepad++ Under Windows 7
    06/17/2014 4:51PM

    If you want to run multiple versions of Notepad++ under Windows 7 create a .bat file with the following:

     "C:\Program Files (x86)\Notepad++\notepad++.exe" -multiInst %1

    And simply run the bat file via a cmd prompt/ 

  • Splitting a String in Bash on the FIRST Occurrence of a Character
    06/11/2014 4:52PM
    About a year ago I posted an article about how to split into an array of values based on a given delimiter in bash.

    The following is how to take that same string and split it on the first occurrence of the same user defined delimiter.

    Both use the 'read' command, but in a slightly different way.

    Instead of passing read the -a [aname] parameter which tells it that "The words are assigned to sequential indices of the array variable aname, starting at 0.", we pass is -r which indicates that "Backslash does not act as an escape character.  The backslash is considered to be part of the line.".  This will make sure to include any backslash that is in the string in your output.

    Then, we provide two variables into which we will store the split string.

    #!/bin/bash

    SOURCE_STRING='foo|blah|moo'

    # Save the initial Interal Field Separator
    OIFS="$IFS"

    # Set the IFS to a custom delimiter
    IFS='|'

    read -r KEY VALUE <<< "${SOURCE_STRING}"
    echo "KEY = $KEY, VALUE = $VALUE"

    # Reset original IFS
    IFS="$OIFS"
  • BASH Script With Default Arguments Defined in The Script
    06/02/2014 12:41PM

    Often times you will want to write a BASH script where you don't want to have to keep track of all of the positional command line arguments and/or you might want to configure it with a set of environmental variables while having a default value for each in the script.

    Following is the syntax for declaring them in the shell script, and then an example on how to invoke it.

     #!/bin/bash

    : ${ARG1:="somedefault_arg1"}
    : ${ARG2:="10"}

    echo "ARG1 = $ARG1"
    echo "ARG2 = $ARG2"



    $ ./default-bash-vars.sh
    ARG1 = somedefault_arg1
    ARG2 = 10
    $ ARG1="someOtherArg1" ARG2="20" ./default-bash-vars.sh
    ARG1 = someOtherArg1
    ARG2 = 20

    In the example script, we have two variables, ARG1 and ARG2.  When running the script without providing any additional configuration the default values will be used.  When invoking it and defining the variables on the command line prior to executing the script those values will be used instead.

    This prevents the situation where you potentially have many command-line arguments and then have to jugle the positional $1, $2, .... vars in the script.

Advanced Search

Categories

Archives