This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env knife exec | |
# A knife exec script to change chef node's name, preserving all the attributes. | |
# | |
# Usage: knife exec rename-node.rb old-name new-name | |
# | |
# Script retrieves the Node object, changes its 'name' attribute, | |
# creates new Node object with updated name and rest of attributes | |
# untouched. Then it deletes old Node and Client objects from | |
# database, and logs into the server to update it: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import pprint | |
import fnmatch | |
import time | |
import subprocess | |
def find_services_needing_restart(): | |
services = {} | |
pids = [ f for f in os.listdir('/proc') if f.isdigit() and os.path.isdir(os.path.join('/proc', f)) ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e # exit immediately if a simple command exits with a non-zero status | |
set -u # report the usage of uninitialized variables | |
STEMCELLS_DIR=${STEMCELLS_DIR:-/var/vcap/store/stemcells} | |
RELEASES_DIR=${REPOS_DIR:-/var/vcap/store/releases} | |
REPOS_DIR=${REPOS_DIR:-/var/vcap/store/repos} | |
CF_RELEASE_BRANCH=${CF_RELEASE_BRANCH:-staging} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## mysql::master | |
ruby_block "store_mysql_master_status" do | |
block do | |
node.set[:mysql][:master] = true | |
m = Mysql.new("localhost", "root", node[:mysql][:server_root_password]) | |
m.query("show master status") do |row| | |
row.each_hash do |h| | |
node.set[:mysql][:master_file] = h['File'] | |
node.set[:mysql][:master_position] = h['Position'] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# This is a user-data script that launches an instance, and then sets | |
# it up to be able to publish a daily or released build as easy as | |
# possible. use: | |
# euca-run-instances <some-ami> --user-data-file <this file> --key mykey | |
# | |
# Then, copy credentials to the instance and read 'README' | |
# | |
# gist: https://gist.github.com/1231973 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <unistd.h> | |
#include <CoreServices/CoreServices.h> | |
#include <ApplicationServices/ApplicationServices.h> | |
typedef int CGSConnection; | |
extern OSStatus CGSGetWorkspace(const CGSConnection cid, int *workspace); | |
extern OSStatus CGSSetWorkspace(const CGSConnection cid, int workspace); | |
extern CGSConnection _CGSDefaultConnection(void); | |
int get_space_id(void); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Day job: System Architect at WordStream | |
Favorite Python project: Fabric | |
Favorite Conference: WWDC | |
Python Experience Level: intermediate |