Skip to content

Instantly share code, notes, and snippets.

View lvnilesh's full-sized avatar
💭
🏆 Vibranium Status Level

LV Nilesh lvnilesh

💭
🏆 Vibranium Status Level
View GitHub Profile
1021 rberger $ knife cookbook bulk delete '.*' -p -c ~/.chef.production/knife.rb
[
"activemq",
"apache2",
"apparmor",
"application",
"apt",
"aws",
"boost",
"bootstrap",
@lvnilesh
lvnilesh / Cheffile
Created December 13, 2012 23:10 — forked from anonymous/Cheffile
#!/usr/bin/env ruby
#^syntax detection
site 'http://community.opscode.com/api/v1'
cookbook 'apache2'
@lvnilesh
lvnilesh / rubber
Created December 16, 2012 19:18 — forked from anonymous/rubber
➜ Projects rails new app -d postgresql
create
create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/images/rails.png
create app/assets/javascripts/application.js
# Ruby file to use the Google Prediction API, with a very hacked OAuth2
# You'll want to replace all the custom variables including..
# 1. Your google storage bucket name
# 2. Your google storage access credentials (note that gstore only works with "legacy" google storage access so you'll need to enabled this)
# 3. Your OAuth credentials which you setup from here https://code.google.com/apis/console/ by selecting "API Access"
# Note that I choose "Create client ID" and then "Installed Application".
#
# This script is intended to be run as a regular background process (like a cron job) to process data. It has no access to a browser and no web server to expose a callback url. Hence the hacking of OAuth2. This seems completely wrong to me but I haven't gotten any other authentication with the API to work. If anyone knows a better way please post a comment!
#
class CreateOauth2s < ActiveRecord::Migration
def self.up
create_table :oauth2s do |t|
t.string :api
t.string :refresh_token
t.string :access_token
t.datetime :expires_at
t.timestamps
end
#!/usr/bin/env/ruby
require 'socket'
# AWS API Credentials
AWS_ACCESS_KEY_ID = "your-aws-access-key-id"
AWS_SECRET_ACCESS_KEY = "your-aws-secret-access-key"
# Node details
NODE_NAME = "webserver-01.example.com"

Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

This guide enables you to install (ruby-build) and use (rbenv) multiple versions of ruby, isolate project gems (gemsets and/or bundler), and automatically use appropriate combinations of rubies and gems.

TL;DR Demo

# Ensure system is in ship-shape.

sudo apt-get install -y git zsh libssl-dev zlib1g-dev libreadline-dev libyaml-dev

@lvnilesh
lvnilesh / installruby.sh
Last active December 13, 2015 23:29 — forked from jasoncodes/gist:1223731
rbenv and ruby install
# The latest version of this script is now available at
# https://github.com/jasoncodes/dotfiles/blob/master/aliases/rbenv.sh
VERSION=1.9.3-p392
brew update
brew install rbenv ruby-build rbenv-vars readline ctags
if [ -n "${ZSH_VERSION:-}" ]; then
echo 'eval "$(rbenv init - --no-rehash)"' >> ~/.zshrc
else
echo 'eval "$(rbenv init - --no-rehash)"' >> ~/.bash_profile
@lvnilesh
lvnilesh / capistrano-readme.md
Created February 21, 2013 23:31 — forked from jrochkind/gist:2161449
A Capistrano Rails Guide

A Capistrano Rails Guide

by Jonathan Rochkind, http://bibwild.wordpress.com

why cap?

Capistrano automates pushing out a new version of your application to a deployment location.

I've been writing and deploying Rails apps for a while, but I avoided using Capistrano until recently. I've got a pretty simple one-host deployment, and even though everyone said Capistrano was great, every time I tried to get started I just got snowed under not being able to figure out exactly what I wanted to do, and figured I wasn't having that much trouble doing it "manually".

#!/bin/sh
curl http://phantomjs.googlecode.com/files/phantomjs-1.6.1-linux-x86_64-dynamic.tar.bz2 | bunzip2 -c | tar x
mv phantomjs-1.6.1-linux-x86_64-dynamic phantomjs
cat > foo.js <<EOF
var page = require('webpage').create();
url = 'http://vt.londhe.com';