Skip to content

Instantly share code, notes, and snippets.

sysadmins = search(:users, 'groups:sysadmin')
sysadmin_group = Array.new
sysadmins.each do |u|
sysadmin_group << u['id']
u['openid'].each do |oid|
node[:apache][:allowed_openids] << oid unless node[:apache][:allowed_openids].include?(oid)
end if u['openid']
@mislav
mislav / pagination.md
Created October 12, 2010 17:20
"Pagination 101" by Faruk Ateş

Pagination 101

Article by Faruk Ateş, [originally on KuraFire.net][original] which is currently down

One of the most commonly overlooked and under-refined elements of a website is its pagination controls. In many cases, these are treated as an afterthought. I rarely come across a website that has decent pagination, and it always makes me wonder why so few manage to get it right. After all, I'd say that pagination is pretty easy to get right. Alas, that doesn't seem the case, so after encouragement from Chris Messina on Flickr I decided to write my Pagination 101, hopefully it'll give you some clues as to what makes good pagination.

Before going into analyzing good and bad pagination, I want to explain just what I consider to be pagination: Pagination is any kind of control system that lets the user browse through pages of search results, archives, or any other kind of continued content. Search results are the o

current_dir = File.dirname(__FILE__)
platform = "https://api.opscode.com/organizations"
require 'grit'
branch = Grit::Repo.new("#{current_dir}/..").head.name
case branch
when "internal"
url = "http://virt1test.int.example.org:4000"
validator = ""
#!/usr/bin/env ruby
require 'rubygems'
require 'chef'
require 'chef/client'
require 'chef/run_context'
Chef::Config[:solo] = true
Chef::Config[:log_level] = :info
Chef::Log.level(:info)
@fujin
fujin / chef.rb
Created October 30, 2010 02:09
this one gets monkeypatched into a library. I called mine cookbooks/libsonian/libraries/signed_url.rb & chef.rb
class Chef
class Provider
class RemoteS3File < Chef::Provider::RemoteFile
def load_current_resource
super
%w{bucket object_name aws_access_key_id aws_secret_access_key}.map do |attribute|
Chef::Application.fatal! "remote_s3_file: required attr: #{attribute} is nil", -92 if
@new_resource.send(attribute.to_sym).nil?
end
@bryanl
bryanl / tmux.conf
Created November 30, 2010 05:17
I copied this from somewhere. It is a good start, though
# ~/.tmux.conf
#
# See the following files:
#
# /opt/local/share/doc/tmux/t-williams.conf
# /opt/local/share/doc/tmux/screen-keys.conf
# /opt/local/share/doc/tmux/vim-keys.conf
#
# URLs to read:
#
@mrflip
mrflip / gist:766608
Created January 5, 2011 17:15
Elasticsearch shell config
We couldn’t find that file to show.
# Use Chef resources in an application via solo mode.
# Could also be configured in client mode, and then use a server.
require 'rubygems'
require 'chef'
require 'chef/client'
require 'chef/run_context'
Chef::Config[:solo] = true
Chef::Config[:log_level] = :info
@octplane
octplane / changes.sh
Created April 19, 2011 15:54
Quickly upload changes to a chef server (0.8)
#!/bin/sh
diff -x .gitignore -x .DS_Store -x metadata.json -x "README" -qr cookbooks/ /srv/chef/cookbooks/ | grep -v "Only in
/srv/chef/cookbooks/" | sed -e "s/.*cookbooks\/[ :]*//;s/\/.*//;s/:.*//" | sort | uniq | xargs knife cookbook upload
for a in `diff -x .gitignore -x metadata.json -x "README" -qr cookbooks/ /srv/chef/cookbooks/ | grep "Only in /srv/
chef/cookbooks/" | sed -e "s/.*cookbooks\/[ :]*//;s/\/.*//;s/:.*//" | sort | uniq`; do
echo "y" | knife cookbook delete $a
done
@roidrage
roidrage / mantras.md
Created April 21, 2011 16:18
7 Mantras of Successful Infrastructure
  • The network is reliable.
  • Latency is zero.
  • Bandwidth is infinite.
  • The network is secure.
  • Topology doesn't change.
  • There is one administrator.
  • Transport cost is zero.
  • The network is homogeneous.