My Low Cost Aerial Photography Setup with DJI Phantom 2 & Gopro Hero 3+

I’m a photography amateur or enthusiast. No kidding! Guess what’s the most appealing thing for me? Catching a great view from the perfect angle or from an unusual angle. You know what I am saying, from the sky! We all know that it could be very costy to rent a real helicopter for photo or video shooting. However, the recent development in quadcopter (AKA drone) and sport camera technologies shed some light for us budget-tight photographers.

What should be included in the flying camera system? I think I need a flying platform with certain lift power, a light but powerful camera, camera stabilizer and FPV kit. And here is my solution:
1. DJI Phantom 2 (Quadcopter only), $679
2. Gopro Hero 3/3+, $199-$399
3. Feiyu G3 brushless gimbal for Gopro Hero 3/3+, $200
4. 5.8GHz 200mw FPV transmitter, about $30
5. Feelworld 7-inch monitor with built-in 5.8GHz FPV receiver, $98

2014-03-06 16.23.00

DJI Phantom 2 with Feiyu G3 Gimbal

2014-03-06 16.24.19

bottom view of G3 gimbal and 5.8GHz transmitter

2014-03-06 16.28.22

G3 Gimbal and FPV transmitter closeup

I choose Phantom 2 plus Feiyu G3 over the Phantom 2 & Zenmuse Gimbal bundle because the G3 gimbal has an interesting and handy accessory transforming the flying gimbal into a hand-held gimbal. It’s the feature everyone who want to shoot video not only from the sky but also personally on the ground.

Quadcopters are amazing. But not all of them are born equal. Before hugging the DJI Phantom 2, I also tried aerial photography on an AR Drone 2.0. Unfortunately, the AR Drone doesn’t make a good photography platform even though it makes a good toy or hobby. The lift power of AR Drone is so limited that you will meet severe jello problem, difficulty in control, and  unpredictable crashes even carrying a light-weight camera like a Gopro Hero 3+. For you curiosity, you might want to check my youtube videos for using AR Drone w/ Gopro:
Due to the down-facing camera and ultrasound module, I have to load the gopro camera on the nose of the copter. But this makes a unbalanced copter:

No wonder, It crashes:

Even though it looks cool sometimes:

(Just started. To be continued)

Vim for Python, Html, and more

1. Create directory: ~/.vim/ftplugin/ (in UNIX-like systems)
2. For python, create file: ~/.vim/ftplugin/python.vim, and add the following lines:
setlocal tabstop=4
setlocal softtabstop=4
setlocal shiftwidth=4
setlocal textwidth=80
setlocal smarttab
setlocal expandtab

3. For html, create file: ~/.vim/ftplugin/html.vim, and add the following lines:
setlocal tabstop=4
setlocal softtabstop=4
setlocal shiftwidth=4
setlocal smarttab
setlocal expandtab

4. In order to enable ftplugin in vim, modify the following line in the file “vimrc” from your system
filetype plugin on

[SHARE]The 5-minute Guide to C Pointers

This is a good post (by DENNIS KUBES) talking about C pointers and addresses issues. See the original post.


Pointers, Addresses and Dereferencing

What is a pointer? What is a memory address? What does dereferencing a pointer mean?

A pointer is a variable that holds the location of, literally the address-of, a variable stored in computer memory. An address is the actual address-of a variable in the computer memory. Dereferencing a pointer means getting the value stored in the memory at the address which the pointer “points” to.

The * is the value-at-address operator, also called the indirection operator. It is used both when declaring a pointer and when dereferencing a pointer. I will show why it is helpful to read it as the value-at-address operator in the code below. When we talk about getting the value-at-addess of the pointer we are talking about getting the value stored in the memory at the address which the pointer “points” to.

The & is the address-of operator and is used to reference the memory address of a variable. When we declare a variable, three things happen. One, computer memory is set aside for the variable. Two, The variable name is linked to that location in memory. And three, the value of the variable is placed into the memory that was set aside. By using the & operator in front of a variable name we can retrieve the memory address-of that variable. It is best to read this operator as address-of and we will show why below.

