Skip to content

Instantly share code, notes, and snippets.

@jweiss
jweiss / couchdb.deb.txt
Created October 17, 2009 12:20 — forked from roidrage/couchdb.deb.txt
CouchDB packager
#!/bin/sh
# packages CouchDB 0.10.0 on Ubuntu 9.04
export COUCHDB_ROOT=/vol/cr/couchdb
apt-get update
apt-get upgrade -y
apt-get install -y libmozjs-dev spidermonkey-bin libc6 libcurl3 libicu38 libicu-dev libmozjs0d erlang-nox build-essential curl libcurl4-openssl-dev erlang-dev checkinstall wget
cd /tmp
<% memcache_servers = node[:scalarium][:roles][:memcached][:instances].values %>
<% memcache_server_ips = memcache_servers.map{|instance| instance[:private_ip]} %>
<% (['development', 'production'] + [@environment]).uniq.each do |env| -%>
<%= env %>:
host: <%= @memcached[:host] %>
hosts: <%= memcache_server_ips %>
port: <%= @memcached[:port] %>
<% end -%>
@jweiss
jweiss / gist:903788
Created April 5, 2011 15:05 — forked from jedi4ever/gist:903751
Ubuntu Tuning
# /etc/security/limits.conf
* soft nofile 999999
* hard nofile 999999
root soft nofile 999999
root hard nofile 999999
===========================================================
# /etc/sysctl.conf
# sysctl for maximum tuning
@jweiss
jweiss / gist:939696
Created April 24, 2011 16:59
EventMachine vs. REE
#!/usr/bin/env ruby
require 'rubygems'
require 'net/http'
require 'eventmachine'
require 'benchmark'
5.times do
puts "URI get: (%.3fs)" % [Benchmark.realtime{ Net::HTTP.get URI.parse('http://www.google.com') }]
end
@jweiss
jweiss / gist:8062000
Last active December 31, 2015 23:48
Chef UG Hamburg
AWS OpsWorks & Chef:
AWS OpsWorks runs Chef on thousands of customer systems every day.
In this talk we will describe how we bundle and interact with Chef,
highlight differences to Chef server, and summarize our experiences.
pgsql_server = node[:opsworks][:roles][:postgres][:instances].keys.first rescue nil
pgsql_server_ip = node[:opsworks][:roles][:postgres][:instances][pqsql_server][:private_dns_name] rescue nil
aws opsworks --region us-east-1 create-deployment --stack-id 935450cc-61e0-4b03-a3e0-160ac817d2bb --command "{\"Name\":\"deploy\", \"CustomJson\":{\"deploy\":{\"APPSHORTNAME\":{\"scm\":{\"revision\":\"MYBRANCHNAME\"}}}}}"
The JSON structure you want to pass should look like this:
{
"deploy": {
"MYAPPSHORTNAME": {
"scm": {
"revision": "MYGITBRANCH"
redis_port = '6379'
redis_server = node[:opsworks][:layers][:redis][:instances].keys.first rescue nil
if redis_server
node[:deploy].each do |app, config|
template "#{node[:deploy][app][:deploy_to]}/current/config/redis.yml" do
variables :ip => redis_server[:private_ip], :port => redis_port
notifies :restart, resources(:service => 'tomcat')
only_if do
File.exists?("#{node[:deploy][app][:deploy_to]}/current/config/")
{
"opsworks" : {
"ruby_version" : "2.1"
}
}
@jweiss
jweiss / .zsh_prompt.zsh
Created March 7, 2026 21:42
ZSH prompt
# ─── ZSH Prompt ───────────────────────────────────────────────────────────────
autoload -Uz vcs_info
setopt prompt_subst
# ── Git info ──────────────────────────────────────────────────────────────────
# Formats: branch name, with * for unstaged changes, + for staged
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:git:*' check-for-changes true
zstyle ':vcs_info:git:*' unstagedstr '*'
zstyle ':vcs_info:git:*' stagedstr '+'