Skip to content

Instantly share code, notes, and snippets.

View rodrigo-brito's full-sized avatar
🇧🇷
You are what you share

Rodrigo Brito rodrigo-brito

🇧🇷
You are what you share
View GitHub Profile
// Router
// -----------
func SampleRouter(ctx context.Context) *echo.Echo {
e := echo.New()
e.Use(defaultMiddlewares(ctx)...)
e.Use(em.AddTrailingSlash())
e.GET("/sample/test", echo.WrapHandler(http.HandlerFunc(home.Handle))) //Handle(w http.ResponseWriter, r *http.Request)
return e
package main
import (
"fmt"
"math/rand"
"time"
)
const (
MIN = 1
#!/bin/bash
echo "Wordpress Pool - Random Bot"
votes=0
while true; do
curl 'https://yoursite.com/wp-admin/admin-ajax.php' --data 'param1=value1&param2=value2' --compressed
(( votes++ ))
timeSleep=$(( ( RANDOM % 60 ) * 3 )) # zero to three minutes...
echo "Votes: ${votes}"
echo "Next vote in ${timeSleep} seconds..."
sleep ${timeSleep} # Sleep 3 minutes or less
add_filter( 'get_post_metadata', function ( $value, $post_id, $meta_key, $single ) {
if ( $meta_key === '_thumbnail_id' ) {
$url_thumbnail_external = get_post_meta( $post_id ,'thumbnail_external', true );
if( !empty($url_thumbnail_external) ){
return "ext-" . $post_id;
}
}
return $value;
}, 10, 4);
@rodrigo-brito
rodrigo-brito / linux_bootstrap.txt
Last active March 19, 2017 22:26
Basic Debian-like environment for linux developers after install
Softwares and setting for the linux in the first use
----------------
sudo apt-get update
sudo apt-get install build-essential git
-- Node --
sudo apt-get install nodejs npm
sudo ln -s /usr/bin/nodejs /usr/bin/node
-- Docker ---
@rodrigo-brito
rodrigo-brito / autoexec.cfg
Last active July 7, 2018 12:10
My CS:GO Config
echo "executando..."
// inicialization: -freq 60 -console -novid -nojoy -high -w 1280 -h 960 -threads 8 -tickrate 128 +snd_use_hrtf 0 +exec autoexec.cfg
//---------------------
// Clear
//---------------------
clear
clear_anim_cache
clear_debug_overlays
@rodrigo-brito
rodrigo-brito / .bashrc
Created March 19, 2017 11:45
My linux bash profile
source ~/bash-git-prompt/gitprompt.sh
GIT_PROMPT_ONLY_IN_REPO=0
GIT_PROMPT_THEME=Single_line
[[ -s "/home/rodrigo/.gvm/scripts/gvm" ]] && source "/home/rodrigo/.gvm/scripts/gvm"
@rodrigo-brito
rodrigo-brito / autoexec.cfg
Created February 16, 2017 23:32
CS:GO Binds
//JUMPTHROW BIND
alias "+jumpthrow" "+jump;-attack"
alias "-jumpthrow" "-jump"
bind "mouse5" "+jumpthrow"
/Bind para ver a bomba na fumaça - Game instructor
alias "+use_and_see_bomb_by_pink" "+use; gameinstructor_enable 1"
alias "-use_and_see_bomb_by_pink" "-use; gameinstructor_enable 0"
bind "e" "+use_and_see_bomb_by_pink"
@rodrigo-brito
rodrigo-brito / native.js
Last active January 31, 2017 10:51
Native operations with JS
var node = document.createElement("LI"); // Create a <li> node
var textnode = document.createTextNode("Water"); // Create a text node
node.appendChild(textnode); // Append the text to <li>
document.getElementById("myList").appendChild(node); // Append <li> to <ul> with id="myList"
var teste = document.querySelector("#teste");
var element = document.getElementById("element-id");
element.outerHTML = "";
delete element;
// User config
"scroll_past_end": true, //infinite scroll
"open_files_in_new_window": false, //terminal open in same window
"tab_size": 4,
"translate_tabs_to_spaces": false,
"word_wrap": "false"
// Key binding
[