Skip to content

Instantly share code, notes, and snippets.

@jtadeulopes
jtadeulopes / download_map.rb
Created July 24, 2014 18:09
Download staticmap
require 'open-uri'
url = 'http://maps.googleapis.com/maps/api/staticmap?center=40.714728,-73.998672&markers=color:0x4E3253%7C40.714728,-73.998672&zoom=15&size=640x640&scale=2&format=png&maptype=roadmap&sensor=false'
target = File.join(File.expand_path('../', __FILE__), '/maps.jpg')
File.open(target, "wb") do |saved_file|
open(url, 'rb') do |read_file|
saved_file.write(read_file.read)
end
end
@jtadeulopes
jtadeulopes / localhost.conf
Last active September 15, 2016 07:09
Default nginx server
upstream project {
server unix:///var/tmp/project.sock;
}
server {
listen 80;
server_name localhost;
root /var/www/project/current/public;
@jtadeulopes
jtadeulopes / gist:7545569
Last active December 28, 2015 18:49
Banda Folk e Blues
* Jack Elliot
* Doc Watson
* Crosby Stills Nash and Young
* Seasick Steve
* Gillian Walsh
* Cowboy Junkie
* Otis Taylor
* Johnny Cash
* Neil Young
* Joni Mitchell
@jtadeulopes
jtadeulopes / project.conf
Last active December 27, 2015 04:58
Monit conf
check file project-restart.txt with path /var/www/project/shared/project-restart.txt
if changed timestamp
then exec "/sbin/restart project"
@jtadeulopes
jtadeulopes / deploy.rb
Created November 1, 2013 13:58
Capistrano task for puma
namespace :puma do
desc "Start Puma"
task :start, :except => { :no_release => true } do
run "sudo start #{application}"
end
after "deploy:start", "puma:start"
desc "Stop Puma"
task :stop, :except => { :no_release => true } do
run "sudo stop #{application}"
@jtadeulopes
jtadeulopes / project_puma.conf
Last active December 27, 2015 02:49
Puma conf for the project
threads 2,2
# conexão do tipo unix socket
# bind "unix:///var/tmp/project.sock"
# conexão do tipo TCP socket
# bind "tcp://0.0.0.0:5000"
pidfile "/var/run/puma/project.pid"
@jtadeulopes
jtadeulopes / nginx.conf
Created October 30, 2013 17:57
Upstart Nginx
description "nginx webserver"
start on startup
stop on shutdown
respawn
expect fork
exec /opt/nginx/sbin/nginx
@jtadeulopes
jtadeulopes / gist:5041735
Created February 26, 2013 20:13
Ruby 2.0 with rbenv
# https://github.com/sstephenson/rbenv
#
# I'm using rbenv-build to install ruby
# https://github.com/sstephenson/ruby-build
cd ~/.rbenv/
git pull
cd plugins/ruby-build/
git pull
rbenv install 2.0.0-p0
#include <stdio.h>
#define LIMITE 50
int main(void)
{
int A=0, B=0, C=0, soma;
printf("Digite um número inteiro: \n");
scanf("%d", &A);