Skip to content

Instantly share code, notes, and snippets.

@jweiss
jweiss / .zshrc
Created March 7, 2026 21:44
ZSH rc
alias ll="ls -aslFh"
export EDITOR="/usr/local/bin/mate -w"
# Homebrew Ruby
export PATH="/opt/homebrew/opt/ruby/bin:/opt/homebrew/lib/ruby/gems/3.4.0/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/ruby/lib"
export CPPFLAGS="-I/opt/homebrew/opt/ruby/include"
# Prompt
source ~/.zsh_prompt.zsh
@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 '+'
{
"opsworks" : {
"ruby_version" : "2.1"
}
}
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/")
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"
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
@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.
@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: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
<% 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 -%>