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
firefox

A firefox window will be opened in the remote server

Advertisements
Posted in Linux | Tagged , , | 1 Comment

freeze

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

$ pip freeze > requirements.txt

 

 

Better method: use pipreqs

http://www.idiotinside.com/2015/05/10/python-auto-generate-requirements-txt/

 

$ pipreqs /path/

 

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

MITBBS archive log

05/05/15

My iMac disk space is also used up. Moved the mysql data file (/usr/local/mysql/data) to external hard drive  (/Volumes/diskname/MysqlData/data)

  1. close mysql server
  2. sudo cp -R /usr/local/mysql/data /Volumes/diskname/MysqlData/.
  3. In /usr/local/mysql/my.cnf, add “datadir =  /Volumes/diskname/MysqlData/data”
  4. restart mysql server

The drawback is there will be no TimeMachine backup for this database…

update 1: It seems I can make an alias for the /Volumes/diskname/MysqlData/data and drag the alias into my iMac disk. The timemachine will backup this directory.

update 2: Another way to backup directory on external HDD is to remove the directory on TM’s exclusion list. I will use this method for now.

========================================================

Posted in mitbbsArchive, mysql | Tagged | Leave a comment

.bashrc in Mac

Mac doesn’t read ~/.bashrc file when a shell starts. The order of files the shell read is  (reference:  http://hayne.net/MacDev/Notes/unixFAQ.html#shellStartup)

  1. /etc/profile
  2. ~/.bash_profile or ~/.bash_login or ~/.profile (only one of these files will be read, if it exists. If more than one file exist, it will only read the first existing one by the above order)

So one way to make Mac work with ~/.bashrc is to add the line

source ~/.bashrc

in ~/.bash_profile

Posted in PC problem | Leave a comment

screen control of a Mac

open  vnc://your-mac-ip-address:5900
Posted in Uncategorized | Leave a comment

wi-fi setup through command line

http://blog.mattcrampton.com/post/64144666914/managing-wifi-connections-using-the-mac-osx

Turn off wifi on your macbook from the Mac OSX terminal command line:

networksetup -setairportpower en0 off

Turn on wifi on your macbook from the Mac OSX terminal command line:

networksetup -setairportpower en0 on

List available wifi networks from the Mac OSX terminal command line:

/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport scan

Join a wifi network from the Mac OSX terminal command line:

networksetup -setairportnetwork en0 SSID

If the wi-fi requires a password

networksetup -setairportnetwork en0 SSID WIFI_PASSWORD

If the wifi requires both username and password

networksetup -setairportnetwork en0 SSID USERNAME WIFI_PASSWORD

Find your network interface name

networksetup -listallhardwareports
Posted in Uncategorized | Leave a comment