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 <[email protected]>
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 / 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 / redis-zset.rb
Created May 21, 2017 19:37
Redis ZSET Data type
127.0.0.1:6379> ZADD class1:math 98 Tithi 50 Raju 80 Andrew # Create a new class 1 math score SET.
(integer) 3 # Add three members with their respective scores
127.0.0.1:6379> ZRANGEBYSCORE class1:math 0 10 # Fetch students scored between 0 to 10. No Student scored between 0 to 10
(empty list or set)
127.0.0.1:6379> ZRANGEBYSCORE class1:math 0 60 # Fetch students scored between 0 to 60. Raju
1) "Raju"
127.0.0.1:6379> ZRANGEBYSCORE class1:math 0 60 WITHSCORES # Fetch students with scores who scored between 0 to 60. Raju
1) "Raju"
2) "50"
127.0.0.1:6379> ZRANGE class1:math 0 10 WITHSCORES # Fetch students from ZSET class1:math with position 0 to 10.
@indyarocks
indyarocks / redis-hash.rb
Created May 21, 2017 19:05
Redis HASH data type
127.0.0.1:6379> HSET my_hash key1 1 # Initializes a HASH my_hash with key-value key1: 1
(integer) 1
127.0.0.1:6379> HSET my_hash key2 value2 # Sets another key-value pair key2: value2 in my_hash
(integer) 1
127.0.0.1:6379> HGET my_hash key1 # GET the data for key1 in my_hash
"1"
127.0.0.1:6379> HGET my_hash key2 # GET the data for key2 in my_hash
"value2"
127.0.0.1:6379> HGETALL my_hash # GET the complete data in my_hash
1) "key1"