Bash settings

Occasionally I need to update my .bashrc file and every time I google for information on how to do different things. These are some more common things I end up putting into my .bashrc that I’ve found while googling.

#Common alias
alias ...='cd .. ; cd ..'
alias ..='cd ..'
alias _='cd -'
alias cls='clear'
alias fh='history | grep $1' #Requires one input
alias grep='grep --color'
alias h='history'
alias home='cd ~'
alias la='ls -allh'
alias ll='ls -allh'
alias ls='ls --color'
 
# the bash history should save 3000 commands
export HISTFILESIZE=3000
 
#Aliases for handling tarballs
alias zls='tar -tzf $1' #ls a tarball
alias ztr='tar -czvf $1 $2' #create a tarball
alias zun='tar -xzvf $1' #extract a tarball
 
#JAVA Settings
export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun-1.5.0.18/
export PATH=$JAVA_HOME/bin:$PATH
 
#GIT Settings
alias g='git'
alias ga="git add"
alias gb='git branch --verbose'
alias gc='git commit --verbose'
alias gca='git commit --verbose --all'
alias gcaa='git commit --verbose --amend --all'
alias gco="git checkout"
alias gd='git diff --ignore-space-change'
alias gdc='git diff -M -w --color-words'
alias gk='gitk &'
alias gl='git log'
alias glf='git log --pretty=format:%Cred%h\ %Cgreen%an%Cblue\ %s'
alias glp='gl --pretty=oneline'
alias gm="git merge"
alias gs='git status'
alias gst="git stash"
alias gull='git pull'
alias gush='git push'
MYNAME=''
MYEMAIL=''
export GIT_AUTHOR_NAME=$MYNAME
export GIT_AUTHOR_EMAIL=$MYEMAIL
export GIT_COMMITTER_NAME=$MYNAME
export GIT_COMMITTER_EMAIL=$MYEMAIL
 
#Use git completion if available
if [ -f ~/.git-completion.bash ]; then
source ~/.git-completion.bash
fi
 
#Prompt - with git branch
export PS1='\[\033[01;31m\]\u@\h [\d \t] \[\033[01;34m\]\W\[\033[00m\]\[\033[01;33m\]`git branch 2&> /dev/null|cut -f2 -d\* -s`\[\033[00m\]\n$ '
 
#Indent functions
#using Kernighan Richie style (user space code)
function indent_check_single_file()
{
echo "Running indent on: $PWD$(echo $* |cut -b 1 --complement)"
indent -kr -di24 --no-tabs $* -o /tmp/indent.tmp
diff $* /tmp/indent.tmp
rm /tmp/indent.tmp
}
 
function indent_check_recursive()
{
for k in $(find -name \*.c -o -name \*.h);do
   indent_check_single_file $k
done;
}

A makefile template

The following is a template for the core of a makefile that uses selected parts of the gnu make conventions which I’ve been using more frequent.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
SHELL = /bin/sh
.SUFFIXES:
.SUFFIXES: .c .o
 
#Package
pkg_name =
pkg_version = 1.0
 
CFLAGS = -g
ALL_CFLAGS = -I. $(CFLAGS)
CPPFLAGS =
 
INSTALL = install
INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = ${INSTALL} -m 644
 
#Two root variables for the installation
prefix = /usr/local
exec_prefix = $(prefix)
 
#Executable programs are installed in one
#of the following directories.
bindir = $(exec_prefix)/bin
sbindir = $(exec_prefix)/sbin
libexecdir = $(exec_prefix)/libexec/$(pkg_name)
 
#Data files are installed in one of
#the following directories.
datarootdir = $(prefix)/share
datadir = $(datarootdir)
sysconfdir = $(prefix)/etc
sharedstatedir = $(prefix)/com
localstatedir = $(prefix)/var
 
includedir = $(prefix)/include
oldincludedir = /usr/include
docdir = $(datarootdir)/doc/$(pkg_name)
libdir = $(exec_prefix)/lib
$(srcdir) =
 
#Targets for Users
 
#All is the default target.
#Purpose : to compile the entire program.
all:
 
