Tuesday, December 8, 2015

How to Get a Random MAC Address:


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

$ arp -a
wirelessap (192.168.0.1) at 94:fb:b2:38:7:b4 on en1 ifscope [ethernet]
? (192.168.0.255) at ff:ff:ff:ff:ff:ff on en1 ifscope [ethernet]
? (202.71.99.194) at 3c:7:54:38:9:a6 on en0 ifscope permanent [ethernet]



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

How to Get a Random MAC Address
If you’re going for privacy, randomizing your MAC address is probably the best option. This command will do it automatically:
openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//' | xargs sudo ifconfig en0 ether


Checking and Changing Ethernet Address:



Checking Ethernet Address:
=====================

$ ifconfig   en0   |grep   ether

$ ether  3c:07:54:38:09:a6



Changing Ethernet Address:
======================

$ sudo ifconfig en0 ether   3c:07:54:38:09:b4



Saturday, October 10, 2015

Deleting "DS_Store" files on Mac OS

Remove all DS_Store files


  1. Select Applications > Utilities to launch Terminal.
  2. Enter the following UNIX command:
    sudo find / -name ".DS_Store" -depth -exec rm {} \;
  3. When prompted for a password enter your Mac OS X Administrator password.


Automatically remove DS_Store files periodically


  1. Select Applications > Utilities to launch Terminal.
  2. Enter the following UNIX command:
    sudo crontab -e
  3. When prompted for a password enter your Mac OS X Administrator password.
  4. In the vi editor, press the letter I on your keyboard once and enter the following command:
    15 1 * * * root find / -name ".DS_Store" -depth -exec rm {} \;
    This crontab entry has the following format:
    .
    The system automatically runs the command at 1:15 AM everyday. To configure the command for a different time, use different values.
    Note:
    This command is not run if your computer is switched off at the scheduled time.
  5. To save the entry press the Esc key once, then simultaneously press Shift+z+z.

Monday, September 28, 2015

Disabling App Transport Security in iOS 9.0

   <key> NSAppTransportSecurity </key>
   <dict> 
           <key>NSAllowsArbitraryLoads</key>  <true/>
   </dict > 

Thursday, July 9, 2015

Switch between JDK 1.7 and JDK 1.8

Edit .bash_profile and add the following:

setupjdk() {
    export JAVA_HOME=$(/usr/libexec/java_home -v $1)
    sudo ln -nsf ${JAVA_HOME%/*} /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
}
setupjdk 1.8



$source ~/.bash_profile


Thursday, July 2, 2015

Wednesday, June 24, 2015

Increase UILabel height dynamically:

CGRect frame = self.securityValueLbl.frame;
CGSize maximumLabelSize = CGSizeMake(frame.size.width, 80); //MAXFLOAT

NSStringDrawingOptions options = NSStringDrawingTruncatesLastVisibleLine |
NSStringDrawingUsesLineFragmentOrigin;

NSDictionary *attr = @{NSFontAttributeName: self.securityValueLbl.font};
CGRect expectedLabelFrame = [self.securityValueLbl.text boundingRectWithSize:maximumLabelSize
                                             options:options
                                          attributes:attr
                                             context:nil];

frame.size.height = ceilf(expectedLabelFrame.size.height);
self.securityValueLbl.frame = frame;