Blog.phpwnage
News | Forum | Log In

Conky
March 8, 2010 (5:06pm EST) Posted by klange
forum image

Also, rain. Lots of rain.


Discuss this news post here.
(No comments)

You got your SOCKS in my DNS!
February 5, 2010 (6:06pm EST) Posted by klange
Here's an overview of how my SOCKS over DNS proxy system is going to work:

forum image


Fairly simple, right? Just a relay server, incoming SOCKS data is encoded in base-32, passed as an A request to the DNS hivemind, eventually gets to our server, where it's decoded, and passed on again as SOCKS data to a real SOCKS server. Data from that real SOCKS server is encoded by the DNS server in base-64, tossed into a few TXT packets, and thrown back down the line as a response to a different set of queries, where it eventually reaches the client and is decoded and converted back into regular SOCKS data and fished back to the application.


Discuss this news post here.
(No comments)

My New Bash Prompt
February 4, 2010 (2:31pm EST) Posted by klange
Last night, I set up a new bash prompt. It's a modified version of my old prompt with a bit more information added:
forum image

In a normal prompt, it's pretty much the same as my old one: user, host, date, time. I added a seconds display, moved the path into the brackets, and then added a new line. When in a git repo, I can see the current branch name, whether I have modified files lying around, and whether I have yet to push (if I'm ahead of the current branch). I'm thinking of expanding this to subversion and Bazaar, both of which I use quite a bit. When a program returns a value other than 0, I also display that after the current time, in bright red. If I'm root, the prompt symbol changes from a green $ to a red #.

The more interesting things to note are why I have so much information there by default. I ssh to a lot of different machines and sometimes into different users, so it's good to be able to identify what user I currently am (whether it be `klange` on my personal systems, `lange7` on a university system, or any of the random users I `sudo --` into on my server). For the same reason, I always need to know immediately what machine I'm connected to, but I don't need the full hostname (I know what machines are part of the ACM network and which are part of EWS, and which are mine, based on naming schemes). I use the clock because my panel is on auto-hide, so the quickest way to glance at the time is to look at the prompt, rather than having to move my mouse to show my panel. It's also good to see when a command ended.

Code:
function prompt_command {
    local RETURN_CODE="$?"
    local ASCII_RESET="\[\e[0m\]"
    local ASCII_BOLD="\[\e[1m\]"
    local USER_COLOR="\[\e[1;33m\]"
    local PROMPT_COLOR="\[\e[1;32m\]"
    if [[ ${EUID} == 0 ]] ; then
        PROMPT_COLOR="\[\e[1;31m\]"
    fi
    local HOST_COLOR="\[\e[1;32m\]"
    local DATE_COLOR="\[\e[1;31m\]"
    local TIME_COLOR="\[\e[1;34m\]"
    local DATE_STRING="\$(date +%m/%d)"
    local TIME_STRING="\$(date +%H:%M:%S)"
    local CYAN_COLOR="\[\e[1;36m\]"
    local PINK_COLOR="\[\e[1;35m\]"
    
    local PROMPT_PREFIX="$PROMPT_COLOR"
    if [[ $RETURN_CODE != 0 ]] ; then
        PROMPT_PREFIX="$DATE_COLOR$RETURN_CODE$ASCII_RESET " # do nothing
    fi
    local GIT_STATUS=`git status 2>/dev/null`
    if [[ $GIT_STATUS != "" ]] ; then
        local REFS=$(git symbolic-ref HEAD 2>/dev/null)
        REFS="${REFS#refs/heads/}"
        if [[ `echo $GIT_STATUS | grep "modified:"` != "" ]] ; then
            REFS="$REFS$ASCII_RESET ${PINK_COLOR}modified"
        fi
        if [[ `echo $GIT_STATUS | grep "ahead of"` != "" ]] ; then
            REFS="$REFS$ASCII_RESET ${CYAN_COLOR}not pushed"
        fi 
        PROMPT_PREFIX="$PROMPT_PREFIX$USER_COLOR$REFS$ASCII_RESET "
    fi
    
    
    PS1="$ASCII_BOLD[$USER_COLOR\u $HOST_COLOR\h $DATE_COLOR$DATE_STRING $TIME_COLOR$TIME_STRING $PROMPT_PREFIX$ASCII_RESET\w$ASCII_BOLD]$ASCII_RESET\n$PROMPT_COLOR\\\$$ASCII_RESET "
}
export PROMPT_COMMAND=prompt_command



Discuss this news post here.
(No comments)

JAPN199 Canceled
February 2, 2010 (5:37pm EST) Posted by klange
Makes me sad [:(]. The Japanese department was unable to find a TA for the course, so it's been canceled. This shouldn't affect my study-abroad trip, but it does mean I'll have to resort to pure personal study ie., through Rosetta Stone and online tools. I was looking forward to the class...

Reddit AMA?
January 30, 2010 (2:50am EST) Posted by klange
Going to try to get Sam and whoever else is still working to do an AMA on Reddit. Why? idunno, I'm a bit bored at the moment, not much to work on.

If we do, we'll be using the account IAmACompizDev.

Just an idea though.


Discuss this news post here.
(No comments)



(C) 2010 Kevin Lange
This page executed in 1.01051497459 seconds.