Skip to content

Instantly share code, notes, and snippets.

@harlanbarnes
harlanbarnes / README.md
Created January 4, 2022 20:49
DevOps Interview Project

DevOps Project

Description

An entry-level developer needs help making their application containerized for deployment. You have volunteered to create a pull request that will include all the changes necessary to make the service ready.

Unfortunately, there are no unit tests for this API, so we'll need to do some manual testing to make sure we have the build correct. We'll let the developer

@harlanbarnes
harlanbarnes / using-ssh-proxycommand-bypass-filter.md
Last active December 12, 2018 05:21
Using SSH ProxyCommand to Bypass Filtering

Overview

If you are in a location that allows SSH but doesn't allow access to GitHub (I'm looking at you India), here's an easy way to get around it.

Prerequisites

  1. You need a shell account on a network that doesn't filter GitHub. Ideas for that:
    1. Pay but Cheap: A micro instance on EC2 http://aws.amazon.com/ec2/pricing/
    2. Free-ish: One of the free shell solutions http://shells.red-pill.eu/
  2. The shell account will need access to the netcat binary called nc http://nc110.sourceforge.net/
@harlanbarnes
harlanbarnes / types.rb
Last active August 29, 2015 14:06
Generating ruby code from JSON or other ruby objects ...
#!/usr/bin/env ruby
def typecast(obj)
if obj.is_a?(Hash) || obj.is_a?(Array)
# hashes and arrays will be inspected to display properly
obj.inspect
elsif obj.is_a?(Fixnum) || obj.is_a?(Float) ||
obj.is_a?(TrueClass) || obj.is_a?(FalseClass)
# these are just plain (that is obj.to_s does what we want)
obj
@harlanbarnes
harlanbarnes / gist:934a765696e562071f9e
Last active August 29, 2015 14:02
Multi-VM .kitchen.yml
---
driver:
name: vagrant
synced_folders:
- ["./", "/vagrant"]
provisioner:
name: chef_zero
platforms:
@harlanbarnes
harlanbarnes / gist:11271510
Created April 24, 2014 22:20
onsite-vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'lxc'
Vagrant.require_plugin 'vagrant-triggers'
Vagrant.configure("2") do |config|
config.ssh.forward_agent = true
@harlanbarnes
harlanbarnes / gist:11151382
Last active August 29, 2015 14:00
Hack to work around cookbooks experiencing CHEF-4107
require 'spec_helper'
describe 'foo::default' do
let(:chef_run) do
ChefSpec::Runner.new do |node|
# Holy Hack - This bug: https://tickets.opscode.com/browse/CHEF-4107
# in the pleaserun cookbook (which is depended on by the logstash
# cookbook). As such, the rspec fails. So I'm cleaning them out before
# we converge
@harlanbarnes
harlanbarnes / gist:7160949
Last active December 26, 2015 13:49
Mixlib Shellout
shell = Mixlib::ShellOut.new("whatever the command is")
shell.run_command
if /^regex-me$/.match(shell.stdout)
node.default['site']['virtualbox'] = true
else
node.default['site']['virtualbox'] = false
end
@harlanbarnes
harlanbarnes / homework.rb
Created September 26, 2013 00:04
Homework
#!/usr/bin/ruby
# our dictionary file
WORDS = 'english.txt'
# build the letter-to-point map
letters = Hash.new
count = 0
('a'..'z').to_a.each do |x|
count += 1
site :opscode
metadata
cookbook 'pgirepo', chef_api: :config
group :integration do
cookbook "minitest-handler"
end
@harlanbarnes
harlanbarnes / gist:5752227
Created June 10, 2013 20:57
oracle java jdk tar/gunzip unexpected EOF
mkdir("/tmp/d20130610-1497-jyjm25", 0700) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
pipe([8, 9]) = 0
fstat(8, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
fstat(9, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
fcntl(8, F_GETFL) = 0 (flags O_RDONLY)
fstat(8, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
ioctl(8, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fffef44a540) = -1 EINVAL (Invalid argument)
fcntl(9, F_GETFL) = 0x1 (flags O_WRONLY)
fstat(9, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0