Friday, June 7, 2013

Cygwin custom prompt


The next information is taken from (http://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html) it is not mine. trying to fix my prompt in a new machine that doesn't show up anything, not even the folder where it is i found this:
Prompt is control via a special shell variable. You need to set PS1, PS2, PS3 and PS4 variable. If set, the value is executed as a command prior to issuing each primary prompt.
  • PS1 - The value of this parameter is expanded (see PROMPTING below) and used as the primary prompt string. The default value is \s-\v\$ .
  • PS2 - The value of this parameter is expanded as with PS1 and used as the secondary prompt string. The default is >
  • PS3 - The value of this parameter is used as the prompt for the select command
  • PS4 - The value of this parameter is expanded as with PS1 and the value is printed before each command bash displays during an execution trace. The first character of PS4 is replicated multiple times, as necessary, to indicate multiple levels of indirection. The default is +

How do I display current prompt setting?

Simply use echo command, enter:
$ echo $PS1Output:
\\u@\h \\W]\\$

How do I modify or change the prompt?

Modifying the prompt is easy task. Just assign a new value to PS1 and hit enter key:
My old prompt --> [vivek@105r2 ~]$
PS1="touch me : "
Output: My new prompt
touch me : 
So when executing interactively, bash displays the primary prompt PS1 when it is ready to read a command, and the secondary prompt PS2 when it needs more input to complete a command. Bash allows these prompt strings to be customized by inserting a number of backslash-escaped special characters that are decoded as follows:
  • \a : an ASCII bell character (07)
  • \d : the date in "Weekday Month Date" format (e.g., "Tue May 26")
  • \D{format} : the format is passed to strftime(3) and the result is inserted into the prompt string; an empty format results in a locale-specific time representation. The braces are required
  • \e : an ASCII escape character (033)
  • \h : the hostname up to the first '.'
  • \H : the hostname
  • \j : the number of jobs currently managed by the shell
  • \l : the basename of the shell’s terminal device name
  • \n : newline
  • \r : carriage return
  • \s : the name of the shell, the basename of $0 (the portion following the final slash)
  • \t : the current time in 24-hour HH:MM:SS format
  • \T : the current time in 12-hour HH:MM:SS format
  • \@ : the current time in 12-hour am/pm format
  • \A : the current time in 24-hour HH:MM format
  • \u : the username of the current user
  • \v : the version of bash (e.g., 2.00)
  • \V : the release of bash, version + patch level (e.g., 2.00.0)
  • \w : the current working directory, with $HOME abbreviated with a tilde
  • \W : the basename of the current working directory, with $HOME abbreviated with a tilde
  • \! : the history number of this command
  • \# : the command number of this command
  • \$ : if the effective UID is 0, a #, otherwise a $
  • \nnn : the character corresponding to the octal number nnn
  • \\ : a backslash
  • \[ : begin a sequence of non-printing characters, which could be used to embed a terminal control sequence into the prompt
  • \] : end a sequence of non-printing characters
the SP1 value is stored in /etc/bash.bashrc at first i didn't have that file so i just copy the one in my other machine and it worked perfect. here is the file:


# To the extent possible under law, the author(s) have dedicated all 
# copyright and related and neighboring rights to this software to the 
# public domain worldwide. This software is distributed without any warranty. 
# You should have received a copy of the CC0 Public Domain Dedication along 
# with this software. 
# If not, see

# base-files version 4.1-1

# /etc/bash.bashrc: executed by bash(1) for interactive shells.

# The latest version as installed by the Cygwin Setup program can
# always be found at /etc/defaults/etc/bash.bashrc

# Modifying /etc/bash.bashrc directly will prevent
# setup from updating it.

# System-wide bashrc file

# Check that we haven't already been sourced.
([[ -z ${CYG_SYS_BASHRC} ]] && CYG_SYS_BASHRC="1") || return

# If not running interactively, don't do anything
[[ "$-" != *i* ]] && return

# Set a default prompt of: user@host and current_directory
PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '

# Uncomment to use the terminal colours set in DIR_COLORS
# eval "$(dircolors -b /etc/DIR_COLORS)"

Friday, May 31, 2013

Enabling DISPLAY environment variable for X11 forwarding from cygwin


I want to do this so I can forward commands to gnuplot from a shell script i have on cygwin, the steps where taken from the web[1,2].

