Skip to content

Instantly share code, notes, and snippets.

View wwwbruno's full-sized avatar

Bruno Almeida wwwbruno

View GitHub Profile
@wwwbruno
wwwbruno / json.go
Created August 6, 2017 22:52
Json GO Encode/Decode exemple
package main
import (
"encoding/json"
"fmt"
"github.com/mitchellh/mapstructure"
)
type Message struct {
package main
import (
"fmt"
"io"
"math/rand"
"net"
"net/http"
)
@wwwbruno
wwwbruno / lead-fake-tracking.js
Last active September 15, 2017 20:14
Fake pageview on RD Station Lead tracking
/* References
http://www.w3schools.com/js/js_cookies.asp
https://github.com/ResultadosDigitais/rdocs/blob/master/integracoes_html_puro.md */
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i = 0; i <ca.length; i++) {
var c = ca[i];
while (c.charAt(0)==' ') {
@wwwbruno
wwwbruno / Dockerfile
Last active March 31, 2016 16:01
WordPress Dockerfiles
FROM orchardup/php5
@wwwbruno
wwwbruno / Dockerfile
Last active January 21, 2016 14:11
Dockerfile and docker-compose.yml for Rails Application
FROM ruby:2.2.1
RUN apt-get update -qq && apt-get install -y build-essential
# for postgres
RUN apt-get install -y libpq-dev
# for capybara-webkit
RUN apt-get install -y libqt4-webkit libqt4-dev xvfb
# for a JS runtime
@wwwbruno
wwwbruno / bash_profile
Created July 24, 2015 18:54
Great theme for bash profile
# ~/.bash_profile
# Theme
export PATH=~/bin:$PATH
txtblk='\e[0;30m' # Black - Regular
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
txtylw='\e[0;33m' # Yellow
txtblu='\e[0;34m' # Blue
@wwwbruno
wwwbruno / curl.sh
Last active August 29, 2015 14:20
curl simple usage example
# Get json
$ curl -i -H "Accept: application/json" --user user:pass http://disvolvi.com/api/v1/list.json
# Post xml
curl -X POST -i -H "Accept: application/xml" -d '<?xml version="1.0"?><instance></instance>' --user user:pass http://disvolvi.com/api/v1/post.xml
# Return info from the return
-i
# Header type json
@wwwbruno
wwwbruno / php-env.sh
Last active November 13, 2015 00:07
LAMP env instalation
# INSTALATION
# udpate system
sudo apt-get update
# install apache2
sudo apt-get install apache2
# install ppa
sudo apt-get install python-software-properties
@wwwbruno
wwwbruno / rails-evn.sh
Last active January 16, 2016 11:31
Rails env instalation
# INSTALATION
# udpate system
sudo apt-get update
# Fish Shell
wget https://launchpad.net/~fish-shell/+archive/ubuntu/release-2/+files/fish_2.2.0-1~trusty_amd64.deb
sudo dpkg --install fish_2.2.0-1~trusty_amd64.deb
curl -L https://github.com/oh-my-fish/oh-my-fish/raw/master/bin/install | fish
omf install bobthefish
@wwwbruno
wwwbruno / cafe.php
Created January 22, 2015 18:49
Verdade absoluta!
<?php
while (true):
echo "Hora de tomar café!";
endwhile;