Archive for September, 2012

Cool, interesting, useful, unique and innovative Shell Prompts

by Oliver on Wednesday, September 19th, 2012.

At $employer today, we had our bi-weekly tech talk session and one of the lightning talks given was on tmux. Tmux is an excellent piece of software (although I gave up on it and started using iTerm2) but that’s not what I wanted to talk about.

One of the other participants in the session noticed the presenter’s shell prompt had a little smiley/frowney face which changed both expression and colour depending on the exit code of the last command – how cool is that? How many times have we all typed echo $? just to find out if our last command was really successful? It really makes sense to have this information displayed at all times.

So in that spirit I’m sharing my PS1 prompt variable with you. It’s not the most advanced, doesn’t use all of the bells and whistles and I’m still not entirely sure the information it presents is essential but it’s a work in progress. I’d love for you to share your own in the comments in the hope of spreading know-how and ideas!


export PS1="\`if [ \$? = 0 ]; then echo \e[33\;40m\\\^\\\_\\\^\e[0m; else echo \e[36\;40m\\\-\e[0m\\\_\e[36\;40m\\\-\e[0m; fi\` \[\033[38m\]\u \[\033[0;36m\]\j \[\033[1;32m\]\!\[\033[01;34m\] \w \[\033[31m\]\`ruby -e \"print (%x{git branch 2> /dev/null}.split(%q{\n}).grep(/^\*/).first || '').gsub(/^\* (.+)$/, '(\1) ')\"\`\[\033[37m\]$\[\033[00m\] "

Roughly in order, this equates to:

  1. Smiley/frowney face based on exit code of last command.
  2. Username
  3. Number of backgrounded jobs
  4. Shell history number
  5. CWD leaving home directory an unexpanded ~
  6. Git repository branch, using Ruby 1.8/1.9-compatible code

On my machine it looks like this:

What does yours look like?

Tags: ,

Wednesday, September 19th, 2012 Tech 4 Comments

Why didnt anyone tell me…

by Angela on Tuesday, September 18th, 2012.

Some ideas I want to share that I wish had shared with me prior to Motherhood…

It will ALL BE OK  – TRUST YOUR INTUITION AND YOUR INSTINCTS!!! This child is yours and yours alone so Fuck what people say, it is usually their incorrect and often unfounded opinions that make you question your own, when you know what is best for you and your  child.

It will get much easier, and much much harder. Settle in for uncertainty, because YOU CANNOT CONTROL EVERYTHING

IT IS OK TO MAKE MISTAKES> FUCK UP, its what is needed to grow with this tiny human, who needs to learn that making mistakes is vital to being HUMAN!!! your child does not need you when you are perfect, your child needs you NOW. just as you are, flaws and insecurities.

Having a child is the BEST personal trainer for your life both mentally and physically and often spiritually too. They will make you question everything, and then question it again. When you think you know what is going on, you will be thrown and have to get back up again, but even when you are tired – you will still find the strength somewhere to get back up again.

ASK FOR HELP IF YOU NEED IT. it is not a sign of weakness. You are a better mother/parent/guardian when you have had sleep, a shower and have fuelled your body properly.

The world will look different in the morning. GO TO BED. NOW.

Friends with or without babies –  who are true friends mind you,  will understand and will still respect you – even when you cancel on them for the 100th time due to having a child. There are some things that friends cannot possibly understand  UNTIL they are parents and have gone through it first hand –  BUT they should not judge you for this new little person who has thrown your  entire world into havoc. Also, do not expect them to “get” all the parent stuff that comes with the territory and do not judge them for it.

LIFE will not be the same, but it may turn out better so run with it – be prepared that all your previous ideas about being a parent and what it may be like, will be questioned, may be wrong, will have to adapt

Your child is its own unique personality. They will have up and down moments and some days, you personalites will unite, others they will clash. your child is NOT A BLANK SLATE at birth so there are certain temperaments, genes and traits that are beyong your control. Instead of fighting this. work around it.

Pick your battles. Not everything is worth the stress in that moment. IF it is the difference between a messy house, or a happy child- go with what makes sense. Your sanity is worth more than looking like you stepped off the runway or like you can do it all, by having a clean house, dinner made and a bathed child who will sit there  cooing in the background. its an illusion.

The media will fuck you. THey will present the ideal woman/mother/feminist/role model and expect you to emulate it. You will fail if you try.

A baby will change your marriage/relationship with you partner, your baby – daddy, or  whoever is the so called  “significant other”. Be prepared to accept that. even though it looks and feels different -It does not mean there is no longer love there, it just morphs into a different shape. it will continue to morph, as your child/children grow.

This moment like all, WILL PASS. So breathe.

Your role as a mother will be all consuming, especially in the beginning –  but it wont be like that always. you will re-discover a sense of self, outside of motherhood. Your self worth is not only tied to how you rate as a parent or mother. IT is one very important part of your life that demands respect, but it is not all you are, even if you think that is how you appear post – child.

You are doing the best job you can. That will have to be enough.

Your child will not meet all the milestones that the baby websites tell you they will, at the exact moment that they tell you they SHOULD. Your child is a human being, not a machine.

You will think so called “tabooed or  bad thoughts” about your new life, your child, and yourself. They are just thoughts. It is healthier to admit they are there, acknowledge a feeling or emotion and then move on.  it does not make you a bad person for thinking them.  Thoughts such as “My child deserves better”, “having a baby was a mistake”, “I just want to be alone why cant my child be quiet”, “If this child does not stop screaming, I may have a nervous breakdown”. “I  want my old life back”, “I want my relationship with my partner the way it was before”, “I want freedom”