Take the following code which shows some common notations for the value-at-address (*) and adress-of (&) operators.

// declare an variable ptr which holds the value-at-address of an int type
int *ptr;
// declare assign an int the literal value of 1
int val = 1;
// assign to ptr the address-of the val variable
ptr = &val;
// dereference and get the value-at-address stored in ptr
int deref = *ptr;
printf("%d\n", deref);

If you take line 2 it reads a “declare a variable that points to the value-at-addess of an int type”. In other words declare a variable that holds a memory address where the value-at that memory address is a int. Line 4 we declare an int variable and assign it the literal value 1. Line 6 reads assign to the ptr pointer variable the address-of the variable val. This isn’t the value of the val variable (which is 1), this is the address-of the val variable in computer memory. Line 8 reads assign to the deref variable the value-at-address stored in the ptr pointer variable. We are getting the int value at the address stored in the ptr pointer, which in this case is 1. And finally we print out the deref variable on line 9 which prints 1.

Reading the operators as value-at-address (*) and address-of (&) helps to keep track of what is happening in any given line of code. I have found that sounding out the operators address-of and value-at-address helps to build a clearer mental model of what the code is doing. Soon it becomes second nature.

Think about pointers, addresses and values like envelopes, mailing addresses and houses. A pointer is like an envelope, on it we can write a mailing address. An address is like the mailing address, it is the location. The dereferenced value is like the house at the address, it is the value. A location represents the house but isn’t the house itself. We could erase the address on the envelope and write a different one if we wanted but that doesn’t change the house.

Using Pointers and Using Addresses

One question that comes up is where do you use a pointer versus where do you use an address? Let’s answer this with some code.

int *ptr;
int val = 1;
ptr = &val;

// print out dereferenced values
printf("dereference *ptr = %d\n", *ptr);
printf("dereference address of val *(&val) = %d\n", *(&val));

Run that code and we get:

dereference *ptr = 1
dereference address of val *(&val) = 1

We create an int pointer, an int variable val, and assign the address-of the val variable to out pointer. We print out the dereferenced value of our pointer. And finally we print out the dereferenced value of the address-of val. This notation may look a little strange but remember to sound out the operators and it says to get the value-at-address for the address of val.

The point of this piece of code is to show that an address can be used wherever a pointer is used. An address can even be treated as a pointer and deferenced directly, with the proper parentheses notation.

Void Pointers, NULL pointers and Unintialized Pointers

A pointer can be declared to be a void type. A pointer can be set to NULL or 0. And a pointer variable that has been declared but not yet assigned a value is considered uninitialized.

int *uninit; // leave the int pointer uninitialized
int *nullptr = 0; // initialized to 0, could also be NULL
void *vptr; // declare as a void pointer type
int val = 1;
int *iptr;
int *backptr;

// void type can hold any pointer type or reference
iptr = &val;
vptr = iptr;
printf("iptr=%p, vptr=%p\n", (void *)iptr, (void *)vptr);

// assign void pointer back to an int pointer and dereference
backptr = vptr;
printf("*backptr=%d\n", *backptr);

// print null and uninitialized pointers
printf("uninit=%p, nullptr=%p\n", (void *)uninit, (void *)nullptr);
// don't know what you will get back, random garbage?
// printf("*nullptr=%d\n", nullptr);
// will cause a segmentation fault
// printf("*nullptr=%d\n", nullptr);

Run the above code and you should get something like the output below although with different memory addresses.

iptr=0x7fff94b89c6c, vptr=0x7fff94b89c6c
uninit=0x7fff94b89d50, nullptr=(nil)

On line 1 we leave our int pointer uninitialized. All pointers, like other variables, are uninitialized until they are assigned a value. Uninitialized pointers hold random memory addresses. Pointers can be assigned the literal value 0, an address-of a variable, or the value of another pointer. Line 2 we assign 0 to our pointer. I use the terms NULL pointer and pointer assigned a literal value of 0 interchangeably. Line 3 we declare void pointer type. Then an int value and a couple of int pointers on lines 4-6.

