Skip to content

Instantly share code, notes, and snippets.

View millisami's full-sized avatar
🎯
Focusing on landing a Web3 Job

Sachin Sagar Rai millisami

🎯
Focusing on landing a Web3 Job
View GitHub Profile
@millisami
millisami / bash_profile.sh
Created July 27, 2012 07:41 — forked from spheromak/bash_profile.sh
bashrc and simple aliases for managing multiple chef envs
#
# Need to move your initial ~/.chef to ~/.chef-ENV
#
alias prod="rm ~/.chef; ln -sf ~/.chef-prod ~/.chef; export CHEF_ENV=prod"
alias dev="rm ~/.chef; ln -sf ~/.chef-dev ~/.chef; export CHEF_ENV=dev"
function knife_env {
if [ -e ~/.chef ] ; then
# gls on osx/homebrew assumes you have installed gnu fileutils. change to ls on linux
echo `gls -dl --indicator-style=none ~/.chef | awk -F- '{print $5}'`
ec2-23-20-198-99.compute-1.amazonaws.com [Fri, 20 Jul 2012 05:22:24 +0000] INFO: Chef Run complete in 477.254228577 seconds
ec2-23-20-198-99.compute-1.amazonaws.com [Fri, 20 Jul 2012 05:22:24 +0000] INFO: Running report handlers
ec2-23-20-198-99.compute-1.amazonaws.com [Fri, 20 Jul 2012 05:22:24 +0000] ERROR: Report handler MailHandler raised #<Gem::LoadError: Could not find highline (>= 1.6.9) amongst [god-0.12.1]>
ec2-23-20-198-99.compute-1.amazonaws.com [Fri, 20 Jul 2012 05:22:24 +0000] ERROR: /opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs'
ec2-23-20-198-99.compute-1.amazonaws.com [Fri, 20 Jul 2012 05:22:24 +0000] ERROR: /opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:451:in `block in find_in_unresolved'
ec2-23-20-198-99.compute-1.amazonaws.com [Fri, 20 Jul 2012 05:22:24 +0000] ERROR: /opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:451:in `map'
ec2-23-20-198-99.compute-1.amazonaws.com [Fri, 20 Jul 2012 05:22:24 +0000] ERROR: /
@millisami
millisami / gist:3148874
Created July 20, 2012 05:33 — forked from igrigorik/gist:3148848
Convert any YouTube video into an audio file you can listen to on the go...
# Convert any YouTube video into an audio file you can listen to on the go, using:
# http://rg3.github.com/youtube-dl/
{ ~ } > brew install ffmpeg
{ ~ } > brew install ffprobe
{ ~ } > wget https://raw.github.com/rg3/youtube-dl/2012.02.27/youtube-dl
{ ~ } > chmod u+x youtube-dl
# Pick which video format you want to download.. (use any YT video link)
@millisami
millisami / gist:3082814
Created July 10, 2012 11:41
ruby 1.9.3-p194 with performance patches built into a .deb package with fpm
# AMI: ubuntu/images/ebs/ubuntu-precise-12.04-amd64-server-20120424 (ami-a29943cb)
#
# Part 1: Make a deb package of ruby:
# Get our deps
sudo apt-get install python-setuptools python-dev build-essential dpkg-dev libopenssl-ruby ruby1.8-dev rubygems bison autoconf zlib1g zlib1g-dev libreadline6 libreadline6-dev libssl0.9.8 libssl-dev
# Get ruby
wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
tar -zxvf ruby-1.9.3-p194.tar.gz
@millisami
millisami / cookbook_test.rb
Created July 7, 2012 16:07 — forked from jtimberman/cookbook_test.rb
save this as ~/.chef/plugins/knife/cookbook_test.rb and it will be used by 'knife cookbook test'
# NOTE: The foodcritic args option (--lint-args) has not been tested
#
# Author:: Adam Jacob (<[email protected]>)
# Author:: Matthew Kent (<[email protected]>)
# Author:: Joshua Timberman (<[email protected]>)
# Copyright:: Copyright (c) 2009-2012 Opscode, Inc.
# Copyright:: Copyright (c) 2010 Matthew Kent
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
bash -c '
<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
export LANG=en_US.UTF-8
apt-get update
if [ ! -f /usr/bin/chef-client ]; then
apt-get update
apt-get upgrade -y
@millisami
millisami / Output
Created June 17, 2012 09:52 — forked from bdurand/benchmark_bundle.rb
Benchmark Your Bundle
gem user system total real
-----------------------------------------------------------
cancan 1.283000 0.236000 1.519000 1.852234
email_spec 0.767000 0.094000 0.861000 1.024380
capistrano 0.663000 0.096000 0.759000 0.952636
fb_graph 0.574000 0.094000 0.668000 0.714888
omniauth-openid 0.554000 0.048000 0.602000 0.657076
selenium-webdriver 0.258000 0.048000 0.306000 0.529047
pry-nav 0.253000 0.038000 0.291000 0.367863
resque-scheduler 0.290000 0.035000 0.325000 0.366776
@millisami
millisami / knife.rb
Created June 14, 2012 10:20 — forked from jtimberman/knife.rb
Commented knife.rb for all the things
# Knife Configuration File.
#
# This is a Ruby DSL to set configuration parameters for Knife's
# general options. The default location for this file is
# ~/.chef/knife.rb. If multiple Chef repositories are used,
# per-repository configuration files can be created. A per repository
# configuration file must be .chef/knife.rb in the base directory of
# the Chef repository. For example,
#
# ~/Development/chef-repo/.chef/knife.rb
@millisami
millisami / multi_env_knife_config
Created June 3, 2012 00:25 — forked from kevinkarwaski/multi_env_knife_config
Knife config for Multiple Chef Environments
#
# This is an example of a knife.rb configuration that uses yml and a
# simple env var (CHEF_ENV) to manage multiple hosted Chef environments.
#
# Example usage:
# export CHEF_ENV=evnironment_01
# knife status
#
# Based on: http://blog.blankpad.net/2010/09/28/multiple-knife-environments---the-return/
#
@millisami
millisami / service
Created May 22, 2012 11:42 — forked from brentkirby/service
Unicorn + Runit + RVM
#!/bin/bash -e
#
# Since unicorn creates a new pid on restart/reload, it needs a little extra love to
# manage with runit. Instead of managing unicorn directly, we simply trap signal calls
# to the service and redirect them to unicorn directly.
#
# To make this work properly with RVM, you should create a wrapper for the app's gemset unicorn.
#
function is_unicorn_alive {