Make sure you have the x11 packages installed in your cygwin and go to step 3, if not start from 1
  1. Run the Cygwin installer (You can obtain cygwin from here: http://www.cygwin.com/setup.exe
  2. At the package list, select to install all packages that are under the X11 category. Click next, accept all the dependencies, and install.
  3. In the  Cygwin shell, run startxwin  
  4. In your Cygwin shell, run export DISPLAY=:0.0.
You'll need to repeat step 3 every time you reboot your computer, and step 4 every time you open a new Cygwin shell (or just run echo "export DISPLAY=:0.0" >>~/.bash_profile to have it run automatically whenever you create a new shell).

Ref: 1, 2

Thursday, October 11, 2012

Finally Approved to work in the Molecular Foundry


Even though i had all the required training i was told only to work under the supervision of somebody while preparing my samples for the LC/MS, and i wasn't authorized to run the machine at all. Today i got the LC/MS training, that was pretty much like do what you already know, and sign this piece of paper. Just like that now i can just walk in to the machine and magically load my sample...ehhh.

This is the look of the Molecular Foundry in the back side of the Berkeley Lab.

 The hall of fame of all the authorized users, my picture is from April 13, but i just got really authorized.
 and this is a zoom in of my pic in the lower part of the hall of fame.

Tuesday, August 28, 2012

Looking for Graduate programs

This is what happen when you have over 50 internet web pages open looking for graduate programs to apply to, it is quite surprising that my computer died under this very low conditions but it must be a windows issue, again, i'm going to install Ubuntu as my regular OS and let Windows only for video games and final versions of my documents in Word. Last time I spent so many time trying to have the GPU working on Ubuntu but i couldn't, that was the reason to install Windows, because the initial idea was to have an only Ubuntu machine, now back to the hybrid.

Saturday, July 28, 2012

Berkeley Kite Festival

From now on this blog is turning into English, this is not my mother language so i might have tons of errors, taking in account that i only write for 15 min or less and not spend too much time going over what i just wrote, this change is motivated by a couple of reasons and i hope whoever read this have the ability to understand, if not just enjoy the pictures.

Today took place one of the biggest kite festivals in the entire US, Berkeley is the host city and the Cesar Chaves Park the place to go. I was really waiting this event to happen and it finally did, i really like to watch and fly kites, every year in my hometown Bogotá, we have a month where always is windy, hi speed winds that allows people to fly kites every day on August and as a citizen i enjoyed quite a lot going to the outer towns and fly my kite with all my family, it is usually a 6 to 8 car trip.

Having that background in mind i really wanted to go there and watch with my own eyes this giants taking over the skies of Berkeley, they are so big that even from my house window i could see them.



I went and took pictures of almost every kite i liked but my favorite is this Dragon, it is simply the best, have a really good mixture between a 3D kite, a delta wing and a multiple rope, not forget the tail to balance on the wings and the magnificent paint job, i was really amazed by this one.

If you want to check out all of the pictures just follow this link: BerkeleyKiteFestival2012  

Saturday, July 14, 2012

Paracaidismo (Sky Diving)

Es realmente una sensación única, hay que hacerlo para saber de que se trata y definitivamente vale la pena, siempre había pensado en hacerlo, pero nunca pensé que fuera tan de repente y sin planearlo, se trataba principalmente de ir a ver saltar a Linda pero terminó siendo verla desde el avión montado listo para saltar también.

Durante el periodo de espera hay que firmar unos documentos donde básicamente cada persona se hace responsable de su vida y libera de toda obligación a la agencia, algo atemorizante tan solo pensar que se esta jugando la vida en ese instante, a pesar de eso, permanecí bastante calmo incluso dentro del avión cuando estábamos subiendo a 13000 pies de altura para lanzarnos, simplemente disfruté del paisaje.

Justo en el momento de pararse en la puerta es cuando uno dice jueputa! aquí fue, no hay marcha atrás y ya que carajooooo!... Después de ese momento de culillo llega lo mejor de todo, la sensación de estar suspendido en el aire con la tierra debajo de nosotros, viajando a tal velocidad que muchas personas se les mueven las mejillas por el aire, todo pensamiento negativo se elimina y uno se concentra en disfrutar -a pesar que aun no se esta a salvo- la vista que es magnifica y la sensación única, creo que no pare de sonreír durante todo el viaje, genial experiencia. 





Tuesday, March 6, 2012

La última cena con David, Nahuel y Ceci -por ahora-

No eramos 12, pero si suficientes como para tener una gran última cena juntos, que mejor sitio que Triple Rock, el bar favorito de los jueves por David, que ademas sirven unas hamburguesas que dan miedo, super buenas!.

Para la muestra un boton, la famosisima "Avalanche" -espero que el nombre no sea por lo que viene despues- 1/2 libra de carne en cada una, papas fritas con queso, chile -chilli como sea, basicamente frijoles-, tacos fritos, aguacate, ensalada, tomate, cebolla, lechuga -no se por qué siempre lo ponen afuera-, y dos cuchillos super gigantes que le terminan de dar a este plato su apariencia de rompe barrigas.

Un par de cervezas, en mi caso una llamada "Dragon's milk" -espero no sea literal-, y dos personajes haciendo mis caras de foto, yo solo pude reírme de estos dos.

Junto con nosotros compartian mesa Ceci, Camilo y los compañeros del Lab de David.



Resultados: una noche con sabor agridulce, no por la comida, más por la partida, y una barriga que terminó no estando tan llena como se le prometió a través de los ojos con semejante plato, de todas formas es una cena pesadita que un par de horas después ya se sentía.

Gracias chicos por todo!  -de seguro más adelante habrá alguna otra, de hecho estoy con un asado en mi lista de deudas-