Lines 9-11 we assign a reference to one of our int pointers and then we assign that int pointer to our void pointer. Void pointers can hold any pointer type. They are mostly used for generic purposes such as data structures. Notice on line 11 we print out the locations of the both the int pointer and the void pointer. They now point to the same memory address. All pointers just hold memory addresses. The types they are declared are used only when dereferencing pointer values.

On lines 15-16 we assign our void pointer back to our backptr int pointer. Then we dereference and print the value pointed to by castptr, which is 1.

Line 19 is interesting. Here we print out the values of our uninitialized and NULL pointers. Notice that our uninitialized pointer has a memory location. This is a garbage location. Any variable that is declared but not initialized will have a garbage memory location. Pointers are no exception. There is no telling what is at that location in memory. This is the reason why you should never try to dereference an uninitialized pointer. Best case you get garbage back and you have a fun time trying to debug your program. Worst case the program crashes badly.

A 0 value is the only literal value that can be assigned to a pointer without generating a warning or using an explicit cast. The NULL macro from stdlib.h can also be used to assign a literal value of 0 to the pointer. Assigning NULL or 0 is useful as a placeholder until you are ready to use the pointer. The prevents the computer from assigning a random memory location. NULL pointers should never be dereferenced though as doing so will cause undefined behavior. On many systems it will caue a segmentation fault.

Pointers and Arrays

Arrays in C are contiguous blocks of memory that hold multiple objects of a specified type. Contrast that with a pointer that holds a single memory location. Arrays and pointers are not the same thing and are not interchangeable. That being said an array variable does point to the memory address of the first element of the array.

An array variable is constant. You can’t assign a pointer to an array variable, even if the pointer variable actually points to the same or a different array. You also cannot assign one array variable to another. You can assign an array variable to a pointer though and that is where things get confusing. When assigning the array to the pointer we are actually assigning the address of the first element in the array to the pointer.

int myarray[4] = {1,2,3,0};
int *ptr = myarray;
printf("*ptr=%d\n", *ptr);

// cannot do this, array variables are constant
// myarray = ptr
// myarray = myarray2
// myarray = &myarray2[0]

On line 1 we initialize the array of ints. On line two we intiailize the int pointer and assign the array variable to it. Since the array variable actually is the memory address of the first element in the array, we have assigned the memory address of the first element in the array to the pointer. This is the same as doing int *ptr = &myarray[0], explicitly stating the address-of the first element in the array. Notice the pointer has to be the same type as the elements of the array, unless the pointer is a void pointer.

Pointers and Structs

Just like an array a pointer to a struct holds the memory address of the first element in the struct. And like arrays pointers to structs must be declared to point to the struct type or be void type.

