Skip to content

Instantly share code, notes, and snippets.

View ngpestelos's full-sized avatar

Nestor G Pestelos Jr ngpestelos

View GitHub Profile

Setting up Ruby, Rails, Nginx, Passenger, PostgreSQL 9 on Ubuntu 12.04 LTS for Windows Azure

Last updated: 12/31/2013

Fix the locale issue

  • Edit /etc/default/locale as sudo.
  • Append LC_ALL="en_US.UTF-8" at the end of the file, save and quit.
  • sudo locale-gen en_US en_US.UTF-8
  • sudo dpkg-reconfigure locales

Install the necessary packages to install rbenv and build Ruby

@ngpestelos
ngpestelos / org.postgresql.plist
Created February 21, 2014 02:08
PostgreSQL launchd plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>org.postgresql</string>
<key>ProgramArguments</key>
<array>
@ngpestelos
ngpestelos / initialize-postgresql-osx.md
Created February 21, 2014 01:56
How to initialize PostgreSQL on OS X

Requirements

  • postgresql compiled and installed
  • postgres user created

Steps

su postgres
/opt/local/pgsql/bin/initdb -D /opt/local/pgsql/data
@ngpestelos
ngpestelos / create-postgres-account-terminal.md
Created February 21, 2014 01:36
How to create a postgres account from terminal

Note: Based on this tutorial.

Why

There exists a _postgres account, but I could not switch to it. My solution so far is to create a postgres account to run the PostgreSQL process.

Steps

sudo dscl . -create /Groups/postgres

sudo dscl . -create /Groups/postgres PrimaryGroupID 1000

@ngpestelos
ngpestelos / compile-install-postgresql-osx.md
Created February 21, 2014 01:03
Compile and Install PostgreSQL on OS X

Requirements

  • PostgreSQL source

Steps

Create a destination directory:

sudo mkdir -p /opt/local/pgsql
@ngpestelos
ngpestelos / postgresql-osx.md
Last active July 11, 2023 18:55
How to compile and run PostgreSQL on Mac OS X
@ngpestelos
ngpestelos / .vimrc.after
Created October 8, 2013 03:38
Ramon's vimrc.after
" Many stuff from http://www.drbunsen.org/text-triumvirate.html
" Visual mode unmap
" Bring back the functionality to press shift+e, shift+w, shift+b
" while in visual mode to go to the character right before the next
" whitespace
vunmap E
vunmap W
vunmap B
@ngpestelos
ngpestelos / object_extensions.rb
Created October 1, 2013 20:49
object extensions
# see Metaprogramming Ruby, p. 118
module MyModule
def my_method; 'hello'; end
end
obj = Object.new
class << obj
include MyModule
end
@ngpestelos
ngpestelos / class_extension.rb
Created October 1, 2013 20:32
class extension
# see Metaprogramming Ruby, p. 116
# this will not work
#module MyModule
# def self.my_method; 'hello'; end
#end
module MyModule
def my_method; 'hello'; end
end
class PersonalChef
def make_toast
puts "Making your toast!"
end
def make_milkshake
puts "Making your milkshake!"
end
def make_toast(color)