Saturday, July 19, 2014

Simple way to make bash script configurable

In order to simplify testing, I needed to make a bash script configurable. 
Yes bash is quite convenient to archive some tasks. 
I had trouble finding the syntax to override environment variable.

Here is a simple way to make to do it:

  • set default environment variables (recommendation = pointing to stable code)
  • make override config file a parameter 
  • add this to make config override working (config is argument 4):

# check override configuration
if [ ! -z $4 ]
then
    echo "load config file:" $4
    source $4
else
    echo "default config (stable branch)"
fi

for VARIABLE in PYTHON INPUT OUTPUT
do
    eval var=\\$VARIABLE
    [ -z ${!var} ] && { echo "Need to set $VARIABLE"; exit 1; }
    echo $VARIABLE":"${!var}
done

example override_config.sh:
PYTHON=/work/fpieraut/py27/bin/python

Yes the syntax is a little cryptic but that is the only way I found to make is working;)
Btw, this isn't working in sh (calling source to set variables). 


Share on Reddit!!!

Monday, July 7, 2014

which and alias: which doesn't consider aliases......use type not which

Have you notive that "which cmd" doesn't give your alias path if cmd is in your aliases?

Aliases are checked before paths when you try to run a cmd in a prompt but which doesn't consider aliases. Which search for the cmd in your paths. If cmd is in your path, you will be confused and you might turn crazy as I close did.

Use type instead of which.

usage: which [options] [--] COMMAND [...]
             Write the full path of COMMAND(s) to standard output.

usage: type [-aftpP] name [name ...]
With no options, indicate how each name would be interpreted if used as a command name
Share on Reddit!!!

Monday, June 16, 2014

The revenge of the close architecture (Apple success = the black box model for B2C)

Most people are expecting Apple slow decline since Steve Jobs died. Basically, history will repeat itself : microsoft vs apple and now android vs iphone. Open architecture will win again against close architecture.


I am not so sure and here is why: 
  • Apple is fundamentally B2C
  • C want stuff that works, real plug and play. Average Joe don't really care if its not an open architecture like microsoft and android. Average Joe want stuff that works straight away. 
  • Increase of complexity (ISP/wifi/driver/software/configuration/....) + new businesses in tech support like http://www.radialpoint.com/

The black box model says basically that at a level of complexity, we are no longer able to understand increasingly complex explanation (stack of layers of abstractions). Basically, in the future, it will be the norm to convince people with images and emotions rather than arguments

Close architecture has the major advantage of keeping thing simple which is becoming more and more relevant in this techno world. Open architecture is for geeks and businesses.  

=

Here is the black box model as expose in "the decision book:50 decision models".  







Share on Reddit!!!

What you shouldn't forget about transition to leadership

Here are the 2 most important concepts of transition to leadership:




I do recommend you take some time to read "the decision book:50 decision models".  

You will learn about: 
-HOW TO IMPROVE YOURSELF
-HOW TO UNDERSTAND YOURSELF BETTER
-HOW TO UNDERSTAND OTHERS BETTER
-HOW TO IMPROVE OTHERS

"The key to successful leadership today is influence, not authority." --Ken Blanchard


