Skip to content

Instantly share code, notes, and snippets.

View indyarocks's full-sized avatar
💭
I may be slow to respond.

Chandan Jhunjhunwal indyarocks

💭
I may be slow to respond.
View GitHub Profile
@indyarocks
indyarocks / Dockerfile
Created September 23, 2023 06:08 — forked from rajeevkannav/Dockerfile
Deploy com Mina, Docker e Docker Compose
FROM rails:4.2.3
MAINTAINER Renato Filho <renatosousafilho@gmail.com>
ENV HOME /home/app
ENV RAILS_ENV development
RUN useradd -m -s /bin/bash app
RUN gem install -N bundler
@indyarocks
indyarocks / ruby_on_rails_deployment.md
Last active September 22, 2023 18:32 — forked from zentetsukenz/ruby_on_rails_deployment.md
Deploy Ruby on Rails application with Docker Compose and Capistrano with ease

Docker

Files and Folders.

|
|\_ app
|...
|\_ docker
| |

Credit: Based on asukakenji

Modified: To check for all version of Go in go[0-9].[0-9][0-9].[0-9] pattern

Go (Golang) Standard Library Interfaces (Selected)

This is not an exhaustive list of all interfaces in Go's standard library. I only list those I think are important. Interfaces defined in frequently used packages (like io, fmt) are included. Interfaces that have significant importance are also included.

@indyarocks
indyarocks / the % notation in ruby.md
Created June 4, 2023 08:49 — forked from jakimowicz/the % notation in ruby.md
%Q, %q, %W, %w, %x, %r, %s, %I, %i

%Q, %q, %W, %w, %x, %r, %s, %i

Perl-inspired notation to quote strings: by using % (percent character) and specifying a delimiting character.

Any single non-alpha-numeric character can be used as the delimiter, %[including these], %?or these?, %~or even these things~.

Strings

% or %Q

@indyarocks
indyarocks / Scalability.txt
Last active June 4, 2023 04:59
Scalability Notes
Streaming processing services:
1. https://medium.com/@chandanbaranwal/spark-streaming-vs-flink-vs-storm-vs-kafka-streams-vs-samza-choose-your-stream-processing-91ea3f04675b
Consistent Hashing:
Article - https://medium.com/@sent0hil/consistent-hashing-a-guide-go-implementation-fe3421ac3e8f
Golang - https://github.com/indyarocks/consistent
@indyarocks
indyarocks / dynamodb_client.rb
Last active July 15, 2020 09:43
DynamoDB Client for Rails Application
## /config/initializers/dynamodb_client.rb
module DynamodbClient
def self.initialize!
client_config = if Rails.env.development?
{
region: 'us-west-2',
endpoint: 'http://localhost:8000'
}
else
{
@indyarocks
indyarocks / gist:067702297b99bf8dfbee3ef60ebf89e1
Created June 6, 2020 00:05
Rspec matcher for attr_accessor, attr_reader and attr_writer
# have_attr_reader matcher for attr_reader
RSpec::Matchers.define :have_attr_reader do |field|
match do |object_instance|
object_instance.respond_to?(field)
end
failure_message do |object_instance|
"expected attr_reader for #{field} on #{object_instance}"
end
@indyarocks
indyarocks / how-to-copy-aws-rds-to-local.md
Created May 25, 2019 09:22 — forked from syafiqfaiz/how-to-copy-aws-rds-to-local.md
How to copy production database on AWS RDS(postgresql) to local development database.
  1. Change your database RDS instance security group to allow your machine to access it.
    • Add your ip to the security group to acces the instance via Postgres.
  2. Make a copy of the database using pg_dump
    • $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
    • you will be asked for postgressql password.
    • a dump file(.sql) will be created
  3. Restore that dump file to your local database.
    • but you might need to drop the database and create it first
    • $ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
  • the database is restored
@indyarocks
indyarocks / create_activities_table.rake
Created May 18, 2017 19:27
Rake task to create a DynamoDB table in Rails application
# lib/tasks/dynamodb_tables_v1/create_activity_table.rake
# Rake task to create activities table
namespace :dynamodb_tables_v1 do
desc "bundle exec rake dynamodb_tables_v1:create_activity_table RAILS_ENV=<ENV>"
task :create_activity_table => :environment do
puts "Creating activities table in #{Rails.env}\n"
create_activity_table
puts "Completed task\n"
end