The Art of Shaving Refill

I had ran out of my Art of Shaving arsenal and hadn’t had a chance to pickup new product for a few months until yesterday.  I needed everything so I picked up the Lavender Pre Shave Oil, Lavender Shave Cream, and the Sandalwood After Shave Balm.  I was tossing around getting the unscented Cream and Oil instead of Lavender so the lovely fragrances specialist Ruth helped me decide and gave me some unscented testers to accompany my original decision.  To my surprise she brought me about 8 travel kits including oil, cream, and aftershave.

artshaving1 artshaving2
The 4 Elements of the Perfect Shave
1) Prepare     Pre-Shave Oil softens the beard and protects the skin
2) Lather up!     Shaving Cream provides a close and comfortable shave
3) Shave     With a good handle, sharp blade & proper technique
4) Moisturize     After-Shave Balm sooths & refreshes the skin

http://www.theartofshaving.com/info/theperfectshave

Followup- 19 June 2010, I went to the mall with @sauceboss and picked up a some more art of shaving product.  It seems like one batch lasts me about 5-6 months.  Not bad.

art-of-shaving

Monitoring Resource Usage in OSX

One great pleasure of using osx is that it recovers from high usage and application crashes much nicer then any version of windows could ever imagine doing.  Managing and viewing process status in osx is easy, with Activity Monitor or via terminal with process status (ps).  Also are few widgets for the menubar and dashboard like istat pro that also assist with tracking your usage.

activity monitor Screen shot 2010-01-12 at 10.43.09 PM

A users first option when you notice a lockup or an unresponsive program is to kill it.  This can be done by right clicking on the dock and using force quit or via command line with kill.

So my purpose in writing this post is because I have been maxing out memory usage on my macbook with 4gb in the past few months.  I am working to adjust my usage for a more stable operating system environment until I can make a switch up to a 8gb mbp this year.  To keep a closer eye on my usage I pinned Activity Monitor to my dock and found you can right click on it and change the dock icon to a pie chart of your memory usage in real time.  Do this by right clicking on activity monitor on your dock -> dock icon -> show memory usage.

Screen shot 2010-01-04 at 11.10.23 PM

There are also dock icons for CPU usage, network usage, and disk activity.  This is just one way example of how osx provides a quick easy way to keep a close eye on your usage out of the box.  Pretty awesome.

Followup 5/31/2010
Apple has an article here that explains the different types of mem usage in OSX.
Free (Green):  RAM not being used, that has never been allocated
Wired (Red):   Info in memory that cant be transferred to the hdd
Active (Yellow):  Info currently in memory that has been recently used
Inactive (Blue):   Info in memory not actively being used, but was recently used.  This ‘space’ of your memory is available for use by any application.  It allows for recently ran applications to re-launch faster because it is taking the recently used bits and converting to Active memory.

How to change the color and format of your bash prompt

I was recently asked how to change the color on the bash prompt so I put together this article

Here is your bash prompt in all its glory

root@server1 [~]#

# is for root access
$ is for user access

Display the current environment variable (PS1)

root@server1 [~]# echo $PS1
\u@\h [\w]#

PS1 is our bash shell environment variable

By default the command prompt above is set to \u@\h [\W]# This will vary on different distros of Linux

\u : Display the username
\h : Display the hostname
[\W] : Print the current working directory in [ ]’s

Variable list
\a The ASCII bell character (you can also type \007)
\d Date in “Wed Sep 06” format \e ASCII escape character (you can also type \033)
\h First part of hostname (such as “mybox”)
\H Full hostname (such as “mybox.mydomain.com”)
\l The name of the shell’s terminal device (such as “ttyp4”)
\j The number of processes you’ve suspended in this shell by hitting ^Z
\n Newline \r Carriage return \s The name of the shell executable (such as “bash”)
\t Time in 24-hour format (such as “23:01:01”)
\T Time in 12-hour format (such as “11:01:01”)
\@ Time in 12-hour format with am/pm
\u Your username
\v Version of bash (such as 2.04)
\V Bash version, including patchlevel
\w Current working directory (such as “/home/user”)
\W The “basename” of the current working directory (such as “mkahn”)
\! Current command’s position in the history buffer
\# Command number (this will count up at each prompt, as long as you type something)
\\$ If you are not root, inserts a “$”; if you are root, you get a “#”
\xxx Inserts an ASCII character based on three-digit number xxx (replace unused digits with zeros, such as “\007”)
\\ A backslash
\[ This sequence should appear before a sequence of characters that don’t move the cursor (like color escape sequences). This allows bash to calculate word wrapping correctly.
\] This sequence should appear after a sequence of non-printing characters.

Add colors to the prompt
Colors are selected by adding special sequences to PS1 — basically sandwiching numeric values between a “\e[” (escape open-bracket) and an “m”. If we specify more than one numeric code, we separate each code with a semicolon.
\e0;31m – red non bold
\e1;31m – red bold

\e[0m – reset the colors to default values (black and white)

Color codes
Black 0;30 Dark Gray 1;30
Blue 0;34 Light Blue 1;34
Green 0;32 Light Green 1;32
Cyan 0;36 Light Cyan 1;36
Red 0;31 Light Red 1;31
Purple 0;35 Light Purple 1;35
Brown 0;33 Yellow 1;33
Light Gray 0;37 White 1;37
Replace digit 0 with a 1 to get a bold version

Replace 0 digit with 40 (black), 41 (red), 42, (green), 43 (yellow), 44 (blue), 45 (purple), 46 (cyan), 47 (light gray) background color (highlight).

Red color prompt
export PS1="\e[0;31m[\u@\h \w]\\$ \e[0m"

Green color prompt
export PS1="\e[0;32m[\u@\h \w]\\$ \e[0m"


Modify the current bash prompt to display user@full hostname and working directory with time

Setup a new shell prompt:
root@server1 [~]# export PS1="\u@\H [\w] \T \$ "
root@server.mybox.com [/home/myfolder] 01:07:57 $

Explained
PS1 : Current bash prompt
\u : Display the username
@ : @ sign after username
\H : Display the full hostname
[\w] : Display the current working directory in [ ]’s
\T : Display the time in 12 hr format
\$ : display hash


Making it stick

The command ran before were just for that session, when you login it will be lost. If you would like to make this BASH shell modification permanent add the export command to your .bash_profile or .bashrc file

vi .bashrc

.bash_profile (osx) and .bashrc (Linux)
use pico or nano if you do not know how to use vi

Add export line before fi
export PS1="\e[0;31m[\u@\h \w]\\$ \e[0m"

Save and close the file
Now you have a cool modified bash shell prompt


Examples

xmas bash prompt1
export PS1="\e[1;32m[\u@\h \e[1;31m\\w\e[1;32m]\$ \e[m"

xmasprompt1
xmas bash prompt 2
export PS1="\e[42;31m[\u@\h \w]\$ \e[m"

xmasprompt2

hanukkah bash prompt
export PS1="\e[0;34m[\u\e[0;34m@\h[\e[0;33m\w\e[0m\e[0m\e[0;34m]#\e[0m "

hanukkahprompt

the matrix
export PS1="\e[0;32m\u@\h [\w]# "

matrix

personal
export PS1="\e[0;32m\u\e[0m\e[0;36m@\e[0m\e[0;34m\h \e[0m\e[0;36m\w \e[0m# "

personalprompt

sources: http://www.pantz.org/software/shell/enhancingshellprompt.html