Skip to content

Instantly share code, notes, and snippets.

View brunnogomes's full-sized avatar

Brunno Gomes brunnogomes

View GitHub Profile
By Klaus Wuestefeld
1) Torne-se excelente.
Seja realmente bom em alguma coisa. Não fique só choramingando ou
querendo progredir às custas dos outros. Não pense q pq vc sentou 4
anos numa faculdade ouvindo um professor falar sobre software q vc
sabe alguma coisa. Jogador de futebol não aprende a jogar bola tendo
aula. Ele pratica. Instrumentistas geniais nao aprendem a tocar tendo
aula. Eles praticam. Pratique. Chegue em casa depois do trabalho e da
@brunnogomes
brunnogomes / gist:1584523
Created January 9, 2012 19:32 — forked from filipevarjao/gist:1579616
Configurando ambiente ruby
Instalação do Ruby 1.8/Rails 3 usando o RVM no Ubuntu
1) Colar essa linha no terminal (bash)
$ bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)l libssl-dev libreadline5-dev zlib1g-dev
2) Instalar a versão 1.8.7 do ruby com
$ rvm install 1.8.7
@brunnogomes
brunnogomes / xorg.conf
Created January 26, 2012 15:40
xorg.conf for AMD Geode
Section "Monitor"
Identifier "Configured Monitor"
EndSection
Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Configured Video Device"
EndSection
@brunnogomes
brunnogomes / redu_client.py
Created March 22, 2012 18:43
Redu Client with OAuth
import urlparse
import oauth2 as oauth
import requests
# First of all fill in your consumer key and secret you get when
# you create your application at Redu
consumer_key = 'YOUR_CONSUMER_KEY_HERE'
consumer_secret = 'YOUR_CONSUMER_SECRET_HERE'
@brunnogomes
brunnogomes / redu_client.php
Created March 22, 2012 18:44
Redu PHP Client with OAuth
<?php
// this script requires the instalation of the Oauth library
// http://br.php.net/manual/en/book.oauth.php
$api_url = 'http://www.redu.com.br/api';
$authorize_url = 'http://www.redu.com.br/oauth/authorize';
$request_token_url = 'http://www.redu.com.br/oauth/request_token';
$access_token_url = 'http://www.redu.com.br/oauth/access_token';
$consumer_key = 'PUT_YOUR_CONSUMER_KEY_HERE';
@brunnogomes
brunnogomes / robot.js
Created December 4, 2012 00:53
The Garbage Collector
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.fire();
@brunnogomes
brunnogomes / break_string_by_chunk_size.rb
Created August 20, 2015 15:45
Using Ruby to break text by chunk size, preserving full words (does not break a word in two parts).
text = "Lorem ipsum dolor sit amet, vix agam noluisse inciderint ea, ex augue iriure invidunt nec. Discere epicuri vim in, et delenit molestie adolescens eam. Ei pericula explicari principes nec, solum salutatus intellegam ei sed. Ei vix stet debet vocibus. Pri viris aperiri periculis ei, pri vocibus tacimates id."
text.scan(/.{1,25}\b|.{1,25}/).map(&:strip)
# => ["Lorem ipsum dolor sit", "amet, vix agam noluisse", "inciderint ea, ex augue", "iriure invidunt nec.", "Discere epicuri vim in,", "et delenit molestie", "adolescens eam. Ei", "pericula explicari", "principes nec, solum", "salutatus intellegam ei", "sed. Ei vix stet debet", "vocibus. Pri viris", "aperiri periculis ei, pri", "vocibus tacimates id", "."]
@brunnogomes
brunnogomes / application_controller.rb
Last active September 29, 2015 20:44
Simple CORS in Rails (just for development please)
# other stuff...
after_action :set_cors_headers # use after_filter if Rails < 4
def set_cors_headers
headers['Access-Control-Allow-Origin'] = "*"
headers['Access-Control-Request-Method'] = %w{GET POST OPTIONS}.join(",")
end
# other stuff...
1. go to https://sslvpn.demo.sonicwall.com/cgi-bin/welcome
2. log in with demo/password
3. click on NetExtender icon, this will download a tar.gz with the client
4. sudo ln -s /lib/x86_64-linux-gnu/libssl.so.1.0.0 /usr/lib/libssl.so.6
5. sudo ln -s /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 /usr/lib/libcrypto.so.6
6. un-tar the client, make install script executable and launch install
@brunnogomes
brunnogomes / strategic_merge.sh
Created July 6, 2018 22:28
Promote alternate git branch to master branch
# We actually don't need to do that.
# Even if the branches are very different and you don't wanto resolve a ton of conflicts.
# Using the strategy argument in the merge command, you can instruct git to just use
# tha state in the current branch and do the merge, preserving all the history.
git checkout alternate_branch
git merge --strategy=ours master # keep the content of this branch, but record a merge
git checkout master
git merge alternate_branch # fast-forward master up to the merge
# Now you can delete the alternate_branch and go back to using master.