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
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Preventing kernel panics - VirtualBox 4.1 and Mac OS X Lion 10.7.
#
# This happens on my Macbook Air Mid-2011 Core i7. Every few hours, with
# one or (particularly) more VMs running, you will get a kernel panic.
#
# Some reading:
# https://www.virtualbox.org/ticket/9359
#!/bin/bash
sudo kextunload -b org.virtualbox.kext.VBoxUSB
sudo kextunload -b org.virtualbox.kext.VBoxNetFlt
sudo kextunload -b org.virtualbox.kext.VBoxNetAdp
sudo kextunload -b org.virtualbox.kext.VBoxDrv
sudo kextload /Library/Extensions/VBoxDrv.kext -r /Library/Extensions/
sudo kextload /Library/Extensions/VBoxNetFlt.kext -r /Library/Extensions/
sudo kextload /Library/Extensions/VBoxNetAdp.kext -r /Library/Extensions/

Create a Meteor app and put the client_/server_ files in a client/server directories. Also, create a public dir to save the uploaded files.

// This gist is meant to help you load a json datafile into a Meteor application. More specifically, it's useful to migrate or bootstrap a Mongo datacollection.
// The easiest way to do this task is to open up three command shell windows.
// As a few of the commands will take over the command shell and direct their output to stdout.
// first, export your data to a file
// data.json
// run mongod so we can create a staging database
// not that this is a separate instance from the meteor mongo and minimongo instances
#!/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';
@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".

@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

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

#!/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"
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