convert -list font
fc-list | grep -i arial
convert -list font | grep "Font:" | grep Arial
require 'net/http' | |
require 'nokogiri' | |
# This script parse and download image files from html documents | |
def get_html(url) | |
uri = URI(url) | |
response = Net::HTTP.start(uri.host, uri.port, | |
:use_ssl => uri.scheme == 'https') do |http| | |
resp = http.get(uri.path) | |
case resp |
def sum_hour_glass(c, r, two_d_array) | |
top = two_d_array[r][c..c+2].inject(:+) | |
center = two_d_array[r +1][c+1] | |
bottom = two_d_array[r+2][c..c+2].inject(:+) | |
top + center + bottom | |
end | |
def array2D(arr) | |
max = -1.0/0.0 | |
arr.each_with_index do |row, r_i| |
class Node | |
attr_accessor :value, :left, :right, :name | |
def initialize(options={}) | |
@value = options[:value] | |
@name = options[:name] | |
end | |
def children | |
[@left, @right].compact |
class Heap | |
def initialize(type = :min) | |
@type = type | |
if @type == :min | |
@heap = [-1.0/0] | |
@compare = ->(a,b) { (a <=> b) < 0 } | |
elsif @type == :max | |
@heap = [1.0/0] | |
@compare = ->(a,b) { (b <=> a) > 0 } | |
else |
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'aws-sdk' | |
class S3FolderUpload | |
attr_reader :folder_path, :total_files, :s3_bucket, :include_folder | |
attr_accessor :files | |
# Initialize the upload class |
require 'rest-client' | |
RestClient.get(url, headers={}) | |
RestClient.post(url, payload, headers={}) |