Skip to content

Instantly share code, notes, and snippets.

def x_put (blob)
self.permalink = UUID.random_create.to_s if self.permalink.blank?
imgs = Magick::Image.from_blob(blob)
first = imgs.first
case first.get_exif_by_entry("Orientation") && first["EXIF:Orientation"]
when "6"
first.rotate!(90)
first["EXIF:Orientation"] = "1"
when "3"
first.rotate!(180)
def self.daemon
IO.popen("python /root/isk-daemon-0.6.2/isk-daemon.py 2>&1") { |io|
i = ""
thread = Thread.new {
while IO.select([io], nil, nil) do
i = io.gets
puts i
break if i.nil?
end
}