Skip to content

Instantly share code, notes, and snippets.

Avatar

Hadrien Blanc hadrienblanc

  • Paris, France
View GitHub Profile
View tesseract_ocr_example.sh
curl -s 'https://pbs.twimg.com/media/E9T96Q9XIAcs8xJ?format=jpg&name=large' -o - | tesseract stdin stdout | grep --color 609
View database.yml
---
development:
url: <%= ENV['DATABASE_URL'].gsub('?', '_development?') %>
test:
url: <%= ENV['DATABASE_URL'].gsub('?', '_test?') %>
staging:
url: <%= ENV['DATABASE_URL'].gsub('?', '_staging?') %>
production:
url: <%= ENV['DATABASE_URL'].gsub('?', '_production?') %>
View file.sh
file "example.flac"
example.flac: FLAC audio bitstream data, 16 bit, stereo, 44.1 kHz, 2474304 samples
View ffmpeg_slideshow_creator.sh
# Here is how to create a slideshow from images (1.jpg,2.jpg..,8.jpg) with FFmpeg on your Linux or Unix box:
ffmpeg -y -r 1/3 -framerate 1 -i %1d.jpg -c:v libx264 -vf fps=5 -pix_fmt yuv420p out.mp4
View nokogiri_sax_parser.rb
class MyParser < Nokogiri::XML::SAX::Document
def initialize
end
def start_element(name, attrs = [])
puts attrs.inspect
end
def characters(string)
end
View mongo_id_ not_nil.rb
# Returns nils and strings
Model.where(:url.ne => "").count
# Returns strings and ""
Model.where(:url.ne => nil).count
# Returns strings, nils and ""
Model.where(:url.ne => ["", nil]).count
Model.where(:url.nin => ["", nil]).count
View fizz_buzz_in_ruby.md

Fizz Buzz ruby

Objective

Write a fonction or an object of your design called FizzBuz that takes input integer n and prints all the numbers from 1 up to n in a new line.

  • if the number is divisible by 3 then print "Fizz"
  • if the number is divisible by 5 then print "Buzz"
  • if the number is divisible by both 3 and 5, print "FizzBuzz". Otherwise just print the number.