Skip to content

Instantly share code, notes, and snippets.

View fellipebrito's full-sized avatar

Fellipe Brito fellipebrito

View GitHub Profile
@fellipebrito
fellipebrito / gist:ec8a72918c38af10bd710507f7aa1ed1
Created October 23, 2021 00:16
Remove What is Happening from Twitter
// Download the Run Javascript Chrome Extension:
// https://chrome.google.com/webstore/detail/run-javascript/lmilalhkkdhfieeienjbiicclobibjao
function hideIt(elementToBeHidden){
document.getElementsByClassName(elementToBeHidden)[0].style.display = "none";
}
function sleep(duration) {
return new Promise(resolve => {
setTimeout(() => {
@fellipebrito
fellipebrito / run_on_host.sh
Created January 22, 2016 01:26
Running a command from the vagrant into the host
#!/bin/bash
COMMAND="'open https://www.google.com/search?q=\"$@\"'"
ssh fellipebrito@`netstat -rn | grep "^0.0.0.0 " | cut -d " " -f10` \'$COMMAND\'
@fellipebrito
fellipebrito / browser_search.sh
Last active December 29, 2015 05:06
Dynamic browser search from a yanked text in VIM from a vagrant box
#!/usr/bin/expect -f
# Use: browser_search.sh <query-to-be-searched>
set QUERY [lindex $argv 0]
set username "YOUR_USERNAME"
set hostname "YOUR_HOSTNAME"
# In Case you need a password. You can use this var and uncomment lines bellow
# It is better to add your public ssh key in authorized keys in your HOST
set password "YOUR_PASSWORD"
@fellipebrito
fellipebrito / hash_machine.rb
Created February 11, 2015 17:04
Example of how to use hashid
class HashMachine
## Source: https://github.com/peterhellberg/hashids.rb
## In this example I'm using 11 as the size of the hash. This is the same size youtube uses
require 'hashids'
@@my_salt = 'this is my salt'
@@my_hash_size = 11
def hashids
2.1.5 :011 > 'begin' <=> 'end'
=> -1
2.1.5 :012 > 'same' <=> 'same'
=> 0
2.1.5 :013 > a = [5, 3, 4, 1]
=> [5, 3, 4, 1]
2.1.5 :014 > a.sort
=> [1, 3, 4, 5]
2.1.5 :015 > a.any? {|i| i > 6}
=> false
@fellipebrito
fellipebrito / bing_image_structure
Created March 1, 2014 08:43
Bing Image Structure
:ID=>"f592d239-78a0-47d6-a391-025adc3f412d",
:Title=>"Remind me to request full moon shifts off from here on out.",
:MediaUrl=>"http://1.bp.blogspot.com/_JW500q8ddNk/TUeUNEx7IYI/AAAAAAAAA5U/A6gI5XdXa4g/s1600/full_moon.jpg",
:SourceUrl=>"http://www.gratuity-not-included.com/2011/01/full-moon.html",
:DisplayUrl=>"www.gratuity-not-included.com/2011/01/full-moon.html",
:Width=>"1280",
:Height=>"1024",
:FileSize=>"243053",
:ContentType=>"image/jpeg",
:Thumbnail=>