Skip to content

Instantly share code, notes, and snippets.

View therod's full-sized avatar

Rodrigo therod

View GitHub Profile
So what are you working on?
Have you raised funding?
What makes new users try you?
What competition do you fear most?
What's the worst thing that has happened?
Will you reincorporate as a US company?
What's an impressive thing you have done?
Where is the rocket science here?
Why did you pick this idea to work on?
Why do the reluctant users hold back?
require 'pdf-reader'
require 'date'
def get_name(pdf_filename)
reader = PDF::Reader.new(pdf_filename)
text = reader.pages.first.text.split(" ")
name = text[5] + " " + text[6]
end
def rename_pdf(original_file, name)
require 'pry'
# 1 - First we define the Car class
class Car
end
# 2 - Every class needs a so called initializer method
class Car
def initialize
end
@therod
therod / shillary.rb
Last active January 18, 2017 09:15
Automatically download the latest Podesta E-Mails from Wikileaks
#!/usr/bin/env ruby
require 'typhoeus'
Dir.mkdir('mail') unless Dir.exist?('mail')
def last_email
Dir.entries('mail').last.scan(/\d/).join('').sub!(/^0+/, '').to_i
end
def write_email(id, body)
@therod
therod / rename.rb
Created November 3, 2016 18:36
Simple script that normalizes files in a folder and renames them accordingly
require 'i18n'
require 'fileutils'
I18n.available_locales = [:en]
Dir.glob('./authors/*.jpg').map do |orig|
dest = I18n.transliterate(orig.downcase.tr(' ', '-').tr('_', '-'))
File.rename(orig, dest)
end
@therod
therod / crop.rb
Created November 3, 2016 23:24
Crop images from a folder using resize_to_fill and create two different Gravity Versions
require 'pry'
require 'rmagick'
require 'pathname'
require 'rake/pathmap'
include Magick
Dir.glob('./authors/*.jpg').map do |file|
pn = Pathname.new(file)
out_file = "./cropped/#{pn.basename}"
@therod
therod / podesta.rb
Last active January 18, 2017 09:19
require 'curb'
count = 0
while count
puts "Getting E-Mail #{count}"
email = Curl::Easy.perform("https://www.wikileaks.org/podesta-emails/get/#{count}")
if email.body_str.include?('<h1>Internal Server Error</h1>')
puts "Reached final e-mail"
# We require the unit testing module of Ruby
require 'minitest/autorun'
# # Class Definition
class Person
def say(name)
"Hello, my name is #{name} World"
end
end
# We require the minitest library
require 'minitest/autorun'
# CLASS DEFINITION
class Person
attr_accessor :age, :name
def say(name)
"Hi, my name is test blablabla #{name}"
end
@therod
therod / ex1.rb
Created January 20, 2017 08:33
exercise_1.rb
# This is just a simple example on how to use puts
puts "Hello World!"
puts "This is fun!"
puts "Yahooo! Printing."
puts "I'd much rather you 'not'."
puts 'I "said" do not touch this.'
puts "This is a string interpolation test #{1 + 1}"