Skip to content

Instantly share code, notes, and snippets.


Ranjib Dey ranjib

View GitHub Profile
ranjib / timer_reset.go
Created Jan 17, 2018
reef-pi reset timers
View timer_reset.go
package main
import (
const bucket = "timers"
View dd-user.txt
Received: by with SMTP id g4csp30259wjv;
Tue, 30 Aug 2016 13:32:34 -0700 (PDT)
X-Received: by with SMTP id t85mr5521820oih.202.1472589154488;
Tue, 30 Aug 2016 13:32:34 -0700 (PDT)
Return-Path: <>
Received: from ( [])
by with ESMTPS id o41si11702005oto.113.2016.
for <>
(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);
ranjib / squash.go
Last active May 25, 2016
docker image squashing
View squash.go
func Squash() {
defaultHeaders := map[string]string{"User-Agent": "abc-1.0"}
cli, _ := client.NewClient("unix:///var/run/docker.sock", "v1.22", nil, defaultHeaders)
ctx := context.Background()
saveBody, _ := cli.ImageSave(ctx, []string{"image-id"})
src := types.ImageImportSource{
ranjib / org1-prod.rb
Created Jun 18, 2015
Consuming common datra across environments using Chef's ruby environment DSL
View org1-prod.rb
# located at chef_repo/environments/org1-prod.rb
require 'deep_merge'
name 'org1-prod'
description 'Production environment for org1'
org1_yml_path = File.expand_path('../common/org1.yml', __FILE__)
common = YAML.load_file(org1_yml_path)
# declare all you org1-prod specific things here.
ranjib / upgrade.rb
Last active Aug 29, 2015
Upgrade chef
View upgrade.rb
config(:chef, node_name: 'foo', client_key: '/path/to/client.pem', chef_server_url: '')
config(:ssh, user: 'foo', password: 'bar')
'sudo apt-get remove chef --purge -y',
'sudo rm -rf /opt/chef',
'sudo rm -rf /etc/chef/client.d',
'wget -c',
'sudo dpkg -i chef-xxx.deb',
'sudo env -i /opt/chef/bin/chef-client',
'rm chef-xxx.deb'
View test.rb
execute 'apt-get source redis-server=2:2.8.19-3' do
cwd '/opt/foo'
creares '/opt/foo/redis-2.8.19'
View chef_dns_zone_with_serial_number.rb
# Using chef to create files with a time stamp or similar - in this case,
# the serial number in a DNS zone file - presents a problem, because the
# time stamp interferes with with idempotency. Here is a trick for solving
# this (thanks to Noah Kantrowitz for his input and suggestion!)
# The trick is to use the same template twice, once with a constant serial
# number to check for idempotency, and a second time with the "real" serial
# number. The actual serial number can be stored in an attribute.
# Initial serial number for the zone
ranjib / recipe_spec.rb
Last active Aug 29, 2015
ChefSpec memoization
View recipe_spec.rb
let(:runner) do
memoized_runner('pd-gocd::agent') do |node|

Thanks for wanting to contribute to Chef! There are many ways to get involved in various areas of the project, tools, and documentation. This document will help you get started; the links below point to how-to-contribute information for each project.

An Overview of the Main Projects under the Chef Umbrella

The Chef Client

The Chef Development Kit

View recipe_spec.rb
describe 'recipe[doit]' do
before(:each) do
it 'some awesome specs do here' do
# assertion
You can’t perform that action at this time.