struct person {
  int age;
  char *name;
struct person first;
struct person *ptr;

first.age = 21;
char *fullname = "full name"; = fullname;
ptr = &first;

printf("age=%d, name=%s\n", first.age, ptr->name);

On lines 1-6 we declare the struct person, a variable to hold a person struct, and a pointer to a person struct. Line 8 we assign a literal int to the age member. Line 9-10 we declare a char pointer to a literal char array and then assign that to the struct name member. Line 11 we assign a reference to the first person struct to our struct pointer variable.

Line 13 we print out the age and name of our struct instance. Notice the two different notations, the . and the ->. With the age field we are accessing the struct instance directly and so we use the . notation. With the name field we are using our pointer to the struct instance and so we use the -> notation. This would be the same as doing (*ptr).name where we first derefence the pointer and then access the name field.

Pointers to Pointers

A pointer holds the address-of a variable. That variable can be another pointer. Take the following code:

int val = 1;
int *ptr = 0;
// declare a variable ptr2ptr which holds the value-at-address of
// an *int type which in holds the value-at-address of an int type
int **ptr2ptr = 0;
ptr = &val;
ptr2ptr = &ptr;
printf("&ptr=%p, &val=%p\n", (void *)&ptr, (void *)&val);
printf("ptr2ptr=%p, *ptr2ptr=%p, **ptr2ptr=%d\n", (void *)ptr2ptr, (void *)*ptr2ptr, **ptr2ptr);

When run you should get output similar to this but with different memory addresses.

&ptr=0x7fff390fa6f8, &val=0x7fff390fa70c
ptr2ptr=0x7fff390fa6f8, *ptr2ptr=0x7fff390fa70c, **ptr2ptr=1

Lines 1-2 are declaring and int variable val and an int pointer variable ptr. Line 5 is new. Here we are saying that we have a variable ptr2ptr that holds the value-at-address of another *int type. That int type in turn holding the value-at-address of an int type. In other words we have an address that when we dereference it we get another address. When we dereference that address we get an int value. There is no limit to the levels of indirection this can go but usually after 2-3 indirections it becomes mentally prohibitive to clearly understand what code is doing.

Line 6 we assign the ptr variable the address-of the val variable. We have seen this before. Line 7 we assign the ptr2ptr variable the address-of the ptr pointer variable. Double indirection. The ptr2ptr variable stores the address-of ptr which in turn stores the address-of val. Line 8 we print out the address-of the ptr and val variables. Line 9 we print out the value stored in ptr2ptr which is the same as &ptr. When we dereference that we get the address of val. What that is dereferenced we get the value 1. *ptr2ptr reads get the value-at-address stored in ptr2ptr which is the address-of ptr. **ptr2ptr reads get the value-at-address store in ptr which is also an address and then get the value-at-address of that address.


Hope this brief overview helps with some of the different types of pointers you will see. In a later post I might go into another type of advanced pointer that is used, the function pointer.

Abbreviations…. 囧

      2 = to/too 
  2B or not 2B = To be or not to be 
      4 = for
      4ever = forever 

