Skip to content

Instantly share code, notes, and snippets.

View kenmazaika's full-sized avatar

ken mazaika kenmazaika

View GitHub Profile
@kenmazaika
kenmazaika / places_controller_test.rb
Created January 16, 2015 01:32
Somes Tests for Nomster's PlacesController
require 'test_helper'
class PlacesControllerTest < ActionController::TestCase
test "index" do
FactoryGirl.create(:place)
get :index
assert_response :success
end
sudo mv /var/lib/pgsql9/data/postgresql.conf /var/lib/pgsql9/data/postgresql-old.conf
sudo curl -o /var/lib/pgsql9/data/postgresql.conf https://gist.githubusercontent.com/kenmazaika/7bc24fb5541de023fbc8b942e05a1c5c/raw/faa529be3b46eb036229114c15faffa9acbf43a0/postgresql.conf
sudo mv /var/lib/pgsql9/data/pg_hba.conf /var/lib/pgsql9/data/pg_hba-old.conf
sudo curl -o /var/lib/pgsql9/data/pg_hba.conf https://gist.githubusercontent.com/kenmazaika/75d310aaf1509a8a8f95c28cc7c14202/raw/9a681b510fdaac78fbe3c4aa955a101b9fad6487/pg_hba.conf
sudo /etc/init.d/postgresql start
sudo sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'password';"
sudo sudo -u postgres psql -c "UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';"
sudo sudo -u postgres psql -c "DROP DATABASE template1;"
sudo sudo -u postgres psql -c "CREATE DATABASE template1 WITH TEMPLATE = template0 ENCODING = 'UNICODE';"
sudo sudo -u postgres psql -c "UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1'
class LinkedListNode
attr_accessor :value, :next_node
def initialize(value, next_node=nil)
@value = value
@next_node = next_node
end
end
class Stack
@kenmazaika
kenmazaika / text.rb
Created March 17, 2015 20:39
Example from theFirehoseProject Prework, Lesson #18
text = "Today, I wrote code"
puts text
puts text
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<h1 id="headline">Hi Karla</h1>
<button id="btn">Click me!!!</button>
<script>
// var movieName = "Sharknado";
// var apiKey = "4ce5edcc";
// var queryURL = "http://www.omdbapi.com/?t=" + movieName + "&apikey=" + apiKey;
sudo yum install -y postgresql postgresql-server postgresql-devel postgresql-contrib postgresql-docs
sudo service postgresql initdb
sudo mv /var/lib/pgsql9/data/postgresql.conf /var/lib/pgsql9/data/postgresql-old.conf
sudo curl -o /var/lib/pgsql9/data/postgresql.conf https://gist.githubusercontent.com/kenmazaika/1beee173b4b9172c27b165a722edb849/raw/7bf8880d9ae32e80c08f79a22713b5c68b1ddece/postgres.conf
sudo mv /var/lib/pgsql9/data/pg_hba.conf /var/lib/pgsql9/data/pg_hba-old.conf
sudo curl -o /var/lib/pgsql9/data/pg_hba.conf https://gist.githubusercontent.com/kenmazaika/3c14af3e78f12be2bc11d806e2a2f0ec/raw/32eef13ac302e6d10158a18f8d13d0e6120b19c2/pg_hba.conf
sudo service postgresql restart
sudo sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'password';"
sudo sudo -u postgres psql -c "UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';"
sudo sudo -u postgres psql -c "DROP DATABASE template1;"
curl https://toolbelt.heroku.com/install.sh | sh
echo 'PATH="/usr/local/heroku/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
heroku
sudo yum install -y postgresql postgresql-server postgresql-devel postgresql-contrib postgresql-docs
sudo service postgresql initdb
sudo mv /var/lib/pgsql9/data/postgresql.conf /var/lib/pgsql9/data/postgresql-old.conf
sudo curl -o /var/lib/pgsql9/data/postgresql.conf https://gist.githubusercontent.com/kenmazaika/1beee173b4b9172c27b165a722edb849/raw/7bf8880d9ae32e80c08f79a22713b5c68b1ddece/postgres.conf
sudo mv /var/lib/pgsql9/data/pg_hba.conf /var/lib/pgsql9/data/pg_hba-old.conf
sudo curl -o /var/lib/pgsql9/data/pg_hba.conf https://gist.githubusercontent.com/kenmazaika/3c14af3e78f12be2bc11d806e2a2f0ec/raw/32eef13ac302e6d10158a18f8d13d0e6120b19c2/pg_hba.conf
sudo service postgresql restart
sudo sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'password';"
sudo sudo -u postgres psql -c "UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';"
sudo sudo -u postgres psql -c "DROP DATABASE template1;"
# PostgreSQL Client Authentication Configuration File
# ===================================================
#
# Refer to the "Client Authentication" section in the PostgreSQL
# documentation for a complete description of this file. A short
# synopsis follows.
#
# This file controls: which hosts are allowed to connect, how clients
# are authenticated, which PostgreSQL user names they can use, which
# databases they can access. Records take one of these forms:
sudo yum install -y postgresql postgresql-server postgresql-devel postgresql-contrib postgresql-docs
sudo service postgresql initdb
sudo mv /var/lib/pgsql9/data/postgresql.conf /var/lib/pgsql9/data/postgresql-old.conf
sudo curl -o /var/lib/pgsql9/data/postgresql.conf https://gist.githubusercontent.com/kenmazaika/1beee173b4b9172c27b165a722edb849/raw/7bf8880d9ae32e80c08f79a22713b5c68b1ddece/postgres.conf
echo -e "\n\nhost all postgres 127.0.0.1/0 trust" >> /var/lib/pgsql9/data/pg_hba.conf
sudo service postgresql restart
sudo sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'password';"
sudo sudo -u postgres psql -c "UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';"
sudo sudo -u postgres psql -c "DROP DATABASE template1;"
sudo sudo -u postgres psql -c "CREATE DATABASE template1 WITH TEMPLATE = template0 ENCODING = 'UNICODE';"