Skip to content

Instantly share code, notes, and snippets.

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
In the interest of allowing you to run `nginx` without `sudo`, the default
port is set to localhost:8080.
If you want to host pages on your local machine to the public, you should
change that to localhost:80, and run `sudo nginx`. You'll need to turn off
any other web servers running port 80, of course.
You can start nginx automatically on login running as your user with:
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/nginx/1.2.3/homebrew.mxcl.nginx.plist ~/Library/LaunchAgents/
@sn00011
sn00011 / gist:3630846
Created September 5, 2012 05:06
Issues with the '^M' when do git diff

A quick fix:

This needs the AnyEdit plugin installed on Eclipse.

The simple steps are:

  • first select the file or folders in question in the Navigator or in my case PHP Explorer
  • navigate to File -> Convert Line Delimiters To -> Unix (LF, \n, 0A), in the popup window, choose the files/directories you need to fix
  • press ok, and it will be fixed
@sn00011
sn00011 / gist:3616213
Created September 4, 2012 03:26
Search and replace with Sed

sed -i "s|$old|$new|g" /etc/myconfig

@sn00011
sn00011 / gist:3434364
Created August 23, 2012 08:48
Batch replace a portion of the file names in a directory

This may use the utility 'rename', in case not installed(OS X), install it using:

$ brew install rename

==> Downloading http://plasmasturm.org/code/rename/rename
######################################################################## 100.0%
==> pod2man rename rename.1
/usr/local/Cellar/rename/0.1.3: 3 files, 28K, built in 6 seconds
@sn00011
sn00011 / gist:3421841
Created August 22, 2012 02:56
Drush delete multiple fields in one go
for field in field_hazard field_issue field_reference_msg field_sector; do drush field-delete $field -y; done
@sn00011
sn00011 / gist:3400493
Created August 20, 2012 03:53
Install Apache Solr on Lion
@sn00011
sn00011 / git_info.sh
Created August 15, 2012 03:49
Gathering information about a repository
#!/bin/bash
# author: Duane Johnson
# email: duane.johnson@gmail.com
# date: 2008 Jun 12
# license: MIT
#
# Based on discussion at http://kerneltrap.org/mailarchive/git/2007/11/12/406496
pushd . >/dev/null
@sn00011
sn00011 / gist:3347350
Created August 14, 2012 08:03
Solution for iOS simulator on Mac OS X 10.7 (Lion) can't be found issue
#Suppose the Xcode (v4.3x) is installed at the default location, then:
## 1. Use this command to directly open it:
open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app
## 2. Create an alias for later quick access:
echo "alias ios-simulater='open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app'" >> ~/.bash_profile; source ~/.bash_profile
@sn00011
sn00011 / gist:3292016
Created August 8, 2012 04:26
[Javascript] Round a number to a specified decimal place
/**
* Round a number to a specified decimal place.
* @var num The number to be rounded
* @var digits The digit behind the decimal point to be rounded to
*/
function roundNumber(num, digits) {
num = parserFloat(num);
var multiple = Math.pow(10, digits);
return Math.round(num * multiple) / multiple;