Master Referral Thread

Updated on: 08/17/17


  • Join Robinhood and we’ll both get a share of stock like Apple, Ford, or Sprint for free. Make sure you use my link.
    Referral Link:


Posted in Uncategorized | Leave a comment

INT_MAX and INT_MIN in Python

  • In Python 2.x, one can use
  • In Python 3.x, it is
  • Use float
 float('inf')  float('-inf')
Posted in Uncategorized | Leave a comment

Add All Amex Offers in One Second

Update: multiple tabs don’t work perfectly with this method. It may fail to load some offers. Add the offers you are to use manually if you are using multiple tabs.

In Chrome, log into your account and load all offers. If you have multiple cards, open multiple tabs and load offers for each card in each tab.

Ctrl+Shift+C to open the developer tool and go to console. Enter:

Posted in Uncategorized | Leave a comment


Got back to use windows…

Use putty ssh to Unix server.

Tab completion, up-down arrow history are not working. I thought the putty configuration is not correct.  One hour tuning the config, not working. Then I realized maybe the shell is not bash…

Echo $0

Wtf ksh is… Ancient shell language.

Uname gives AIX… No wonder. IBM machine.

Now the solution is clear. “chsh” to find the available shells. Luckily bash is available in “/use/bin/bash”. Add “/usr/bin/bash” to the first line of ~/.profile.

Mission complete!
I am expecting more troubles using windows and AIX…

Posted in Uncategorized | Leave a comment

run firefox on a remote Linux server

I have a python script which opens firefox. I can ssh to my mac and run the script without issue. But when I ssh to the raspberry pi 2 (running Ubuntu Mate 15.04) and try to run the script, it shows “No Display Specified” error. The solution is to use “export DISPLAY=:0”

ssh name@server
export DISPLAY=:0

A firefox window will be opened in the remote server

Posted in Linux | Tagged , , | 1 Comment


Create a record of the installed libraries in a text file (requirements.txt). Dude I should have known it before…

$ pip freeze > requirements.txt
Posted in Linux, programming | Tagged , | Leave a comment

directory size and count of files

  • List the size of current directory and its subdirectories
    du -ch
  • List the size of current directory and suppress the reports of its subdiectories
    du -sh
  • Count number of current directory files/subdirectories and total files in all subdirectories
    echo * | wc
Posted in Linux | Leave a comment