Skip to content

Instantly share code, notes, and snippets.

@d
d / refresh_ssh_env.sh
Created June 25, 2012 17:13
tmux refresh ssh env var
eval $(tmux showenv | grep -v ^- | sed 's/=\(.\+\)/="\1"/')
@d
d / bvt.log
Created October 3, 2012 18:32
bvt 1
$ bundle exec rake full[1]
target read from ENV: ccng.cf43.dev.las01.vcsops.com
normal user read from /Users/jesse/.bvt/config.yml: [email protected]
rspec --format Fuubar --color spec/ --tag ~admin
Run options: exclude {:admin=>true}
1) BVT::Spec::AutoStaging::JavaSpring Start Spring Web Application with no service dependencies
Failure/Error: response.response_code.should == 200
expected: 200
got: 404 (using ==)
# ./spec/autostaging/java_spring_spec.rb:144:in `block (2 levels) in <top (required)>'
@d
d / bvtv1.log
Created October 3, 2012 19:20
v1 bvt
$ export VCAP_BVT_TARGET=ccng.cf43.dev.las01.vcsops.com VCAP_BVT_USER_PASSWD=tester VCAP_BVT_CCNG_V1_TEST=true
$ bundle exec rake full[1]
target read from ENV: ccng.cf43.dev.las01.vcsops.com
normal user read from /Users/jesse/.bvt/config.yml: [email protected]
rspec --format Fuubar --color spec/ --tag ~admin
Run options: exclude {:admin=>true}
1) BVT::Spec::ServiceLifecycle::Ruby19Sinatra Take mysql snapshot and rollback to a certain snapshot
Failure/Error: get_snapshots(service_id)
RuntimeError:
code:500, body:{"code":10001,"description":"Server error"}
@d
d / p.c
Created October 3, 2012 23:50
popen-leaks
#include <stdio.h>
int main(){
/* foo for leak */
FILE *foo = fopen("foo", "r");
if (!foo)
return 1;
char buf[256];
/* read one byte */
if (!fread(buf, 1, 1, foo))
@d
d / git-log2
Last active December 14, 2015 15:59
modified dot dot dot
#!/bin/bash
set -e -u -x
rev1=${1:-origin/master}
rev2=${2:-HEAD}
git log --graph --decorate --oneline $rev1 $rev2 --not $(git rev-list --parents --max-count 1 $(git merge-base $rev1 $rev2) | cut -d" " -f2- )
@d
d / parent-filter.rb
Last active December 16, 2015 00:39
splitting mpgw
#!/usr/bin/env ruby
def execute(cmd)
stdout = `#{cmd}`
if $?.success?
return stdout
end
raise "execution of command \"#{cmd}\" failed. Status: #{$?}"
end
args = readline.split
@d
d / config.fish
Last active March 3, 2021 07:42
fish_prompt with git branch
set -x GIT_EDITOR "mvim -f"
# until fish 2.2, we'll have to do this
set PATH (brew --prefix)/bin $PATH
complete -f -c git -n '__fish_git_using_command pull' -l ff-only -d 'Refuse to merge unless fast-forward possible'
complete -f -c git -n '__fish_git_using_command pull' -l rebase -d 'Rebase instead of merge'
complete -c git -n '__fish_git_using_command commit' -s v -l verbose -d 'Show diff in commit message template'
complete -c git -n '__fish_git_using_command commit' -s a -l all -d 'Commit all changed files'
@d
d / provision.sh
Created October 21, 2014 23:46
how to make that AMI for Reider
#!/bin/bash
# Everything in this script runs as root
set -e -u
user=tempest
user_dir="/home/${user}"
echo "--- Installing libyaml manually"
@d
d / README.md
Last active August 29, 2015 14:08
How to use the Reider AMI
  • Launch the instance into your VPC
  • ssh -A ubuntu@$PUBLIC_IP
  • cd ~/tempest.git; git fetch
  • sudo su - tempest # using the password i tell you
  • cd ~/tempest-web; git pull --ff-only ~ubuntu/tempest.git origin/master
  • cd ~/tempest-web/web; bin/bundle --without test --deployment && env BUNDLE_GEMFILE=bosh.Gemfile bin/bundle --deployment
  • edit the config/database.yml to change the database user name to tempest
  • cd ~/tempest-web/web; bundle exec rake db:create db:migrate RAILS_ENV=development
  • Inside /tempest-web/web/.env file, search and replace "/workspace/installation/" with "~/tempest-web/"
  • env TEMPEST_INFRASTRUCTURE=aws bin/rails s
@d
d / yo.bash
Last active August 29, 2015 14:17
install docker on a Mac
#!/bin/bash
set -e -u
set -x
_main() {
softwareupdate --install --all
type brew || install_brew
install_packages