Skip to content

Instantly share code, notes, and snippets.

@gabrielcorado
gabrielcorado / main.go
Created October 24, 2016 13:38
Print Golang Struct
fmt.Printf("%+v\n", struct)
@gabrielcorado
gabrielcorado / gist:9ffb7aad990803f0a9038ab706c1155f
Created October 14, 2016 22:31
Nice example of Coroutines
Say you're in the kitchen in front of the refrigerator, thinking about a sandwich. You take a continuation right there and stick it in your pocket. Then you get some turkey and bread out of the refrigerator and make yourself a sandwich, which is now sitting on the counter. You invoke the continuation in your pocket, and you find yourself standing in front of the refrigerator again, thinking about a sandwich. But fortunately, there's a sandwich on the counter, and all the materials used to make it are gone. So you eat it.
@gabrielcorado
gabrielcorado / gist:2b0b4c1d156ba23733aa
Created February 11, 2016 13:39
Remove containers from last hour
docker ps -a | grep 'minutes ago' | awk '{print $1}' | xargs docker rm
@gabrielcorado
gabrielcorado / gist:349834f6a56b98888fc2
Created January 13, 2016 17:17
Remove all docker-compose "run" containers
docker rm -f (docker ps -a | grep "run" | awk '{print($1)}')
@gabrielcorado
gabrielcorado / ssl.js
Created January 6, 2016 17:43
Force SSL JavaScript front-end
// Replace the current protocol (http) to https
window.location.href = window.location.href.replace('http', 'https');
@gabrielcorado
gabrielcorado / endpoint.rb
Created October 8, 2015 14:28
Use different formatters in Grape
resource :bidules do
desc "My API 1"
formatter :csv, CustomCsvFormatter
get '/' do
present my_data, with: MyEntity
end
resource :blublu do
desc "My API 2"
formatter :csv, CustomOtherCsvFormatter
@gabrielcorado
gabrielcorado / gist:e4d40aca27201986924c
Created September 28, 2015 15:24
NGINX Maintenance
server {
listen 80;
root /www/data/;
location / {
if (-f $document_root/maintenance.html) {
return 503;
}
}
@gabrielcorado
gabrielcorado / gist:f197c70f560c43878fb7
Created September 24, 2015 00:06
Remove ALL Running containers
docker rm -f (docker ps -q)
@gabrielcorado
gabrielcorado / gist:fe0d2f3cfc3157ff0dc1
Last active September 21, 2015 12:16
Stop ALL containers
docker stop (docker ps -a -q)
@gabrielcorado
gabrielcorado / gist:d0a8a024154ffc47e6ae
Created September 21, 2015 12:15
Remove ALL containers
docker rm (docker ps -a -q)