Skip to content

Instantly share code, notes, and snippets.

View breim's full-sized avatar
:shipit:

H. Breim breim

:shipit:
View GitHub Profile
@breim
breim / btc.rake
Last active August 8, 2018 23:52
require 'net/http'
namespace :btc do
task api: :environment do
API_URL = "http://api.coindesk.com/v1/bpi/currentprice.json"
loop do
url = URI.parse(API_URL)
req = Net::HTTP::Get.new(url.to_s)
res = Net::HTTP.start(url.host, url.port) { |http| http.request(req) }
[video]data={"foto_01"=>"https://s3.amazonaws.com/apiteaser/assets/7e16f175d8dcffb65f1a3ca124861b309c6e4558.png", "foto_02"=>"https://s3.amazonaws.com/apiteaser/assets/9e4b9bf49f464875d578c5a400d866d5f7603730.png", "logo_01"=>"https://s3.amazonaws.com/apiteaser/assets/c491390d70d78e8f070083fb48e7df7d90998493.png", "frase_01"=>"Um mês inteiro de ofertas", "preco_01"=>"2990", "cifrao_01"=>"R$", "pacote_01"=>"Pacote Roma + Paris 2019", "beneficio_01"=>"8 Diárias", "beneficio_02"=>"Aéreo+Hotel", "beneficio_03"=>"Café da Manhã", "condicoes_01"=>"Preço final em até 12x", "cor_fundo_01"=>"#1485D9", "pre_preco_01"=>"A partir de", "call_action_01"=>"Comprar Agora", "cor_secundaria_01"=>"#8CC63F"}
! function(t, e) {
"object" == typeof exports && "object" == typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == typeof exports ? exports.swal = e() : t.swal = e()
}(this, function() {
return function(t) {
function e(o) {
if (n[o]) return n[o].exports;
var r = n[o] = {
i: o,
l: !1,
exports: {}
# 3.8 mb each file.
Amazon to Amazon
40 videos ~ 152mb
17.36 seconds
#################################
ubuntu@ip-172-31-12-114:~$ ruby test.rb
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3854k 0 426 100 3854k 611 5528k --:--:-- --:--:-- --:--:-- 5521k
# 3.8 mb each file.
Amazon to Amazon
10 videos ~ 38mb
3,48 seconds
#################################
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3854k 0 426 100 3854k 989 8954k --:--:-- --:--:-- --:--:-- 8963k
# 30 mb each file.
Amazon to Amazon
10 videos ~ 300mb
27 secondos
#################################
ubuntu@ip-172-31-12-114:~$ ruby test.rb
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 30.0M 0 427 100 30.0M 141 9.9M 0:00:03 0:00:03 --:--:-- 9.9M
namespace :geoip do
task set_location: :environment do
videos = Video.joins(:analytics).where(processed: true).where(analytics: { located_city: false })
videos.each do |video|
video.analytics.where.not(ip: nil).each do |analytic|
info = GeoIP.new(Rails.root.join('GeoLiteCity.dat')).city(analytic.ip)
analytic.update(city_name: info[:city_name], country_name: info[:country_name], located_city: true)
end
end
end
@breim
breim / gist:a1bca233cf223c97327e5af5f9135691
Last active May 29, 2018 16:55
systemd as service sinatra
ffmepg ubuntu lib aac
http://ubuntuhandbook.org/index.php/2017/05/install-ffmpeg-3-3-in-ubuntu-16-04-14-04/
https://www.devdungeon.com/content/creating-systemd-service-files
File: /etc/systemd/system/myapp.service
[Unit]
code = 'i-0c4e38bfbef1ae78b'
cloudwatch = Aws::CloudWatch::Client.new(access_key_id: ENV['AWS_ACCESS_KEY_ID'], secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'], region: 'us-east-1')
cloudwatch.get_metric_statistics({
namespace: 'AWS/EC2',
metric_name: 'CPUUtilization',
dimensions: [
{
name: "InstanceId",
value: code,
{
"name": "Sicredi 02"
, "duration": 59
, "main_composition":"Template_Sicredi_02"
, "preview_frames": [80,180,320,530,730,920,1010,1180,1300,1400,1600,1740]
, "main_frame": 80
, "variables": {
"nome":{
"name": "Nome"
,"type": "text"