Skip to content

Instantly share code, notes, and snippets.

View GuilhermeBarile's full-sized avatar

Guilherme Barile GuilhermeBarile

  • Toptal
  • São Paulo
View GitHub Profile
@GuilhermeBarile
GuilhermeBarile / missing-files.sh
Last active August 29, 2015 14:19
Download missing files from access.log
# list missing files
cat access.log | grep " 404 " | cut -d\" -f2 | cut -d" " -f 2 > missing.txt
# download
# -x tells wget to create subdirs (domain.com/dir/file is downloaded to ./domain.com/dir/file)
# -nH tell wget NOT to create the domain subdir (domain.com/dir/file is downloaded to ./dir/file)
for i in `cat missing.txt`; do wget -nH -x http://www.domain.com$i; done
@GuilhermeBarile
GuilhermeBarile / bootstrap.sh
Created March 21, 2015 22:25
Vagrant+ansible no Windows
#!/bin/bash
#
# bootstrap.sh
#
# Prepara o ambiente do vagrant para executar o playbook
#
# No Vagrantfile, utilizar
#
# config.vm.provision :shell, :path => "bootstrap.sh", :args => "playbook.yml"
#

Outcome-Oriented Programming

Mike McNeil, Aug 2014

Humans are not very good at planning. We have no problem running scenarios, thinking through possibilities, and pondering "what if?" questions. I might plan to not eat my cousin's birthday cake before she gets home, for instance. If I'm very serious, I might write down my commitment; or if I'm unsure about the pros and cons, use some organizational tool like a T-chart.

But when it comes to making a decision in the moment, all bets are off. The cake is a goner.

Predictive Analysis vs. Process Design

Below, I've included a figure containing a decision tree diagram.

@GuilhermeBarile
GuilhermeBarile / rsync-single-file.sh
Created January 23, 2015 21:19
rsync single file
# from http://stackoverflow.com/a/25342845/164469
rsync -av /usr . --include /usr/ --include /usr/share/ --include /usr/share/X11/ --include /usr/share/X11/xorg.conf.d/ --include /usr/share/X11/xorg.conf.d/20-intel.conf --exclude '*'
# update your local master branch
git checkout master
git pull --rebase
# never do any work on master branch
# create & switch to new branch instead
git checkout -b my_branch
# rebase 'my_branch' onto master
git checkout my_branch
@GuilhermeBarile
GuilhermeBarile / 0_reuse_code.js
Created August 21, 2014 22:12
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

Keybase proof

I hereby claim:

  • I am guigouz on github.
  • I am guigouz (https://keybase.io/guigouz) on keybase.
  • I have a public key whose fingerprint is 2E8C 5034 BAC9 FC7E 7BCA B87D 06BA C15D DE36 8862

To claim this, I am signing this object:

/** @jsx React.DOM */
(function(global) {
var XReact = React.createClass({
componentDidMount: function() {
// When anything change in the DOM subtree, we want to update the React
// version of the element
new MutationObserver(this.forceUpdate.bind(this)).observe(
this.props.element, {
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
@GuilhermeBarile
GuilhermeBarile / git-setup-live-reposity.sh
Created February 28, 2014 21:01
Sets up a repository that resets itself when receiving a push
#!/bin/bash
[ -d .git ] || (echo 'Not a git repository' && exit 1)
git config receive.denyCurrentBranch ignore
cat << EOF > .git/.htaccess
Order allow,deny