Skip to content

Instantly share code, notes, and snippets.

View Xosmond's full-sized avatar
🏠
Working from home

Jordano Moscoso Xosmond

🏠
Working from home
View GitHub Profile
@Xosmond
Xosmond / download_zip.rb
Last active October 20, 2017 20:26 — forked from prog1dev/gist:62660be194ce4aec73721a0af1665983
Create zip on the fly
def download_zip(image_list)
unless image_list.blank?
file_name = 'pictures.zip'
stringio = Zip::ZipOutputStream::write_buffer do |z|
z.put_next_entry("empty_folder/") ## Create a folder
image_list.each do |img|
title = img.title
title += '.jpg' unless title.end_with?('.jpg')
@Xosmond
Xosmond / remote_sudo.rb
Created December 8, 2017 01:43 — forked from ainoya/remote_sudo.rb
Execute remote sudo command with net-ssh
#!/usr/bin/env ruby
require 'net/ssh'
require 'highline/import'
def get_password
ask( "Enter Password: " ) {|q| q.echo = '*'}
end
def remote_sudo host, ssh_user, command, opts={}