Skip to content

Instantly share code, notes, and snippets.

View sjourdan's full-sized avatar

Stephane Jourdan sjourdan

View GitHub Profile
@sjourdan
sjourdan / chef-ec2.rake
Created September 5, 2011 12:57 — forked from apsoto/chef-ec2.rake
Chef EC2 Node Cleanup task
namespace :ec2 do
# setup chef config
# assumes this file is sibling to .chef dir, ex: CHEF_REPO/tasks
config = File.join(File.dirname(__FILE__), '..', '.chef', 'knife.rb')
Chef::Config.from_file(config)
require 'active_support'
require 'aws'
desc 'Delete any ec2-based chef nodes that no longer exist'
@sjourdan
sjourdan / gist:3873029
Created October 11, 2012 15:05
git reset --soft HEAD~1
git reset --soft HEAD~1
@sjourdan
sjourdan / gist:3891785
Created October 15, 2012 10:04
shef isolate dev hosts
search(:node, "chef_environment:dev") do |matching_node|
puts matching_node.to_s
end
#!/bin/bash
PATHPATCH="/root/patch-ovh"
PATHRCS="/etc/default"
PATHCHECK="/etc/init.d"
PATHINITTAB="/etc"
ECHO="/bin/echo"
APTGET="/usr/bin/apt-get"
WGET="/usr/bin/wget"
RM="/bin/rm"

Keybase proof

I hereby claim:

  • I am sjourdan on github.
  • I am sjourdan (https://keybase.io/sjourdan) on keybase.
  • I have a public key whose fingerprint is 31D1 CFDB DF8F 1B53 82A1 2FCF 204B F835 CEFF 35EF

To claim this, I am signing this object:

@sjourdan
sjourdan / The Operations Report Card.md
Last active December 24, 2023 16:35
The Operations Report Card

The Operations Report Card

Source: http://www.opsreportcard.com/.

Public Facing Practices

  1. Are user requests tracked via a ticket system?
  2. Are "the 3 empowering policies" defined and published?
  3. Does the team record monthly metrics?
@sjourdan
sjourdan / custom.erb
Created March 18, 2015 15:26
custom.erb
<% if @port != 80 -%>
Listen <%= @port %>
<% end -%>
<VirtualHost *:<%= @port %>>
ServerAdmin webmaster@localhost
DocumentRoot <%= @document_root %>
<Directory />
Options FollowSymLinks
@sjourdan
sjourdan / cloud-init-with-chef.yml
Created April 13, 2015 09:57
cloud-init with Chef provisionning + register
#cloud-config
users:
- name: demo
sudo: ['ALL=(ALL) NOPASSWD:ALL']
groups: sudo
shell: /bin/bash
chef:
install_type: "omnibus"
@sjourdan
sjourdan / Cloud Abacus.md
Created May 12, 2015 19:45
Cloud Abacus

Creating a Cloud Abacus Easy

This is going to be another scripting challenge.... you may use any language tools you want to solve it.

The task is to create two scripts (or one script with a symlink, whatevs) that will take as its only argument a 4 bit integer value (0-15) and create a file with a path based on the bit pattern. The directories should be created with the most significant bit first and will be named either "0" or "1" depending on the value of the bit in that position.

The first script should be called /usr/local/bin/seta and will use /var/math/a as its root directory. The second script will be /usr/local/bin/setb and use /var/math/b for its root. So, calling /usr/local/bin/seta 10 should create the directory /var/math/a/1/0/1/0/. Any files in the subdirectories will be ignored.

Your script should clear its target directory (/var/math/[a|b]) before writing files to ensure that data from previous runs will be removed. A third script called /usr/local/bin/adder has been provided and will add