  ASL = Age/Sex/Location 
  AFAIC = As Far As I’m Concerned 
  AFAIK = As Far As I Know 
  AFK = Away From Keyboard 
  AIAMU = And I’m A Monkey’s Uncle 
  AISI = As I See It 
  AKA = Also Known As 
  AMBW = All My Best Wishes 
  ANFAWFOWS = And Now For A Word Word From Our Web Sponsor 
  AOTS = All Of The Sudden 
  ASAFP = As Soon As “Friggin” Possible 
  ASAP = As Soon As Possible 
  ATST = At The Same Time 
  AWGTHTGTTA = Are We Going To Have To Go Through This Again 
  AWGTHTGTTSA = Are We Going To Have To Go Through This Sh Again 
  AYSOS = Are You Stupid Or Something 
  B4 = Before 
  B4N = Bye For Now 
  BBFBBM = Body By Fisher, Brains by Mattel 
  BBIAB = Be Back In A Bit 
  BBIAF = Be Back In A Few 
  BBL = Be Back Later 
  BBN = Bye Bye Now 
  BCNU = Be Seein’ You 
  BF = Boyfriend 
  BFD = Big Fing Deal 
  BFN = Bye For Now 
  BHOF = Bald Headed Old Fart 
  BIF = Basis In Fact 
  BITD = Back In The Day 
  Biz = Business 
  BM = Byte Me 
  BMOTA = Byte Me On The Ass 
  BNF = Big Name Fan 
  BOHICA = Bend Over Here It Comes Again 
  BR = Bathroom 
  BRB = Be Right Back 
  BRT = Be Right There 
  BS = Big Smile 
  BT = Byte This 
  BTDT = Been There Done That 
  BTSOOM = Beats The Sh Out Of Me 
  BTW = By The Way 
  BTWBO = Be There With Bells On 
  BWDIK = But What Do I Know? 
  BWO = Black, White or Other 
  Cam = Web Camera 
  CIAO = Goodbye (in Italian) 
  CID = Consider It Done 
  CIO = Check It Out 
  CIS = CompuServe Information Service 
  CMF = Count My Fingers 
  Cof$ = Church of Scientology 
  CRAFT = Can’t Remember A Fing Thing 
  CRAWS = Can’t Remember Anything Worth A Sh 
  CSL = Can’t Stop Laughing 
  CTC = Choaking The Chicken 
  CU = See You 
  CUL/CYL/CUL8R = See You Later 
  CWYL = Chat With You Later 
  CYA = Cover Your Ass 
  DBEYR = Don’t Believe Everything You Read 
  DD = Due Diligence 
  DDD = Direct Distance Dial 
  DETI = Don’t Even Think It 
  DGT = Don’t Go There 
  DHYB = Don’t Hold Your Breath 
  DIIK = Damned If I Known 
  DILLIGAD = Do I Look Like I Give A d\amn 
  DILLIGAS = Do I Look Like I Give A Sh 
  DKDC = Don’t Know Don’t Care 
  DL = Download 
  DLTM = Don’t Lie To Me 
  DQYDJ = Don’t Quit You’re Day Job 
  DRIB = Don’t Read If Busy 
  DS = Dunce Smiley 
  DYSTSOTT = Did You See The Size Of That Thing 
  EG = Evil Grin 
  EOM = End Of Message 
  ESO = Equipment Smarter than Operator 
  F2F/FTF = Face To Face 
  FAQ = Frequently Asked Question 
  FBKS = Failure Between Keyboard and Seat 
  FE = For Example/Fatal Error 
  FF&PN = Fresh Fields And Pastures New 
  FOAF = Friend Of A Friend 
  FTASB = Faster Than A Speeding Bullet 
  FT = Faint 
  FTL = Faster Than Light 
  FTTB = For The Time Being 
  FUBAR = Fed Up Beyond All Recognition 
  FUBB = Fed Up Beyond Belief 
  FUD = (Spreading) Fear, Uncertainty, and Disinformation 
  FWIW = For What It’s Worth 
  FYA = For Your Amusement 
  FYI = For Your Information 
  FYM = For Your Misinformation 
  G2G = Got To Go 
  G8T/GR8 = Great 
  GAL = Get A Life 
  GDGD = Good,Good 
  GF = girlfriend 
  GG = Good Game/Gotta Go 
  GIGO = Garbage In, Garbage Out 
  GIWIST = Gee, I Wish I’d Said That 
  GL = Good Luck 
  GLYASDI = God Loves You And So Do I 
  GMTA = Great Minds Think Alike 
  GNBLFY = Got Nothing But Love For You 
  GR&D = Grinning Running And Ducking 
  GRRRR = “Growling” 
  GSOAS = Go Sit On A Snake 
  GTG = Got To Go 
  GTGB = Got To Go, Bye 
  GTGP = Got To Go Pee 
  GTH = Go To Hell 
  GTSY = Glad To See Ya 
  GYPO = Get Your Pants OffBE A QUEEN. 
  HAGO = Have A Good One 
  HAK = Hugs And Kisses 
  HB = Hurry Back 
  HD = Hold 

HHO1/2K = Ha Ha, Only Half Kidding 
  HHOK = Ha Ha, Only Kidding 
  HIOOC = Help! I’m Out Of Coffee 
  Howz = How is 
  HTH = Hope This (That) Helps 
  HUA = Heads Up Ace 
  HUYA = Head Up You’re a 
  IAC = In Any Case 
  IAE = In Any Event 
  IANAC = I Am Not A Crook 
  IANAL = I Am Not A Lawyer 
  IBT = In Between Technology 
  IBTD = I Beg To Differ 
  IC = I See/In Character 
  IDGAF = I Don’t Give A F 
  IDGI = I Don’t Get It 
  IDK = I Don’t Know 
  IDKY = I Don’t Know You 
  IDST = I Didn’t Say That 
  IDTS = I Don’t Think So 
  IFAB = I Found A Bug 
  IFU = I Fed Up 
  IGGP = I Gotta Go Pee 
  IIIO = Intel Inside, Idiot Outside 
  IIMAD = If It Makes An(y) Difference 
  IIRC = If I Remember Correctly 
  IIWM = If It Were Me 
  ILICISCOMK = I Laughed, I Cried, I Spat/Spilt Coffee/Crumbs/Coke On My Keyboard 
  ILY = I Love You 
  IMHO = In My Humble Opinion 
  IMNSHO = In My Not So Humble Opinion 
  IMO = In My Opinion 
  INMP = It’s Not My Problem 
  INPO = In No Particular Order 
  IOH = I’m Outta Here 
  IOW = In Other Words 
  IRL = In Real Life 
  ISS = I Said So 
  ITM = In The Money 
  IYKWIM = If You Know What I Mean 
  IYSS = If You Say So 
  J/C = Just Checking 
  J/K = Just Kidding! 
  J/W = Just Wondering 
  JAFO = Just Another Fing Onlooker 
  K/KK = OK/OK, OK 
  KFY = Kiss For You 
  KISS = Keep It Simple Stupid 
  KIT = Keep In Touch 
  KMA = Kiss My Ass 
  KWIM = Know What I Mean 
  KX = kiss 
  KYPO = Keep Your Pants On 
  L8R = Later 
  LD = Long Distance 
  LDTTWA = Let’s Do The Time Warp Again 
  LLTA = Lots And Lots Of Thunderous Applause 
  LMAO = Laughing My Ass Off 
  LMK = Let Me Know 
  LOL = Laughing Out Loud/Lots Of Luck(Love) 
  LTIC = Laughing ’Til I Cry 
  LTNS = Long Time No See 
  LYL = Love Ya Lots 
  LYLAS = Love You Like A Sister 
  M8T = Mate 
  MHOTY = My Hat’s Off To You 
  MM = Market Maker 
  MorF = Male or Female? 
  MOTD = Message Of The Day 
  MOTSS = Members Of The Same Sex 
  MTFBWY = May The Force Be With You 
  MWBRL = More Will Be Revealed Later 
  MYOB = Mind Your Own Business 
  N = And/Know/Now 
  NAK = Nursing At Keyboard 
  NAZ = Name, Address, Zip (also means Nasdaq) 
  NBD = No Big Deal 
  NBIF = No Basis In Fact 
  NFI = No Fing Idea 
  NFW = No Fing Way 
  NIFOC = Nude In Front Of The Computer 
  NM = Never Mind 
  NMP = Not My Problem 
  NMU = Nothing Much You 
  NOYB = None Of Your Business 
  NP = No Problem 
  NQOCD = Not Quite Our Class Dear 
  NRG = Energy 
  NRN = No Reply Necessary 
  NYCFS = New York City Finger Saluet 
  OAUS = On An Unrelated Subject 
  OBTW = Oh, By The Way 
  OIC = Oh, I See 
  OICU = Oh, I See You 
  OMDB = Over My Dead Body 
  OMG = Oh My God/Oh My Gosh 
  OMIK = Open Mouth, Insert Keyboard 
  ONNA = Oh No, Not Again 
  OOC = Out Of Character 
  OOTB = Out Of The Box/Out Of The Blue 
  OT = Off Topic 
  OTOH = On The Other Hand 
  OWTTE = Or Words To That Effect 
  OZ = stands for “Australia” 
  PEBCAK = Problem Exists Between Chair And Keyboard 
  PEM = Privacy Enhanced Mail 
  Pic = Picture 
  PIMP = Peeing In My Pants 
  PITA = Pain In The Ass 
  PLS/PLZ = Please 
  PMFJI = Pardon Me For Jumping In 
  PO = Piss Off 
  POS = Parents Over Shoulder 
  POV = Point Of View 
  PPL = People 
  Pro = Professional 
  PS = By The Way/Photoshop 
  TAH = Take A Hike 
  TANSTAAFL = There Ain’t No Such Thing As A Free Lunch 
  TARFU = Things Are Really Fed Up 
  TDTM = Talk Dirty To Me 
  TEOTWAWKI = The End Of The World As We Know It 
  TFN = Thanks For Nothin’ 
  THX/TX/THKS = Thanks 
  TIA = Thanks In Advance 
  TIAIL = Think I Am In Love 
  TIC = Tongue In Cheek 
  TLA = Three Letter Acronym 
  TLGO = The List Goes On 
  TM = Trust Me 
  TMI = Too Much Information 
  TMTOWTDI = There’s More Than One Way To Do It 
  TPTB = The Powers That Be 
  TSR = Totally Stuck in RAM 
  TTFN = Ta Ta For Now 
  TTT = That’s The Ticket/To The Top 
  TTUL/TTYL = Talk To You Later 
  TWHAB = This Won’t Hurt A Bit 
  TY = Thank You 
  TYVM = Thank You Very Much 
  U = You 
  UR = Your 
  U R = You are 
  unPC = unPolitically Correct 
  URYY4M = You Are Too Wise For Me 
  VFM = Values For Money 
  VG = Very Good 
  WAG = Wild Ass Guess 
  WAI = What An Idiot 
  WB = Welcome Back 
  WCA = Who Cares Anyway 
  WDYS = What Did You Say? 
  WDYT = What Do You Think? 
  WE = Whatever 
  WEG = Wicked Evil Grin 
  WG = Wicked Grin 
  WGAFF = Who Gives A Flying F 
  WIIFM = What’s In It For Me? 
  WIT = Wordsmith In Training 
  WITFITS = What in the F is this Sh 
  WOG = Wise Old Guy 
  Wot/Wut = What 
  WRT = With Respect To/With Regard To 
  WTF = What The F 
  WTG = Way To Go! 
  WTSDS = Where The Sun Don’t Shine 
  WYMM = Will You Marry Me 
  WYP = What’s Your Problem? 
  WYRN = What’s Your Real Name? 
  WYS = Whatever You Say 
  WYSIWYG = What You See Is What You Get 
  WYT = Whatever You Think 
  X U = Kiss You 
  Y = Why 
  Ya = You 
  YA = Yet Another 
  YAFIYGI = You Asked For It You Got It 
  YDKM = You Don’t Know Me 
  Yep/Yup = Yes 
  YGBK = You Gotta Be Kiddin’ 
  YMMV = Your Mileage May Vary 
  YNK = You Never Know 
  YOYO = You’re On Your Own 
  YR = Yeah, Right 
  YSYD = Yeah, Sure You Do 
  YTTT = You Telling The Truth? 
  YYSSW = Yeah Yeah Sure Sure Whatever

Make you Mac OS Terminal nicer

1. Differentiate files and directories showed by “ls”
a. edit the “.profile” under your home directory ~/. If you cannot find it, create one. Add the following text into “.profile”

alias ls='ls -G'

b. edit “.bash_profile”. add the following line at the bottom of the file.

export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad

2. Show syntax color and file name within vim in default

cd /usr/share/vim/
sudo vim vimrc

Add the following lines:

set ai                  " auto indenting
set history=100         " keep 100 lines of history
set ruler               " show the cursor position
syntax on               " syntax highlighting
set hlsearch            " highlight the last searched term
filetype plugin on      " use the file type plugins

set modeline
set ls=2

SSH without Password Prompt

If you have to SSH into other machines many times a day, it must be annoying that you have to type passwords of target machines every single time.

It drives me crazy.

So, use private/public key pairs to improve your life right now!

1. for normal Unix-based systems (e.g. Ubuntu Linux, Mac OS)

a. open a terminal/shell

b. run command:

ssh-keygen -t rsa

You then can find the key pair, “id_rsa” and “”, with in ~/.ssh/

c. copy the content in “” into ~/.ssh/authorized_keys on target machine

d. Done!

2. for OpenWrt system

a. create dsa key pair:

ssh-keygen -t dsa

b. copy the content in “” into /etc/dropbear/authorized_keys on your OpenWrt machine.

c. Enjoy!

Handling String in Python

1. CUT






Get every new post delivered to your Inbox.