Skip to content

Instantly share code, notes, and snippets.

View betzerra's full-sized avatar

Ezequiel Alejandro Becerra betzerra

View GitHub Profile
@betzerra
betzerra / dither.sh
Last active December 10, 2022 18:20
Dither images
#!/bin/bash
filename="${1%.*}"
extension="${1##*.}"
convert $1 -colorspace Gray -ordered-dither o2x2 "${filename}_gray_ordered.gif"
convert $1 -ordered-dither o2x2 "${filename}_ordered.gif"
convert $1 -monochrome "${filename}_monochrome.gif"
convert $1 -remap pattern:gray50 "${filename}_remap_gray.gif"
convert $1 -remap netscape: "${filename}_remap_netscape.gif"
@betzerra
betzerra / gist:5988604
Created July 12, 2013 23:27
Blurred image using CoreImage (iOS 6)
// Needs CoreImage.framework
- (UIImage *)blurredImageWithImage:(UIImage *)sourceImage{
// Create our blurred image
CIContext *context = [CIContext contextWithOptions:nil];
CIImage *inputImage = [CIImage imageWithCGImage:sourceImage.CGImage];
// Setting up Gaussian Blur
CIFilter *filter = [CIFilter filterWithName:@"CIGaussianBlur"];
@betzerra
betzerra / app.rb
Last active May 15, 2020 20:35
COVID-19
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"'
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'
@betzerra
betzerra / secret_santa.rb
Created December 11, 2018 14:42
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 December 29, 2017 02:04
Querying Canillitapp with a little of shell scripting
# 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 14:22
Noticias de Mayo de Daniel Scioli. Powered by Canillitapp.
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 April 21, 2017 05:34
Any idea how to write this better?
Reaction.joins(:news).where(user: user).as_json(include: :news).to_json
@betzerra
betzerra / twitter_to_i2c_lcd.rb
Created August 27, 2016 08:40
Print a twitter stream into an I2C LCD screen
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"