arp -i bridge100 -a
bridge100 may be different on your Mac OSX
Showing posts with label Mac OS X. Show all posts
Showing posts with label Mac OS X. Show all posts
Tuesday, January 30, 2018
Wednesday, December 28, 2016
Node.js for Mac
Source: http://icarus4.logdown.com/posts/175092-nodejs-installation-guide
1. Install NVM (Node.js Version Manager)
1.1. Add "source $(brew --prefix nvm)/nvm.sh" to ~/.bash_profile
1.2. Source ~/.bash_profile
2. Install Node.js
2.1. List available versions by "nvm ls-remote"
2.2. Install the LTS by "nvm install v6.9.2"
Node.js directory: /usr/local/opt/nvm/versions/node/vX.X.X
Installed versions: nvm ls
Current in use version: nvm -v
To switch version: nvm use vX.X.X (only valid for current shell). To fix it, set it as default version to use: nvm alias default vX.X.X
1. Install NVM (Node.js Version Manager)
1.1. Add "source $(brew --prefix nvm)/nvm.sh" to ~/.bash_profile
1.2. Source ~/.bash_profile
2. Install Node.js
2.1. List available versions by "nvm ls-remote"
2.2. Install the LTS by "nvm install v6.9.2"
Node.js directory: /usr/local/opt/nvm/versions/node/vX.X.X
Installed versions: nvm ls
Current in use version: nvm -v
To switch version: nvm use vX.X.X (only valid for current shell). To fix it, set it as default version to use: nvm alias default vX.X.X
Tuesday, November 22, 2016
Samba server on Ubuntu
. Install samba server on ubuntu if not done yet.
sudo apt-get install samba
. Create an user, howard.
sudo useradd howard
. Create a samba user, howard, and set the password.
sudo smbpasswd -a howard
. Configure the shared folder permission info in samba config file.
sudo vi /etc/samba/smb.conf
Add following info to the end of smb.conf file
[src]
path = /home/howard/src/
browseable = yes
read only = no
writeable = yes
create mask = 0755
directory mask = 0755
valid users = howard
. Restart the samba service and it's now ready!
sudo service smbd restart
[To connect the samba server from a Mac OS X]
Go to finder and Cmd+K, enter smb://IPOfUbuntu/src
Friday, October 7, 2016
The file is damaged and should be moved to the trash
The problem could be fixed by turned off the gatekeeper.
1. Disable the gatekeeper by
. sudo spctl --master-disable
2. Right click on the application and click open. It should work now.
3. Enable the gatekeeper by
. sudo spctl --master-enable
To check the status of the gatekeeper:
. sudo spctl --status
1. Disable the gatekeeper by
. sudo spctl --master-disable
2. Right click on the application and click open. It should work now.
3. Enable the gatekeeper by
. sudo spctl --master-enable
To check the status of the gatekeeper:
. sudo spctl --status
Friday, September 23, 2016
NFS server on Ubuntu
Setup NFS server on Ubuntu:
. sudo apt-get install nfs-kernel-server
. Create a folder for sharing
. mkdir PATH_TO_SHARE
. chmod -R 777 PATH_TO_SHARE
. Edit /etc/exports
. sudo vi /etc/exports
. add following line and save
PATH_TO_SHARE *(rw,sync,insecure,no_root_squash,no_all_squash)
. Refresh updated /etc/exports
. sudo exportfs -r
. Restart NFS server
. /etc/init.d/nfs-kernel-server restart
. Check shared NFS folders
. showmount -e localhost
Connect to NFS server on Ubuntu from Mac OS X
[Finder]
. Cmd + K (Finder -> Go -> Connect to Server )
. nfs://IPOfUbuntu:/PATH_TO_SHARE
[Terminal]
. Check what folders have been shared
. showmount -e IPOfUbuntu
. Create a mount point
. mkdir MOUNT_POINT
. Mount nfs to local MOUNT_POINT folder
. sudo mount -o resvport,rw -t nfs IPOfUbuntu:/PATH_TO_SHARE MOUNT_POINT
. sudo apt-get install nfs-kernel-server
. Create a folder for sharing
. mkdir PATH_TO_SHARE
. chmod -R 777 PATH_TO_SHARE
. Edit /etc/exports
. sudo vi /etc/exports
. add following line and save
PATH_TO_SHARE *(rw,sync,insecure,no_root_squash,no_all_squash)
. Refresh updated /etc/exports
. sudo exportfs -r
. Restart NFS server
. /etc/init.d/nfs-kernel-server restart
. Check shared NFS folders
. showmount -e localhost
Connect to NFS server on Ubuntu from Mac OS X
[Finder]
. Cmd + K (Finder -> Go -> Connect to Server )
. nfs://IPOfUbuntu:/PATH_TO_SHARE
[Terminal]
. Check what folders have been shared
. showmount -e IPOfUbuntu
. Create a mount point
. mkdir MOUNT_POINT
. Mount nfs to local MOUNT_POINT folder
. sudo mount -o resvport,rw -t nfs IPOfUbuntu:/PATH_TO_SHARE MOUNT_POINT
Saturday, July 25, 2015
Capture packets from iOS devices on Mac OS with Wireshark
RVI (Remote Virtual Interface)
1. Connect your iOS device to a Mac with USB
2. Open terminal and enter "rvictl -s deviceUUID" to start device with interface rvi0
3. Run wireshark and start capturing the packet on interface rvi0
4. Sotp interface rvi0 by enter "rvictl -x deviceUUID"
PS. deviceUUID is the UUID of your iOS device
1. Connect your iOS device to a Mac with USB
2. Open terminal and enter "rvictl -s deviceUUID" to start device with interface rvi0
3. Run wireshark and start capturing the packet on interface rvi0
4. Sotp interface rvi0 by enter "rvictl -x deviceUUID"
PS. deviceUUID is the UUID of your iOS device
Tuesday, July 7, 2015
Keyboard shortcuts for symbols on Mac OS X
Degree (˚): option + k
Micro (µ): option + m
Copyright (©): option + g
Ohm (Ω): option + z
Registered (®): option + r
Trade mark (™): option + 2
Math:
Approximate (≈): option + x
PI (π): option + p
Delta (∆): option + j
Infinity (∞): option + 5
Division (÷): option + /
Not equal (≠) : option + '+'
Division (÷): option + /
Not equal (≠) : option + '+'
Plus/Minus (±): option + shift + =
Square root (√): option + v
Alpha (∂): option + d
Beta (ß): option + s
Function(ƒ): option + f
Calculus (∫): option + b
Yen (¥): option + y
Pound: (£): option + 3
Euro (€): option + shift + 2
No interface available in Wireshark on Mac OS
Change the permission to 644 on the BFF (Berkeley Packet Filter) in /dev/
sudo chmod 644 /dev/bpf*
or
whoami to find out your name
sudo chown yourname:admin /dev/bp*
And restart wireshark!
sudo chmod 644 /dev/bpf*
or
whoami to find out your name
sudo chown yourname:admin /dev/bp*
And restart wireshark!
Monday, May 4, 2015
Add a private key to Mac OS X KeyChain
ssh-add -K ~/.ssh/id_rsa
ps. make sure the permission of id_rsa is 600
Wednesday, February 25, 2015
Solution for VPN client not working after upgraded to Mac 10.10 Yosemite
Source: http://apple.stackexchange.com/questions/151345/vpn-client-is-not-working-after-yosemite-update-enforce-firewall-policy-fail
Solution: put computer into kext developer mode (-> 10.9 behavior)
sudo nvram boot-args="kext-dev-mode=1"
To change back to 10.10 behavior (VPN client will not work)
sudo nvram -d boot-args
After the change, you need to reboot the computer
Solution: put computer into kext developer mode (-> 10.9 behavior)
sudo nvram boot-args="kext-dev-mode=1"
To change back to 10.10 behavior (VPN client will not work)
sudo nvram -d boot-args
After the change, you need to reboot the computer
Thursday, November 6, 2014
Saturday, October 12, 2013
Steps to install OpenCV on Mac OS X for XCode
Reference: http://tilomitra.com/opencv-on-mac-osx/
OpenCV installation steps:
1. Install MacPorts
2. Install CMake by "sudo port install cmake"
3. Get OpenCV source, http://opencv.willowgarage.com/wiki/InstallGuide, and untar it
4. Build OpenCV
Go to the folder where you untar the OpenCV source to.
Make a separate folder for building
. make build
. cd build
. cmake -G "Unix Makefiles" ..
Now make OpenCV
. make -j8
. sudo make install
The OpenCV will be installed to /usr/local
5. Done installing the OpenCV on Mac OS X
Create a sample project on XCode with OpenCV
1. Start a new XCode "Command Line Tool" project with Type C++
2. Add all the libopencv*.dylib (or the ones you need) into the project from /usr/local/lib with "Copy items into destination group's folder (if needed)" checked
3. Add "/usr/local/include" into "Header Search Path" in Build Settings of project
4. Add "/usr/local/lib" into "Library Search Path" in Build Settings of project
5. Either 4.1 or 4.2
4.1 Select "libstdc++ (GNU C++ standard library)" instead of "libc++ (LLVM C++ standard library with C++11 support)" in "Apple LLVM compiler 4.2 - Language" in Build Settings
4.2 Select "LLVM GCC 4.2" instead of "Default compiler (Apple LLVM compiler 4.2)" in "Compiler for C/C++/Objective-C" in Build Settings
6. Write some codes to test OpenCV
OpenCV installation steps:
1. Install MacPorts
2. Install CMake by "sudo port install cmake"
3. Get OpenCV source, http://opencv.willowgarage.com/wiki/InstallGuide, and untar it
4. Build OpenCV
Go to the folder where you untar the OpenCV source to.
Make a separate folder for building
. make build
. cd build
. cmake -G "Unix Makefiles" ..
Now make OpenCV
. make -j8
. sudo make install
The OpenCV will be installed to /usr/local
5. Done installing the OpenCV on Mac OS X
Create a sample project on XCode with OpenCV
1. Start a new XCode "Command Line Tool" project with Type C++
2. Add all the libopencv*.dylib (or the ones you need) into the project from /usr/local/lib with "Copy items into destination group's folder (if needed)" checked
3. Add "/usr/local/include" into "Header Search Path" in Build Settings of project
4. Add "/usr/local/lib" into "Library Search Path" in Build Settings of project
5. Either 4.1 or 4.2
4.1 Select "libstdc++ (GNU C++ standard library)" instead of "libc++ (LLVM C++ standard library with C++11 support)" in "Apple LLVM compiler 4.2 - Language" in Build Settings
4.2 Select "LLVM GCC 4.2" instead of "Default compiler (Apple LLVM compiler 4.2)" in "Compiler for C/C++/Objective-C" in Build Settings
6. Write some codes to test OpenCV
#include
#include
#include "opencv2/core/core.hpp"
using namespace cv ;
int main(int argc, char** argv)
{
#if 0
//get the image from the directed path
IplImage* img = cvLoadImage("/Users/Howard/Desktop/Codes/OpenCV/CV/Lena_512.bmp", 1);
//NSLog(img);
//create a window to display the image
cvNamedWindow("picture", 1);
//show the image in the window
cvShowImage("picture", img);
//wait for the user to hit a key
cvWaitKey(0);
//delete the image and window
cvReleaseImage(&img);
cvDestroyWindow("picture");
#else
Mat img = imread("/Users/Howard/Desktop/Codes/OpenCV/CV/Lena_512.bmp", CV_LOAD_IMAGE_UNCHANGED);
if (img.data == NULL)
{
printf("\n Image cannot be loaded") ;
system("pause");
return -1;
}
namedWindow("OrgImage", CV_WINDOW_AUTOSIZE);
imshow("OrgImage", img);
waitKey(0) ;
#endif
}
7. That's all
Tuesday, September 18, 2012
Compile x264 for Mac OS X (32bits)
./configure --enable-pic --enable-shared --disable-asm --host=i686-apple-darwin11.1.0 --extra-cflags="-arch i386" --extra-ldflags="-arch i386"
Friday, March 16, 2012
How to check target architecture of a static library
For Mac OS:
Use lipo.
Ex. lipo -info staticLibrary.a
For Linux OS:
Use file
Ex. file staticLibrary.c
Use lipo.
Ex. lipo -info staticLibrary.a
For Linux OS:
Use file
Ex. file staticLibrary.c
Friday, February 17, 2012
Mac-to-Mac: Remote Desktop (Remote Control)
1. Enable the remote management or screen sharing function on the target Mac which is to be controlled.
. System Preference -> Sharing -> Remote Management
. System Preference -> Sharing -> Screen Sharing
2-A. Apple remote desktop (remote management, not free)
. Start "Remote Desktop"(Install the apple remote desktop admin if it's not installed yet)
. Locate the target Mac and connect to it
2-B. Screen Sharing (free)
. Finder -> Go -> Connect to server
type in vnc://ip_address_of_the_target_mac
. System Preference -> Sharing -> Remote Management
. System Preference -> Sharing -> Screen Sharing
2-A. Apple remote desktop (remote management, not free)
. Start "Remote Desktop"(Install the apple remote desktop admin if it's not installed yet)
. Locate the target Mac and connect to it
2-B. Screen Sharing (free)
. Finder -> Go -> Connect to server
type in vnc://ip_address_of_the_target_mac
Monday, August 29, 2011
How to compile FFMPEG in 32 bit mode for Mac OS X
./configure --extra-cflags="-arch i386" --extra-ldflags='-arch i386' --arch=x86_32 --target-os=darwin --enable-cross-compile
Monday, August 22, 2011
My favorite XCode 3 keyboard shortcuts
Keyboard:
. Shift + Option + Command + Left/Rigth arrow key: Move to Previous/Next file
. Command Left/Right arrow key: Go to beginning/end of the line
. Command + [ or ] : Indent selection leftward/rightward
. Command + R : Build and Run (Breakpoints off)
. Command + Y : Build and Debug (Breakpoints on)
. Option + Command + R : Run (Breakpoints off)
. Option + Command + Y : Debug (Breakpoints on)
Touchpad:
. 3 fingers swipe up : Switch between .m and .h files
. 3 fingers swipe Left/Right : Go Back/Forward
. Shift + Option + Command + Left/Rigth arrow key: Move to Previous/Next file
. Command Left/Right arrow key: Go to beginning/end of the line
. Command + [ or ] : Indent selection leftward/rightward
. Command + R : Build and Run (Breakpoints off)
. Command + Y : Build and Debug (Breakpoints on)
. Option + Command + R : Run (Breakpoints off)
. Option + Command + Y : Debug (Breakpoints on)
. Shift + Command + E : Zoom editor out
. Shift + Command + W : Close file
Touchpad:
. 3 fingers swipe up : Switch between .m and .h files
. 3 fingers swipe Left/Right : Go Back/Forward
Tuesday, December 14, 2010
Environment variable PATH location
Environment variable PATH location: /etc/paths
To export other variable, ie. NDK, adding it to ~/.profile. something like this
export NDK=~/Library/android-ndk-r4b
Or
vi ~/.bashrc
PATH=/opt/crosstool/arm-none-linux-gnueabi-4.4.0_ARMv5TE/bin:$PATH
To export other variable, ie. NDK, adding it to ~/.profile. something like this
export NDK=~/Library/android-ndk-r4b
Or
vi ~/.bashrc
PATH=/opt/crosstool/arm-none-linux-gnueabi-4.4.0_ARMv5TE/bin:$PATH
Subscribe to:
Posts (Atom)
Check clients which connect to Mac OS X Wi-Fi Internet Sharing
arp -i bridge100 -a bridge100 may be different on your Mac OSX
-
1. Create an account on TestFlight ( http://testflightapp.com ) and with "Developer" option checked. 2. Log in to the TestFlight ...
-
[轉載] [Javascript] Encrypt your private blog post from the article of Kaie's Blog 今日在PPT上的Blog版逛到版友weijr所提到的一篇好文章,可以用來針對Blog中某一段文字給予加密,變成...
-
arp -i bridge100 -a bridge100 may be different on your Mac OSX