CONTENTS
Cover Title Page
Instructions for use
HOW TO IMPROVE YOURSELF
The Eisenhower matrix: How to work more efficientiy
The SWOT analysis: How to find the right solution
The BCG box: How to evaluate costs and benefits
The project portfolio matrix: How to maintain an overview
The John Whitmore model: Am Ipursuing the right goal?
The rubber band model: How to deaf with a dilemma
The feedback model: Dealing with other people's compliments and criticisms
The family tree model: The contacts you shouid maintain
The morphological box and SCAMPER: Why you have to be structured to be creative
The Esquire gift model: How much to spend on gifts
The consequences model: Why it is important to make decisions prompt/y
The conflict resolution model: How to resolve a conflict elegantly
The crossroads model: So what next?
HOW TO UNDERSTAND YOURSELF BETTER
The flow model: What makes you happy?
The Johari window: What others know about you
The cognitive dissonance model: Why people smoke when they know it's unhealthy
The music matrix: What your taste in music says about you
The unimaginable model: What do you believe in that you cannot prove?
The Uffe Elbaek model: How to get to know yourself
The fashion model: How we dress
The energy model: Are you living in the here and now?
The SuperMemo model: How to remember everything you have ever learned
The political compass: What political parties stand for
The personal performance model: How to recognise whether you should change your job
The making-of model: To determine your future. first understand your past
The personal potential trap: Why it is better not to expect anything
The hype cycle: How to identify the next big thing
The subtle signals model: Why nuances matter E The network taraet model: What vour friends sav abo
The network target model: What your friends say abo'Ut you
The superficial knowledge model: Everything you don need to know
HOW TO UNDERSTAND OTHERS BETTER
The Swiss cheese model: How mistakes happen
The Maslow pyramids: What you actually need. what you want
Thinking outside the box: How to come up with brilliant ideas
The Sinus Milieu and Bourdieu models: Where you belong
The double-loop learning model: How to learn from your mistakes
The Al model: What kind of discussion type are you?
The small-world model: How arm” the world really is
The Pareto principle: Why 80 per cent of the output is achieved with 20 per cent of the input
The long-tail model: How the internet is transforming the economy
The Monte Carlo simulation: Why we can only approximate a definitive outcome
The black swan model: Why your experiences don make you any wiser
The chasm - the diffusion model: Why everybody has an iPod
The black box model: Why faith is replacing knowledge
The status model: How to recognise a winner
The prisoner's dilemma: When is it worth trusting someone?
HOW TO IMPROVE OTHERS
The Drexler-Sibbet team pedormance model: How to turn a group into a team
The team model: Is your team up to the job?
The gap-in-lhe-market model: How to recognise a bankabfe idea
The Hersey—Blanchard model (situational leadership): How to successfully manage your employees
The role-playing model: How to change your own point of view
The result optimisation model: Why the printer always breaks down just before a deadline
The world's next top model
NOW IT'S YOUR TURN Drawing lesson 1 Drawing lesson 2
My models
APPENDIX Bibliography Illustration credits Final note Thanks
The authors

Share on Reddit!!!

Monday, June 2, 2014

The big data trap


You don't want to fall into the big data trap, those slides are for you:



Main points:

  • Big Data = Small Data + IO bound
  • Big data->Data->Analytics->Mining->Predictive
  • Data Quality = BIGGEST PROBLEM
  • Big Data = another barrier of entry
  • Big data trap = no KPI
  • KISS = real time data mining


Big data trap slides: http://www.slideshare.net/fpieraut/big-data-trap-35415482
Share on Reddit!!!

Big data, just another barrier of entry


On may 8th, I have been invited to speak at the BIG DATA week in Montreal. I spoke about "Big data, just another barrier of entry".

It is critical to understand the maturity levels.
Key points:

  1. People/business care about knowledge and action not data
  2. garbage in/garbage out -> YOU NEED TO QA your data + avoid log path (dump)
  3. Big data = small data + IO bounded
  4. Big data market = startups & enterprises
  5. big data->data->analytics->mining->predictive
  6. DATA qty = biggest problem
  7. Big data = just another barrier of entry

Slides: http://www.slideshare.net/fpieraut/big-data-barrier-of-entry

Share on Reddit!!!

Friday, May 2, 2014

Looking for a simple way to add columns based on the other ones?

Are you looking for a simple way to add columns based on some other ones?
Let's say you want to add the column C where C=A+B?
you can do cat *.tsv | ./coladd.py -a C=A+B

if you do add more fields, separate your equations with ',' like this:
cat *.tsv | ./coladd.py -a C=A+B, D=(A/C)

eval() and csv.DictReader have been leveraged to achieve this task.
code: coladd.py

Share on Reddit!!!