–  any screaming match/tantrum/episode will pass. your child cannot physically scream forever, so when your nerves are fried, remember it will stop.

Allow your child to give you the  the gift of spontaneity. It can feel like the constant change is stressful, but it can be so refreshing to remain constantly present and “in the moment”- stop and look at the child you have. there is no one else like this human being.

Do little things just for you. some small but significant things that work for me:

– Take a bath, or if no time, run wrists and hands under water. A hot towel to the face will rejuvenate you. Essential oils on the temples – orange or citrus for waking up, lavender or patchouli for relaxation.

– Buy some flowers

– A walk in the sun. simple. costs nothing to walk, and you can take baby/child with you either in the ergo or pram

-Ask for a massage from someone close –  or if no one is there, give yourself a head or hand massage, focusing on pressure points.

-Dont cook, but instead try a meal from that new restaurant you have walked past a dozen times. Sit and enjoy that meal.

– start reading that book that is on the shelf that you keep meaning to read.

– Call a friend and talk about everything and anything that HAS NOTHING TO DO WITH BEING A PARENT.

– watch an inspirational talk on Ted.com

 

 

 

 

Tuesday, September 18th, 2012 Thoughts No Comments

Broken environment variables and broken dreams

by Oliver on Wednesday, September 12th, 2012.

OK, the content of this post is not nearly as melodramatic as the title – I’m attempting to do some log analysis with Hadoop and Pig (yes, I’m several years in the past, just barely catching up to all of you folk who have been using Hadoop for a long time). As the logs are coming from a webserver and are not that far from standard “combined” format, it is most logical to use the time-saving UDFs in Pig’s Piggybank. This is just a set of user-contributed code, but very useful.

Unfortunately there doesn’t seem to be a Debian package for it, at least not in the set of repositories I have available to me on this machine so I thought I’d just compile it – it is dynamically loadable from an arbitrary path in a Pig script so this is not a big issue. The process is two-fold:

  1. Compile Pig itself (or locate the pig-withouthadoop.jar pre-compiled on your system)
  2. Compile Piggybank against that version of Pig

Pig uses the Ant build system, and it really is as trivial as running ant from the top-level directory. I checked out the tagged release of 0.10.0 and successfully built Pig. Building Piggybank against it, however, errored out with something I wasn’t immediately able to find on the interwebs:

$ ant
Buildfile: /home/oliver/release-0.10.0/contrib/piggybank/java/build.xml

init:
    [mkdir] Created dir: /home/oliver/release-0.10.0/contrib/piggybank/java/build
    [mkdir] Created dir: /home/oliver/release-0.10.0/contrib/piggybank/java/build/classes
    [mkdir] Created dir: /home/oliver/release-0.10.0/contrib/piggybank/java/build/test
    [mkdir] Created dir: /home/oliver/release-0.10.0/contrib/piggybank/java/build/test/classes
    [mkdir] Created dir: /home/oliver/release-0.10.0/contrib/piggybank/java/build/docs/api

compile:
     [echo]  *** Compiling Pig UDFs ***
    [javac] /home/oliver/release-0.10.0/contrib/piggybank/java/build.xml:92: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 154 source files to /home/oliver/release-0.10.0/contrib/piggybank/java/build/classes
    [javac] error: error reading /home/oliver/release-0.10.0/pig-withouthadoop.jar; invalid header field
    [javac] 1 error

BUILD FAILED
/home/oliver/release-0.10.0/contrib/piggybank/java/build.xml:92: Compile failed; see the compiler error output for details.

Total time: 0 seconds

Now, I’m not a Java guy so this means very little to me. However I do at least know that a Jar file is simply a zip archive so I went digging. Assuming that the ‘invalid header field’ is in the metadata of the Jar file, I looked in the contained META-INF/MANIFEST.MF:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.0
Created-By: 1.6.0_26-b03 (Sun Microsystems Inc.)
Main-Class: org.apache.pig.Main

Name: org/apache/pig
Implementation-Vendor: Apache
Implementation-Title: Pig
Implementation-Version: 0.10.0-SNAPSHOT
Build-TimeStamp: Sep 12 2012, 08:14:45
Svn-Revision: svnversion: warning: cannot set LC_CTYPE locale
svnversi
 on: warning: environment variable LC_CTYPE is UTF-8
svnversion: warni
 ng: please check that your locale name is correct
1383830

It seems that some locale settings in the environment are causing issues with the svnversion program, and indeed when running it separately I can confirm the same issue:

~/release-0.10.0$ svnversion
svnversion: warning: cannot set LC_CTYPE locale
svnversion: warning: environment variable LC_CTYPE is UTF-8
svnversion: warning: please check that your locale name is correct
1383830

I’ve been seeing this on a bunch of machines I’ve been using recently but frankly I haven’t had the time to diagnose it. It is easily worked around with unset LC_CTYPE:

~/release-0.10.0$ unset LC_CTYPE
~/release-0.10.0$ svnversion
1383830

There is some contention around adding superfluous metadata fields in Ant builds, but again, this is something I don’t particularly care to dive into at the moment. An acceptable alternative workaround in this case would have been to remove the additional metadata generation in the Ant build.xml.

Rebuilding Pig now and Piggybank against it works. Huzzah! On to the next problem 🙂

Tags: , , , , ,

Wednesday, September 12th, 2012 Tech No Comments