Skip to content

Instantly share code, notes, and snippets.

Avatar

Ezequiel Alejandro Becerra betzerra

View GitHub Profile
View app.rb
require 'nokogiri'
require 'faraday'
require 'pry'
conn = Faraday.new
response = conn.get 'https://www.worldometers.info/coronavirus/'
covid_page = Nokogiri::HTML(response.body)
puts '"Country";"Infected";"Deaths";"ID ratio"'
View gist:6cd88a7ee61f49ff6748a07f73acca90
require 'faraday'
require 'nokogiri'
response = Faraday.new.get 'https://www.santander.com.ar/ConectorPortalStore/Rendimiento'
html = Nokogiri::HTML(response.body)
desired_items = [
'SUPER AHORRO $ CUOTA A',
'SUPER AHORRO PLUS CUOTA A',
'SUPERGESTION MIX VI CUOTA A'
View secret_santa.rb
people = ARGV
possible_receivers = people.dup
result = {}
people.each do |p|
# a person doesn't have to give a gift to himself;
tmp = possible_receivers.dup
tmp.delete(p)
receiver = tmp.sample
@betzerra
betzerra / .zshrc
Last active Dec 29, 2017
Querying Canillitapp with a little of shell scripting
View .zshrc
# optional, I added some of my scripts at the bottom of my ~/.zshrc
# (I'm using oh-my-zsh https://github.com/robbyrussell/oh-my-zsh)
alias canillitapp_latest="~/Scripts/latest_news.sh"
alias canillitapp_popular="~/Scripts/popular_news.sh"
alias canillitapp_search="~/Scripts/search_news.sh"
alias canillitapp_trending="~/Scripts/trending_news.sh"
@betzerra
betzerra / Instructions
Last active May 11, 2017
Noticias de Mayo de Daniel Scioli. Powered by Canillitapp.
View Instructions
curl api.canillitapp.com/search/scioli | jq '.[] | {title: .title, source: .source_name, date: .date | strftime("%B %d %Y %I:%M%p %Z"), url: .url}' > scioli.json
@betzerra
betzerra / get_reactions.rb
Last active Apr 21, 2017
Any idea how to write this better?
View get_reactions.rb
Reaction.joins(:news).where(user: user).as_json(include: :news).to_json
@betzerra
betzerra / twitter_to_i2c_lcd.rb
Created Aug 27, 2016
Print a twitter stream into an I2C LCD screen
View twitter_to_i2c_lcd.rb
require 'i2c/drivers/ss1602' # https://github.com/nerab/i2c-ss1602
require 'twitter' # https://github.com/sferik/twitter
display = I2C::Drivers::SS1602::Display.new('/dev/i2c-1', 0x27)
client = Twitter::Streaming::Client.new do |config|
config.consumer_key = "XXX"
config.consumer_secret = "XXX"
config.access_token = "XXX"
config.access_token_secret = "XXX"
View gist:e1325656a6c54a9bfc751da102dbaf35
@betzerra
betzerra / news.sh
Last active Dec 26, 2015
Muestra las últimas noticias en medios argentinos
View news.sh
#!/bin/bash
casperjs tn_news.js
./rss_news.rb http://www.clarin.com/rss/lo-ultimo/ Clarin
./rss_news.rb http://contenidos.lanacion.com.ar/herramientas/rss-origen=2 LaNacion
You can’t perform that action at this time.