How to Copy objects from one bucket to another (or within the same bucket) in S3 Before running the below script, ensure you have gem 'aws-sdk-s3' installed on your system.## require the gem in console require 'aws-sdk-s3' Aws.config.update( region: ENV['AWS_REGION'], credentials: Aws::Credentials.new(ENV[
Deleting duplicate records during unique index creation class AddUniquenessToSomeTable < ActiveRecord::Migration[5.2] def up execute <<-SQL -- deleting conflicting entries DELETE FROM TABLE a USING TABLE b WHERE a.id < b.id AND a.some_
Postgres - Order by elements index in array, similar to MySQL's order by field() Background:So earlier today, I was struggling with a minor problem with ordering of elements of a select query based on the ids passed to it.We had search results by elastic search
prerender React JS - Server Side Rendering with Prerender It's always a huge pain, to migrate a complete build application to use Server side rendering. I bet everyone(>90%) of us have had this thought that they will start the next
background worker Handling slow image uploads with Ruby And Carrierwave How to handle carrierwave image processing in background, and make image uploads faster.
carrirwave Read and ReProcess AWS S3 uploaded files on local How to download and process remote files from local system without putting heavy load on the system.
postgres Searching through json datatype in postgres I came across a very peculiar problem the other day. I had a Postgres database and one of the tables had an attribute object_changes which was yaml. Now, the data stored in
postgres How To: Migrate from yaml to json datatype in postgres Recently, I came across a feature request which required me to query on a field in versions table provided by papertrail gem in ruby. You can read more about it here.It was
gitlab How-To delete old artifacts in gitlab At times we need to delete old artifacts from gitlab ci builds which are no longer required. It's really tiresome to go on each job page, and delete it manually. I researched on
How to clear up log files without deleting and re-creating them At times we have certain files which grow mammoth in size with time, like with RoR applications, there are log files, residing in the log directory.Something like:We can clear up the
How to reset read-only index setting elastic search Recently I happened to come across an interesting problem. I had put up ELK stack for monitoring services such as system health(cpu, logged in users, disk space etc) and logs monitoring. After
Setting up pronto with bitbucket CI God! Before you also go and break your head, confused with how to do this, you can take help from my experience.I was trying to integrate pronto (automatic code analyser) with bitbucket
Setting up pipelines in bitbucket, for ruby on rails with rspec Even with the simplicity of yml configuration that is trending now-a-days, there aren't many sites and documentations that can help us configure rspec pipelines with as ease as configuring jenkins or gitlab.Below
Bulk insert data in a table through Ruby on Rails At times, we need to insert millions of rows in a table for bench-marking or any other task. Using ActiveRecord for this purpose can hell lot of time.For that we will write
Preload, Eager Load, Includes and Joins Active Record provides many ways in which we can load the associations of any row, namely: preload, eager_load, includes, and joins.Preload:preload loads all the associations in a separate query.Suppose
How to set Class or Module constants dynamically in Ruby At times, we need to set class constants in Ruby, something like:class Foo BAR = Rails.application.secrets.BAZ['BAR'] endThis gets messy at times when we want to declare a lot of
Cleanup disk space on linux servers Many a times our servers go out of disk space and we start scratching our heads which files are the culprits.From my experience, I have encountered these to be the issue most
ruby on rails Integrating ElasticSearch with Ruby on Rails (Part 1) How to add elastic search to your ruby on rails application.!
Why Did I Start to Learn Go(lang)? (DAY 1) Go(lang) is one of the fastest growing language (in terms of popularity and features) as of now. Being a guy who has been coding in Ruby on Rails and JS since he
rails Export data to a CSV file from your Rails console Export data to a CSV file from your Rails console.
Devops How To: Send your public IP via mail on raspberry pi reboot There are times when you need your public IP address, that is associated to your Raspberry Pi to do some operations, like check torrent status, access plex or run any other task, that
How-to How To: Block access to AWS S3 buckets, for particular IAM user(s) At times we want to allow/deny access to any particular S3 bucket, for a particular user.Similar case would be, suppose you want to give someone only a read access to your
How-to How To: Allow only whitelisted IP's to access any S3 bucket Recently I came across an issue where I had to whitelist certain IP addresses to have access over a S3 bucket.AWS is really great. It supports granular control over buckets and objects