Skip to content

Instantly share code, notes, and snippets.

View tmatilai's full-sized avatar

Teemu Matilainen tmatilai

View GitHub Profile
@tmatilai
tmatilai / red_stderr.sh
Created May 3, 2021 06:49
Make direnv error messages red
#!/usr/bin/env bash
#
# Color all stderr output from .envrc evaluation.
# Copy this file to ~/.config/direnv/lib/red_stderr.sh
# Override the direnv stdlib function to print with "normal" color
log_status() {
if [[ -n $DIRENV_LOG_FORMAT ]]; then
local msg=$*
local color_normal

Keybase proof

I hereby claim:

  • I am tmatilai on github.
  • I am tmatilai (https://keybase.io/tmatilai) on keybase.
  • I have a public key whose fingerprint is A913 3448 06B1 28F7 9457 2913 5AA5 FAF1 386B 7709

To claim this, I am signing this object:

@tmatilai
tmatilai / Vagrantfile
Created March 5, 2014 21:28
Running (Omnibus) Chef provisioner in a Vagrant VM which has RVM installed
Vagrant.configure("2") do |config|
# ...
config.vm.provision :chef_solo do |chef|
chef_gem_path = "/opt/chef/embedded/lib/ruby/gems/1.9.1"
chef.binary_env = "GEM_PATH=#{chef_gem_path} GEM_HOME=#{chef_gem_path}"
chef.binary_path = "/opt/chef/bin"
# ...
end
@tmatilai
tmatilai / README.md
Last active January 3, 2016 14:39
Install vagrant-berkshelf (and berkshelf) from their git repositories

IMHO the correct way to install bleeding edge plugins to Vagrant is to use the standard Vagrant installer.

These instructions should work for Vagrant 1.1.0 - 1.4.x (but probably not for Vagrant 1.5+),

git clone https://github.com/berkshelf/berkshelf.git
cd berkshelf
gem build berkshelf.gemspec

# Install directly to Vagrant's gem storage, as this is not a plugin
@tmatilai
tmatilai / README.md
Last active December 28, 2015 19:49
Example Vagrant box for AWS provider

Install

tar -czf debian-7.box metadata.json Vagrantfile
vagrant box add debian-7 debian-7.box

Update

When the AMIs change, the easiest it to edit the basebox configuration directly in ~/.vagrant.d/boxes/debian-7/aws/Vagrantfile. You can also use --force option to replace the old box.

@tmatilai
tmatilai / Vagrantfile
Last active January 1, 2021 19:49
My global Vagrant configuration (~/.vagrant.d/Vagrantfile)
# URI of the local (caching) HTTP proxy
LOCAL_HTTP_PROXY = 'http://192.168.33.200:8123'
# Configures vagrant-cachier and vagrant-proxyconf.
# Should be called only on "local machine" providers.
def configure_caching(config)
if Vagrant.has_plugin?('vagrant-cachier')
config.cache.enable_nfs = true
config.cache.enable :gem
config.cache.enable :npm
@tmatilai
tmatilai / Vagrantfile
Created October 31, 2013 18:53
Use host's resolver (On OS X with VPN) for a VirtualBox Vagrant VM
Vagrant.configure('2') do |config|
# ...
config.vm.provider :virtualbox do |vbox|
vbox.customize ['modifyvm', :id, '--natdnshostresolver1', 'on']
end
# ...
end
def run
# ...
if config_value(:sync, true)
generate_node_config
berkshelf_install if config_value(:berkshelf, true)
librarian_install if config_value(:librarian, true)
add_cookbook_path(patch_cookbooks_path) # <--
sync_kitchen
generate_solorb
end
@tmatilai
tmatilai / README.md
Last active December 21, 2015 04:58
Configuration specs for vagrant-proxyconf
Module Keys Env vars
All config.proxy.http
config.proxy.https
config.proxy.no_proxy
VAGRANT_HTTP_PROXY
VAGRANT_HTTPS_PROXY
VAGRANT_NO_PROXY
Env/shell config.env_proxy.http
config.env_proxy.https
config.env_proxy.no_proxy
VAGRANT_ENV_HTTP_PROXY
VAGRANT_ENV_HTTPS_PROXY
VAGRANT_ENV_NO_PROXY
Apt config.apt_proxy.http
config.apt_proxy.https
VAGRANT_APT_HTTP_PROXY
VAGRANT_APT_HTTPS_PROXY
Yum config.yum_proxy.http config.yum_proxy.https VAGRANT_YUM_HTTP_PROXY VAGRANT_YUM_HTTPS_PROXY
@tmatilai
tmatilai / debian7.erb
Created May 20, 2013 13:56
Chef `knife bootstrap` template for Debian 7.0 Wheezy until it is supported by Opscode: http://tickets.opscode.com/browse/CHEF-4125
bash -c '
<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
exists() {
if command -v $1 &>/dev/null
then
return 0
else
return 1
fi