Skip to content

Instantly share code, notes, and snippets.

View bbonamin's full-sized avatar
🕶️

Bruno Bonamin bbonamin

🕶️
View GitHub Profile
@bbonamin
bbonamin / homebrew_multi_user.txt
Created May 26, 2016 22:57
Homebrew multi user setup
#!/usr/bin/env bash
set -eu
#
# Adapted from http://blog.strug.de/2012/06/my-homebrew-multi-user-setup/
#
sudo dseditgroup -q -o create brew
sudo dseditgroup -o edit -a "${USER}" -t user brew
@bbonamin
bbonamin / gist:808a55efb746d8a10430
Created February 18, 2016 10:50
OS X Homebrew with multiple users
http://apple.stackexchange.com/a/45003
Is this considered bad? I thought one of the advantages of using /usr/local/ for your installs was that you don't need sudo. But clearly we do.
Homebrew, by default, sets itself up for single-user access to /usr/local. So you need to open up the permissions on the directory tree for it to be administered by more than one person.
People don't need to run sudo here to administer homebrew. You just need to change some permissions. Since you already have:
All users who would need to modify Homebrew are members of admin group.
You need to do two more things:
@bbonamin
bbonamin / anagram.exs
Created September 17, 2015 19:55
Beginner's Elixir version of Avdi's anagram for Hello Crystal http://devblog.avdi.org/2015/08/20/hello-crystal/
defmodule Anagram do
def table(file, table) do
case IO.read(file, :line) do
line when line != :eof ->
word = String.replace(line, ~r/\n/, "")
key = to_key(word)
row = table[key] || []
row = row ++ [String.downcase(word)]
@bbonamin
bbonamin / gist:96be60bad7fa5164a092
Created July 7, 2015 10:06
SSL in Development with Nginx + Rails
  1. Install nginx brew install nginx
  2. Cd into the nginx directory /usr/local/etc/nginx
  3. Create a ssl directory, change and generate a dummy ssl cert: mkdir ssl cd ssl penssl req -new -newkey rsa:2048 -sha1 -days 365 -nodes -x509 -keyout server.key -out server.crt (just accept the default empty settings)
  4. Go back to the nginx directory cd ..
  5. Create or edit nginx.conf with the following settings:
events {
@bbonamin
bbonamin / Vagrantfile
Created December 24, 2014 13:07
Vagrant + Ansible as provisioned dev box
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "forwarded_port", guest: 3000, host: 3001
config.vm.provision :ansible do |ansible|
ansible.playbook = "playbook.yml"
ansible.verbose = 'v'
end
end
@bbonamin
bbonamin / Vagrantfile
Created May 9, 2014 19:30
Vagrant VM with access to host VPN
Vagrant::Config.run do |config|
config.vm.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
config.vm.network :hostonly, "192.168.56.101"
config.vm.box = "base-hadoop"
config.vm.customize ["modifyvm", :id, "--memory", 1024, "--cpus", "1"]
config.vm.provision :puppet do |puppet|
puppet.manifests_path = "manifests"
puppet.manifest_file = "base-hadoop.pp"
puppet.module_path = "modules"
end
@bbonamin
bbonamin / Capfile
Created December 11, 2013 13:18
Very old but simple capistrano deploy example
# Add RVM's lib directory to the load path.
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
# Load RVM's capistrano plugin.
require "rvm/capistrano"
# Set it to the ruby + gemset of your app, e.g:
set :rvm_ruby_string, 'ruby-1.9.2-p290@global'
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
@bbonamin
bbonamin / install.sh
Created December 10, 2013 15:16
Install ruby 2.0 from source
sudo apt-get -y update &&
sudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev &&
cd /tmp &&
wget http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.gz &&
tar -xvzf ruby-2.0.0-p353.tar.gz &&
cd ruby-2.0.0-p353/ &&
./configure --prefix=/usr/local &&
make &&
sudo make install
@bbonamin
bbonamin / Gemfile
Created November 27, 2013 19:15
Bundler with multiple gemfiles. If your Gemfile becomes too big, you might want to split it.
source 'https://rubygems.org'
gemfiles = [ 'Gemfile1', 'Gemfile2' ]
gemfiles.each do |gemfile|
instance_eval File.read(gemfile)
end
@bbonamin
bbonamin / instructions.md
Last active December 21, 2015 05:29
Install lightum on ubuntu 13.04 ( For automatic brightness switching on Macbooks )

Downloading Lightum and compiling from source

  1. Download the master branch zip from https://github.com/poliva/lightum
  2. Run sudo apt-get install libxss-dev libdbus-glib-1-dev
  3. Unzip the lightum-master zip file and cd ~/Downloads/lightum-master (or wherever you downloaded the package)
  4. make
  5. sudo make install

Run Lightum