TILs - Fueling Curiosity, One Insight at a Time

At Codemancers, we believe every day is an opportunity to grow. This section is where our team shares bite-sized discoveries, technical breakthroughs and fascinating nuggets of wisdom we've stumbled upon in our work.

Published
Author
user-image
Soniya Rayabagi
Create a PostgreSQL Database in Docker .

Step 1: Download the latest version of the Postgres image :

Code

docker pull postgres


Step 2: Create and Run Postgres Container :

Code

docker run -d --name  -p 5432:5432 -e POSTGRES_PASSWORD= postgres


Step 3: Verify Executing Container :

Code

docker ps


Step 4: Interact with Executing Container :

Code

docker exec -it  bash


Step 5: Connect to Postgresql Database Server :

Code

psql -h localhost -U postgres


Step 6: Create Postgresql Database :

Code

CREATE DATABASE ;
\l


Step 7: Establish a connection with database :

Code

\c


Step 8: Create Database User :

Code

CREATE USER  with PASSWORD ;


Step 9: Exit :

Code

\q


#devops #docker
Published
Author
user-image
Satya
In a typical Rack middleware setup, the call method handles the initial request and generates a response, but it does not control subsequent redirects initiated by external services. If an external service, such as Slack's OAuth, triggers additional redirects after your application responds, modifying headers for those redirects within the same call method may not be directly achievable. Handling subsequent redirects may require alternative approaches, such as additional middleware or different parts of your application's code.
#rails , #rack , #middleware
Published
Author
user-image
Satya
test your gem locally before publishing.
• STEP 1 - cd into your gem directory and run gem build your-gem.gemspec
• STEP 2 - in the same directory then run gem install ./your-gem-<version>.gem (<version> will be replaced by the current version of your gem)
• STEP 3 - Now cd into your project where you want to install this gem.
• STEP 4 - Open Gemfile and add gem 'your-gem', path: '/path/to/your-gem' (Replace /path/to/your-gem with the actual path to your gem.
#ruby-gems , #rails
TIP: you can get your path by running pwd in your terminal where you have opened your gem file.
Published
Author
user-image
Giritharan
System Analyst
Fly Secret Value Displaying Feature:

We can able to see Fly secrets values from terminal . From the Dashboard of fly we can't able to the secret value. But from the terminal we can able to the see secret value .
For that we have use below command:
• First Go the project in terminal and enter the fly ssh console. It redirects you to the fly application in remote.
• Then you can see the what value you want using echo command. Ex: echo $DATABASE_URL . After entered like this it will display what is the value of the key. Likewise you can place what are ever key want to see.
Published
Author
user-image
Soniya Rayabagi
To delete a Docker image we can use a command docker rmi [IMAGE_ID or REPOSITORY:TAG] and ,
To remove all dangling images that consume disk space , can use docker image prune
Published
Author
user-image
Satya
forms in rails 7 are now submitted with turbo_stream format.
for eg: from the logs:
Started POST "/books" for 127.0.0.1 at 2024-02-16 14:44:16 +0530
Processing by BooksController#create as TURBO_STREAM
Published
Author
user-image
Nisanth
To remove rvm and its traces, you can use the rvm command itself:
rvm implode
This command will remove all traces of rvm from your system.
Published
Author
user-image
Satya
difference between oauth/v2/authorize & openid/connect/authorize
I am taking the example in context of Slack .
1. OAuth 2.0 (/oauth/v2/authorize):
Usage: When a third-party application needs to access a user's resources in Slack, it uses the /oauth/v2/authorize endpoint.
Process: The user is prompted to grant the application permission to access their resources. Upon consent, Slack returns an authorization code to the application. This code is then exchanged for an access token, which the application uses to access the user's resources on Slack.
Focus: Purely on granting access to resources (authorization).
2. OpenID Connect (/openid/connect/authorize):
Usage: When an application not only needs to access resources but also verify the identity of the Slack user, it uses the /openid/connect/authorize endpoint.
Process: Similar to OAuth 2.0, but in addition to granting access, this process authenticates the user and returns an ID token along with an authorization code. The ID token contains claims about the user's identity, which can be used by the application to verify who the user is.
Focus: On both verifying user identity (authentication) and granting access to resources (authorization).

Showing 30 to 32 of 83 results

Ready to Build Something Amazing?

Codemancers can bring your vision to life and help you achieve your goals

  • Address
    2nd Floor, Zee Plaza,
    No. 1678, 27th Main Rd,
    Sector 2, HSR Layout,
    Bengaluru, Karnataka 560102
  • Contact

    +91-9731601276