Simple Virtualenv Auto Activation With ZSH.

⌚ πŸ”– linux 

Since I moved from fish to zsh, one of the main things I missed was virtualfish. I’m not sure how any serious python developer lives without auto activation, as in automatically activating the virtualenv for your project when you open a terminal or cd to it.

Here is a script you can use to achieve auto activation. It doesn’t require virtualenvwrapper, pyenv, or anything like that. Just use python3’s built in python -m venv to create a virtualenv in ~/.virtualenvs/, use the provived venvconnect function to connect the activated env with the current directory, and you’re done.

#!/bin/zsh
#
# Auto activate a python virtualenv when entering the project directory.
# Installation:
#   source virtualenv-auto-activate.sh
#
# Usage:
#   Function `venvconnect`:
#       Connect the currently activated virtualenv to the current directory.
#
VENV_HOME=$HOME/.virtualenvs

function _virtualenv_auto_activate() {
    if [[ -f ".venv" ]]; then
        _VENV_PATH=$VENV_HOME/$(cat .venv)

        # Check to see if already activated to avoid redundant activating
        if [[ "$VIRTUAL_ENV" != $_VENV_PATH ]]; then
            source $_VENV_PATH/bin/activate
        fi
    fi
}

function venvconnect (){
    if [[ -n $VIRTUAL_ENV ]]; then
        echo $(basename $VIRTUAL_ENV) > .venv
    else
        echo "Activate a virtualenv first"
    fi
}

chpwd_functions+=(_virtualenv_auto_activate)
precmd_functions=(_virtualenv_auto_activate $precmd_functions)

Source the above script in your ~/.zshrc and you should get auto activation of python virtualenvs.

Customizing grml-zsh-config

⌚ πŸ”– linux 

Ever heard of grml-zsh-config? Maybe not, but it’s possible you may have used it. It’s the zsh config for the Arch linux installer, as well as some Debian systems.

Grml is a nice alternative to heavy and bloated config frameworks like oh-my-zsh and pretzo (even on a modern machine I’ve seen zsh take over a second to load using oh-my-zsh with just a few plugins enabled).

Unfortunately, grml is not that easy to configure, and the available documentation is a little lacking. With a few tweaks though, I managed to get a proper shell out of grml.

Read more...

ArchLabs Linux Review (and tips)

⌚ πŸ”– linux 

Today I’m writing a review of the ArchLabs linux distro. Have you ever wanted a badass Arch linux install, complete with an openbox window manager, conky, and dark gtk themes, worthy of the top spot on /r/unixporn? Of course you do, but if you’re anything like me, you’re a busier person than you were when you were 15, and you no longer have the time, or the inclination.

Enter ArchLabs, elite Arch Linux for the lazy:

Desktop

Read more...

Why I Still Prefer Unity: It's All About Real Estate

⌚ πŸ”– linux 

I’ve been pretty good about not becoming a open source pundit. But today I feel like writing something useless.

My laptop’s ssd crapped out yesterday so I spent the day restoring backups and installing operating systems. I’ve been using Ubuntu for a few years now, so I thought it would be great to revisit Gnome and see how the 3.x development is coming along, maybe even switch back.

Nope.

Read more...

Fun and Trickery with the Kippo SSH Honeypot

⌚ πŸ”– Linux  Technology 
I was recently tasked with setting up a honeypot for an organization that wanted some better insight into who was snooping around in their network. For those of you too lazy to read, what is a honeypot? Well remember in 3rd grade when we madeΒ leprechaunΒ traps out of shoeboxes that usually consisted of some elaborate setup to trick the little men into thinking they were getting their hands on a pot 'o gold? Read more...

Best Bash Prompt Ever

⌚ πŸ”– Linux  Technology 
Ever wish your command line was a little more friendly? Maybe you'd like to add some emotion to your static computing environment? I give you the smiley face bash prompt! [caption id="attachment_441" align="alignnone" width="495" caption="Font is terminus, btw."][/caption] This bash prompt displays a green smiley face or a red frowny face depending on the return status of the last command executed. To use it, insert the following code to the end of your ~/. Read more...