create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "your_email@youremail.com"
server { | |
listen 80; | |
server_name www.your-website.com; | |
rewrite ^(.*) http://your-website.com$1 permanent; | |
} | |
server { | |
listen 80; | |
server_name your-website.com; |
# NOTICE: to get Nginx+Unicorn best-practices configuration see the gist https://gist.github.com/3052776 | |
$ cd /usr/src | |
$ wget http://nginx.org/download/nginx-1.2.1.tar.gz | |
$ tar xzvf ./nginx-1.2.1.tar.gz && rm -f ./nginx-1.2.1.tar.gz | |
$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz | |
$ tar xzvf pcre-8.30.tar.gz && rm -f ./pcre-8.30.tar.gz | |
$ wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz |
=begin | |
Need to install gems heroku, newrelic_rpm | |
$ gem install heroku newrelic_rpm | |
Set your apps setting | |
app_name : heroku's app_name of auto scaling | |
license_key : NewRelic api key. You can get heroku's NewRelic admin console. "App setting" and "Agent configuration" | |
execute with cron every minutes | |
$ ruby ./adjust_dynos_with_newrelic.rb |
namespace :db do desc "Backup project database. Options: DIR=backups RAILS_ENV=production MAX=7" | |
task :backup => [:environment] do | |
datestamp = Time.now.strftime("%Y-%m-%d_%H-%M-%S") | |
base_path = Rails.root | |
base_path = File.join(base_path, ENV["DIR"] || "backups") | |
backup_base = File.join(base_path, 'db_backups') | |
backup_folder = File.join(backup_base, datestamp) | |
backup_file = File.join(backup_folder, "#{RAILS_ENV}_dump.sql") | |
FileUtils.mkdir_p(backup_folder) | |
db_config = ActiveRecord::Base.configurations[RAILS_ENV] |
require 'net/http' | |
require 'uri' | |
#1: Simple POST | |
res = Net::HTTP.post_form(URI.parse('http://www.example.com/search.cgi'), | |
{'q' => 'ruby', 'max' => '50'}) | |
puts res.body | |
#2: POST with basic authentication | |
res = Net::HTTP.post_form(URI.parse('http://jack:pass@www.example.com/todo.cgi'), |
function get_avatar_from_service(service, userid, size) { | |
// this return the url that redirects to the according user image/avatar/profile picture | |
// implemented services: google profiles, facebook, gravatar, twitter, tumblr, default fallback | |
// for google use get_avatar_from_service('google', profile-name or user-id , size-in-px ) | |
// for facebook use get_avatar_from_service('facebook', vanity url or user-id , size-in-px or size-as-word ) | |
// for gravatar use get_avatar_from_service('gravatar', md5 hash email@adress, size-in-px ) | |
// for twitter use get_avatar_from_service('twitter', username, size-in-px or size-as-word ) | |
// for tumblr use get_avatar_from_service('tumblr', blog-url, size-in-px ) | |
// everything else will go to the fallback | |
// google and gravatar scale the avatar to any site, others will guided to the next best version |
// ported from http://alienryderflex.com/intersect/ | |
public static function LineIntersection(a:Point, b:Point, c:Point, d:Point):Point | |
{ | |
var distAB:Number, cos:Number, sin:Number, newX:Number, ABpos:Number; | |
if ((a.x == b.x && a.y == b.y) || (c.x == d.x && c.y == d.y)) return null; | |
if ( a == c || a == d || b == c || b == d ) return null; | |
b = b.clone(); |
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "your_email@youremail.com"
1. You can find the PATH variable in Windows in Control Panel -> System -> Advanced System Configuration -> Environment Variables. | |
My PATH variable is: C:\Ruby192\bin;C:\Python27 | |
In a Command Prompt with Ruby, you can set the variable for that console using the command | |
SET PATH=C:\Ruby192\bin;C:\Python27 | |
You can check the values using the command |
Reference
Remove sensitive files from Git/Github
In Terminal
git filter-branch --index-filter 'git rm --cached --ignore-unmatch [file path/name]' --prune-empty --tag-name-filter cat -- --all
Example: