Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of Linux is the Linux kernel, an operating system kernel first released 5 October 1991 by Linus Torvalds.

Articles on Linux

  1. HTTPS: Creating Slef-signed Certs

    Occasionally, I need to create self-signed certs when testing application through https. This isn't really the best way to do it, as it will require anyone visiting to confirm a security exception, but it's useful in a pinch.

    Continue reading

    Published on in Linux

  2. Installing Node.js on CentOS

    I wrote the following script to install Node.js on CentOS to handle a Rails missing a JavaScript runtime environment error.

    #!/usr/bin/env bash
    set -ue
    sudo echo "Ensure sudo access."
    sudo touch /etc/yum.repos.d/naulinux-extras.repo
    sudo sh -c "echo '[naulinux-extras]
    name=NauLinux Extras
    ' > /etc/yum.repos.d/naulinux-extras.repo"
    sudo yum --enablerepo=naulinux-extras install nodejs

    Published on in Linux

  3. Securing Redis via IPTables

    Here's a simple script to secure Redis via IPTables (tested on CentOS 6.3):

    #!/usr/bin/env bash
    # this script will add an ip address to iptables
    # allowing the ip address to connect to redis
    # should be run with localhost first
    if ! test "$IPADDRESS"; then
        echo "Please enter the IP Address you want to be able to connection to Redis."
        exit 1
    sudo iptables -A INPUT -s $IPADDRESS -p tcp -m tcp --dport 6379 -j ACCEPT
    sudo bash -c 'iptables-save > /etc/sysconfig/iptables'

    Then run as follows:

    $ ./ localhost
    $ ./ 555.555.555.555 # < your ip goes here

    Published on in Linux

  4. Killing Caps Lock on Ubuntu

    1. Create xmodmap file:

       $ xmodmap -pke > ~/.xmodmap
    2. Edit the newly created ~/.xmodmap file, changing the line starting with keycode 66 = to map to a key of your choice. Here's an example where I'm mapping Caps Lock to the Escape key:

       keycode  66 = Escape NoSymbol Escape
    3. Load your new map, disabling Caps Lock:

       xmodmap ~/.xmodmap
    4. (optionally) You can set this to autostart when you launch Unity by creating the following file:

       $ cat .config/autostart/xmodmap.desktop
       [Desktop Entry]
       Exec=xmodmap ~/.xmodmap
  5. Minimum Version Checking with BASH/ZSH

    The following line will print zsh version information if the version is greater then or equal to 4.3.17, otherwise it will return blank:

    zsh --version | awk '{print $2}' | awk -F'.' ' ( $1 > 4 || ( $1 == 4 && $2 > 3 ) || ( $1 == 4 && $2 == 3 && $3 >= 17 ) ) '

    An example usage would be something like:

    #!/usr/bin/env bash
    if test "$( zsh --version | awk '{print $2}' | awk -F'.' ' ( $1 > 4 || ( $1 == 4 && $2 > 3 ) || ( $1 == 4 && $2 == 3 && $3 >= 17 ) ) ' )"
        # do someting that only higher zsh versions support
        # do something else for low versions
  6. Fixing Backlight on the HP Folio 13 when using Linux

    This is something I ran in to when origionally setting up my Folio, which I did not post on. However, today a co-worker asked me how to solve this problem, so I thought I should jot it down for future reference.

    1. Open your grub config: sudo vi /etc/default/grub.
    2. Update the line containing GRUB_CMDLINE_LINUX_DEFAULT, adding acpi_backlight=vendor to the end. It should look something like this when you're done:

       # file: /etc/default/grub
       # ...
       GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi=on acpi_backlight=vendor"
       # ...
    3. Save and update grub with sudo update-grub.

    4. Reboot and you should have a display.

    Note: You will need to use an external monitor or drop in to grub's preboot command line and add the above to be able to see your screen before adding the above option.

    Published on in Linux

  7. RVM, irb, readline and Ubuntu

    It's as easy as:

    sudo apt-get install libreadline-gplv2-dev
    rvm remove ruby-1.9.3-p194
    rvm install ruby-1.9.3-p194



    1. Do not use rvm pkg install readline.
    2. "1.9.3-p194" is an example, should work with most versions.

    Published on in Linux, Ruby

  8. Web Pasting with "gistcli"

    Found this simple Python script which allows for cli gist posts -- (thanks to pranavk).

    You can install it like so

    $ mkdir ~/bin
    $ echo "export PATH=~/bin:$PATH" >> ~/.zshrc
    $ cd ~/bin
    $ wget
    $ chmod 755 gistcli
    $ source ~/.zshrc

    Usage examples

    # simple echo to gist
    echo "test gist" | gistcli
    # file to gist
    gistcli -f myfile.txt
    # private
    echo "ssssh, don't tell anyone!" | gistcli -p
    # from tty, EOF from '.' on it's own line
    gistcli -
    Foo, bar bah bing!

    Note: There's also a slightly more mature Ruby gist cli tool at but I had issues getting it to work with my RMV setup.

  9. IPTables Rules Examples

    25 Most Frequently Used Linux IPTables Rules Examples (external)

    "At a first glance, IPTables rules might look cryptic. In this article, I’ve given 25 practical IPTables rules that you can copy/paste and use it for your needs. These examples will act as a basic templates for you to tweak these rules to suite your specific requirement."

    How-To: Redirecting network traffic to a new IP using IPtables (external)

    "While doing a server migration, it happens that some traffic still go to the old machine because the DNS servers are not yet synced or simply because some people are using the IP address instead of the domain name.... By using iptables and its masquerade feature, it is possible to forward all traffic to the old server to the new IP. This tutorial will show which command lines are required to make this possible. In this article, it is assumed that you do not have iptables running, or at least no nat table rules for chain PREROUTING and POSTROUTING."

    Published on in Linux

  10. BASH Arrays

    Basic Array handling in BASH, because I always forget.

    # basic itteration
    items=( a b c d e )
    for i in "${items[@]}"
        echo -n $i
    #=> abcde
    # update specific array slot
    # access specific array slot
    echo ${items[1]}
    #=> foo