Skip to content

Instantly share code, notes, and snippets.

View christianrojas's full-sized avatar

Christian Rojas christianrojas

View GitHub Profile
@christianrojas
christianrojas / gist:3f9a7e7503168a14dbf9
Last active August 29, 2015 14:03
Fix PostgreSQL Mavericks
brew install postgresql
If builds of PostgreSQL 9 are failing and you have version 8.x installed,
you may need to remove the previous version first. See:
https://github.com/Homebrew/homebrew/issues/issue/2510
To migrate existing data from a previous major version (pre-9.3) of PostgreSQL, see:
http://www.postgresql.org/docs/9.3/static/upgrading.html
When installing the postgres gem, including ARCHFLAGS is recommended:
@christianrojas
christianrojas / feedback-angularjs-error.js
Created May 22, 2014 19:48
feedback-angularjs-error.js
cbulz.controller("FeedbackController", ["$scope", 'Feedback', function($scope, Feedback){
$scope.create = function(){
var session = new Feedback({
feedback: $scope.feedback
});
session.$save($scope.success, $scope.error)
};
$scope.success = function(response, responseHeader){
console.log('Success')
@christianrojas
christianrojas / rails-4-ubuntu-13-vps-capistrano-3.md
Last active August 29, 2015 13:59
Rails 4.1 + Ubuntu 13.10 64bits VPS + Capistrano 3

VPS Setup

Groups and Privileges

Great info here

Change root password:

passwd
require "rest_client"
RestClient.post "http://localhost:3000/resource_name",
resource_name: {
name: 'Consectetur Lorem Fusce',
photo: File.new("/path/to/file.jpg", 'rb')
}, :content_type => :json,
:accept => :json
@christianrojas
christianrojas / chmod.sh
Created March 3, 2014 19:12
Terminal commands for chmod on folders and files
# Set agatha to user and admin to group recursively
chown -R agatha:admin [Folder]/
# Set to user and group the read and write permissions recursively
chmod -R ug=rw [Folder]/
@christianrojas
christianrojas / wordpress_fix.sh
Last active August 29, 2015 13:55
Wordpress owner group and permissions
#!/bin/bash
PATH=/path/to/WP/folder
echo "chown entire wp folder"
chown -R -f www-data:www-data $PATH
echo "securing the entire wp folder"
find $PATH -type d -exec chmod 755 {} \;
find $PATH -type f -exec chmod 644 {} \;
chmod 440 $PATH/*.php # verified minimum OK with WP
find $PATH/wp-admin -type f -exec chmod 640 {} \;
# brew install command line:
ruby -e “$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)”
.bs-callout {
margin: 20px 0;
padding: 15px 30px 15px 15px;
border-left: 5px solid #eee;
}
.bs-callout-danger {
background-color: #fcf2f2;
border-color: #dFb5b4;
}
@christianrojas
christianrojas / Ubuntu_12.10_64Bits_Server.md
Last active December 14, 2015 21:39
Setup Ubuntu Server 12.10 64 bits / VPS / Nginx / Unicorn / Postfix / Add a deploy user / rbenv / Ruby 1.9.3-p392

VPS Setup Ubuntu 12.10

Update Box

sudo apt-get update
sudo apt-get upgrade -y

Install Dependecies

elasticsearchapp|master ⇒ wn add_backup
Webbynode Rapid App Backup
This service will backup a dump of your application Database and the contents
of your application folder to a bucket on Amazon S3. If you don't have an
Amazon S3 account or if you don't know how to create one, please check our
guide on http://guides.webbynode.com/articles/rapidapps/backup.html.
DISCLAIMER: Backing up to S3 will incur on a charge by Amazon according to the
terms of the services contract you accepted when signing up to their services.