#Install target.
#Purpose : to install the program.
#1) compile the program,
#2) copy the executables, libraries, and so on
#   to the file names where they should reside
#   for actual use and
#3) verify that a program is properly installed.
install: all
 
#Uninstall target.
#Purpose : to delete all the installed files,
#i.e. the copies that the ‘install’ and
#‘install-*’ targets create.
uninstall:
 
#Clean target.
#Purpose : to delete all files in the current
#directory (or created by this makefile) that
#are normally created by building the program.
#Don't delete the files that record the configuration.
clean:
 
#Distclean target.
#Purpose : to delete all files in the current
#directory (or created by this makefile) that
#are normally created by building or configuring
#the program. Only the files that were in the
#distribution should remain.
distclean: clean
 
#Dist target
#Purpose : to create a distribution tar file
#for this program.
#1) Create a subdirectory appropriately named
#   (e.g. $pkg-name)-$(pkg-version),
#2) install the proper files in it,
#3) tar that subdirectory and
#4) Compress the tar file e.g. with gzip.
dist:
 
#Check target.
#Purpose : to perform self-tests.
check: all
 
#Installcheck target.
#Purpose : to perform installation tests.
installcheck : all install
 
#Installdirs target.
#Purpose : to create the directories where
#files are installed, and their parent directories.
installdirs :

Ending my assignment at ST-Ericsson

Today I have informed my manager at ST-Ericsson that I do not intend
to prolong my current contract with ST-Ericsson.

It has been an very interesting 2,5 years with the Platform Security
section at ST-Ericsson in Lund. I’ve been working with a wide
variation of tasks within software engineering, experienced the merger
and birth of ST-Ericsson and the new colleges that comes with it. But
the time has come for me to take another step in my career.

After 1,5 years of half time studies for a masters degree in business
and administration (MBA) I’m now writing a thesis as the final part of
the masters program. By not prolonging my current contract with
ST-Ericsson, I’ll make sure that I get the required time to finish the
thesis, and MBA program, in time. Once my studies are done in end of
May / early June I will search for a new assignment where I hopefully
can use my new found knowledge.

My last day at ST-Ericsson will be on the 31th of March.

What are your strengths? These are my strengths…

Roughly one year ago I bought StrengthsFinder 2.0 by Tom Rath. By buying the book I was entitled to a online assessment to identify my personal strengths which, of course, I did. Last week I found the result from the online assessment lying in a drawer.

So, according to the assessment these are my five top strength themes.
– Arranger
– Futuristic
– Individualization
– Responsibility
– Learner

But what does each of these mean? How well do they concur with my own perception of myself?
This is how StrengthsFinder 2.0 defines these topics

Arranger
”People who are especially talented in the Arranger theme can organize, but they also have a flexibility that complements this ability. They like to figure out how all of the pieces and resources can be arranged for maximum productivity”.

Futuristic
”People who are especially talented in the Futuristic theme are inspired by the future and what could be. They inspire others with their visions of the future”.

Individualization
”People who are especially talented in the Individualization theme are intrigued with the unique qualities of each person. They have a gift for figuring out how people who are different can work together productively”.

Responsibility
”People who are especially talented in the Responsibility theme take psychological ownership of what they say they will do. They are committed to stable values such as honesty and loyalty”.

Learner
”People who are especially talented in the Learner theme have a great desire to learn and want to continuously improve. In particular, the process of learning, rather than the outcome, excites them”.

Overall I must say that these strengths concur pretty well with my own perception of myself. I do want to continuously improve and learn. I do take responsibility for my actions. I try to be a visionary. I always think of how to organize for maximum productivity given the available resources. But it is not my perception of myself that matters, it is everyone else perception of me that really matters. I can only hope that I’m perceived to have these strengths.

The assessment report included 50(!) action proposals that will help me to apply my strengths. Next step is definitely to read them and maybe carry our some of them.

Do you want to know your personal strengths? Do the test! I can only recommend it!

Upgrading to a premium Lastpass account

I got introduced to @LastPass not too long ago, but I’ve been sceptic
to store all my password in one place.
@Jyxxan sent me the following great podcast by @SGgrc and I’ve now
signed up for a premium account!