Skip to content

Instantly share code, notes, and snippets.

View vigneshblue's full-sized avatar

Vigneshwaran Sivalingam vigneshblue

  • Tamilnadu, India.
View GitHub Profile
@vigneshblue
vigneshblue / gist:2237293d9451b3bb15e26d4dc00b8ecd
Created December 19, 2018 06:43
Rails where query to find week day with pg
"extract(dow from starting_time::TIMESTAMPTZ AT TIME ZONE INTERVAL '#{Time.zone.now.formatted_offset}'::INTERVAL) = ?"
sudo npm install -g electron --unsafe-perm=true --allow-root
pg_dump -F c -h localhost -U pg_user -d db_name | gzip -c > sql_dump.gz
#-F format c -> custom
#Restore
pg_restore -U username -d db_name -v dumpfile_location -h localhost
@vigneshblue
vigneshblue / google_image_crawl.rb
Created June 29, 2017 06:34
Ruby code to crawl image from google.
require 'capybara'
require 'capybara/dsl'
require 'capybara/poltergeist'
option = { js_errors: false, timeout: 120 }
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, option)
end
session = Capybara::Session.new(:poltergeist)
url = "https://www.google.com/imghp?"
session.visit url
sudo chown -R www-data:www-data /var/www/html/wordpress