Skip to content

Instantly share code, notes, and snippets.

View pcanterini's full-sized avatar

Pedro Canterini pcanterini

View GitHub Profile

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@pcanterini
pcanterini / knife-solo
Last active December 21, 2015 21:49
Setting up server with knife solo
# ssh stuff
brew install ssh-copy-id
ssh-copy-id root@server
# knife solo
gem install knife-solo
knife solo init project-name
knife cookbook create nginx -o cookbooks
knife prepare root@ip
# remember to add cookbook to json file eg: {"run_list":["recipe[nginx]"]}
@pcanterini
pcanterini / rails-stack-script
Last active December 21, 2015 23:39
rails stack on ubuntu 12.04 LTS
- create deploy user and add to sudoers
- log in as deployer
- install stack with: sudo wget --no-check-certificate https://raw.github.com/joshfng/railsready/master/railsready.sh && bash railsready.sh
- install apache2:
sudo apt-get update
sudo apt-get install apache2
- fix for rvm then install passenger
rvm remove 2.0.0
rvm autolibs install openssl
rvm install ruby-2.0.0-p247 --with-openssl-dir=$HOME/.rvm/usr
@pcanterini
pcanterini / octopress deploy
Last active March 4, 2017 01:43
fix for octopress deploy - rake deploy is rejected
git clone https://github.com/username/username.github.io.git
git checkout source
Then we need to setup the deploy directory.
mkdir _deploy
cd _deploy
git init
git remote add -t master -f origin https://github.com/username/username.github.io.git
Done! Now we can make changes in source branch and use rake gen_deploy as usual.
@pcanterini
pcanterini / dnsimple_update.sh
Created October 12, 2013 21:22
update ip on dnsimple
#!/bin/bash
DOMAIN_ID=""
RECORD_ID=""
IP="`curl http://icanhazip.com/`"
curl -H 'X-DNSimple-Token: email:account_token' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-X PUT \
@pcanterini
pcanterini / nodejs env config
Created November 18, 2013 00:07
nodejs env config
// Load configurations
// if test env, load example file
var env = process.env.NODE_ENV || 'development'
, config = require('./config/config')[env]
, mongoose = require('mongoose')
@pcanterini
pcanterini / git aliases
Created January 30, 2014 15:18
git aliases
nuke = !git branch -D $1 && git push origin :$1 ( git nuke branch name)
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@pcanterini
pcanterini / software.sh
Last active August 29, 2015 14:20
software.sh
#!/bin/sh
# Ask for the administrator password upfront.
sudo -v
# homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update
# taps
@pcanterini
pcanterini / ubuntu-node-setup
Created May 19, 2015 15:11
Ubuntu nodejs git hook
# ubuntu server setup
adduser deploy sudo
# on your machine
# ssh-copy-id deploy@IPADDRESS
# ssh deploy@IPADDRESS -i yoursakeyfile
# edit /etc/ssh/ssh_config set PasswordAuthentication to 'no'
# run service ssh restart to restart ssh