Skip to content

Instantly share code, notes, and snippets.

Avatar

Pedro Canterini pcanterini

View GitHub Profile
View gist:5498977

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 Dec 21, 2015
Setting up server with knife solo
View 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 Dec 21, 2015
rails stack on ubuntu 12.04 LTS
View rails-stack-script
- 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 Mar 4, 2017
fix for octopress deploy - rake deploy is rejected
View octopress deploy
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 Oct 12, 2013
update ip on dnsimple
View dnsimple_update.sh
#!/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 \
View 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')
View git aliases
nuke = !git branch -D $1 && git push origin :$1 ( git nuke branch name)
View osx-for-hackers.sh
#!/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 Aug 29, 2015
software.sh
View 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
Ubuntu nodejs git hook
View ubuntu-node-setup
# 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
You can’t perform that action at this time.