Skip to content

Instantly share code, notes, and snippets.

View donigian's full-sized avatar

armen donigian donigian

  • Jet Propulsion Labratory
  • Pasadena
View GitHub Profile
@donigian
donigian / Python MapReduce
Created June 19, 2012 06:25
Writing Python MapReduce code for Hadoop
In order to develop in a language other than JAVA, we need to use HadoopStreaming to pass data between Map and Reduce code via STDIN (standard input) and STDOUT (standard output). We can use Python’s sys.stdin to read input data and print our own output to sys.stdout. That’s all we need to do because HadoopStreaming will take care of everything else!
Run the MapReduce job
hduser@ubuntu:/usr/local/hadoop$ bin/hadoop jar contrib/streaming/hadoop-*streaming*.jar -file /home/hduser/mapper.py -mapper /home/hduser/mapper.py -file /home/hduser/reducer.py -reducer /home/hduser/reducer.py -input /user/hduser/babalu/* -output /user/hduser/babalu-output
@donigian
donigian / pythonbrew-upNrunning
Created June 21, 2012 07:13
pythonbrew: Get up & running
pythonbrew is a program to automate the building and installation of Python in the users $HOME.
This is a clean way to install/manage multiple versions of python.
1. curl -kL http://xrl.us/pythonbrewinstall | bash
2. add to the end of your ~/.bashrc:
[[ -s $HOME/.pythonbrew/etc/bashrc ]] && source $HOME/.pythonbrew/etc/bashrc
3. pythonbrew install 2.7.2, pythonbrew install 3.2
@donigian
donigian / Book Notes The Art of Public Speaking
Created June 24, 2012 02:33
Book Notes from Books I've Read
Lessons of public speaking from Patrick Henry
1. Use your voice and body to reinforce your message
2. Always match voice & movement to specific words / motions
3. At first, mark tone and gestures as text
4. Establish & maintain eye contact with audience
5. Smile
Lessons of public speaking from Will Rogers.
1. First laugh at yourself, then others.
@donigian
donigian / Social Data API for socialweb hacking
Created June 24, 2012 03:36
Social Data APIs I've used
Twitter API
https://dev.twitter.com/docs
@donigian
donigian / Git Cookbook
Created June 24, 2012 17:23
Common Git commands used for my projects
github setup
cd project_dir
git init
git add .
git commit -am 'initial commit'
git log
git remote add origin https://github.com/donigian/Hello-World.git
# Creates a remote named "origin" pointing at your GitHub repo
@donigian
donigian / Notes on Game Theory
Created June 24, 2012 18:06
Notes on Game Theory
Any strategy which involves change is called a Pure Strategy, otherwise Mixed Strategy.
Game is composed of 3 things:
players
strategies
payoffs
Strategy:
Rational Decision Making
A lot of times, the decision you do make are based on the consequences of the decisions we don't make.
@donigian
donigian / Java Glassfish 411
Created June 28, 2012 04:30
Java Glassfish Commonly Used Commands
to start a web service
as-install/bin/asadmin start-domain
to list running web services
as-install/bin/asadmin list-domains
to stop a web service
as-install/bin/asadmin stop-domain
source: http://docs.oracle.com/cd/E18930_01/html/821-2432/toc.html
@donigian
donigian / macport Common Commands
Created July 4, 2012 07:07
macport Common Commands
source http://guide.macports.org/
install port
sudo port install nmap
search port
port search bestever
@donigian
donigian / gist:3051551
Created July 5, 2012 05:29
Making Yourself Irreplaceable: Most Valuable Activities
To make yourself irreplaceable, you want to understand which of your activities are the most valuable. When you spend the majority of your time on activities that bring the most to
the business' bottomline, you're making yourself irreplaceable.
Your most valuable activities are the things you do that are worth the most per hour.
Your success at work depends in large part on your ability to be selective with your activities.
The question is, what's one thing I can do to make your job easier for you?
If you need help coming up with an hourly rate try taking what you think an annual salary for this position would be and divide it by 2080, which is 52 weeks in a year and 40 hours a week.
@donigian
donigian / gist:3051847
Created July 5, 2012 06:42
Google Python API Docs
Google Python API Docs
http://api-python-client-doc.appspot.com
python
>>> from apiclient.discovery import build
>>> service = build("prediction", "v1")
Get help on the service, or a collection, or a method on a collection:
>>> help(service)
>>> help(service.training())