Skip to content

Instantly share code, notes, and snippets.

View betogrun's full-sized avatar

Alberto Rocha betogrun

View GitHub Profile
@betogrun
betogrun / setup.sh
Created May 14, 2024 20:26
Setup ubuntu
#!/bin/bash
# Exit immediately if a command exits with a non-zero status
set -e
# Logging function
log() {
echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" | tee -a /var/log/setup_script.log
}
@betogrun
betogrun / test.rb
Last active January 11, 2018 16:27
Even or Odd
array = [0,1,2,3,4,5,6,7,8,9]
array.each_with_object({:odd => [], :even => []}) do |item, memo|
memo[item.odd? ? :odd : :even] << item
end
@betogrun
betogrun / agnoster.zsh-theme
Last active May 7, 2017 04:35
My version of my zsh agnoster theme
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://gist.github.com/1595572).
#
def set_items
items_params = []
params['barter'].each do |barter|
barter['items'].each do |items|
items_params << Item.new(amount: items['amount'], kind: items['kind'], survivor_id: barter['survivor_id'] )
end
end
@items_to_barter_a = items_params.select { |key, value| key.survivor_id == @survivors[0].id }
@items_to_barter_b = items_params.select { |key, value| key.survivor_id == @survivors[1].id }
end
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at