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.
Feb 3, 2024
while running
That can be because of 2 reasons.
1. Your service isn't running , that can be fixed using
2. Your service is running , but there is some error like
We can fix the 2nd error by removing the process pid file.
• Step 1 ->
• Step 2 ->
• Step 3 ->
These 3 steps should fix the error and we can check the info by running
psql postgres
if we face the below error:psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
That can be because of 2 reasons.
1. Your service isn't running , that can be fixed using
brew services start postgresql@15
2. Your service is running , but there is some error like
Bootstrap failed: 5: Input/output error
Try re-running the command as root for richer errors.
Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/<user>/Library/LaunchAgents/homebrew.mxcl.postgresql@15.plist` exited with 5.
We can fix the 2nd error by removing the process pid file.
• Step 1 ->
brew services stop postgresql@15
• Step 2 ->
rm -f /opt/homebrew/var/postgresql@15/postmaster.pid
(apple sillicon install it at opt/homebrew)• Step 3 ->
brew services start postgresql@15
These 3 steps should fix the error and we can check the info by running
brew services info postgresql@15
satya
Feb 3, 2024
While testing request spec in rails, configure host in your environment(development/test) :-
Add below line in your "config/environment/test" file.
Add below line in your "config/environment/test" file.
config.hosts << "www.example.com"
Sachin Kabadi
System Analyst
Feb 2, 2024
CIDR Block(Classless Inter-Domain Routing)
Example : CIDR block: 192.168.1.0/28
This CIDR block represents all IP addresses between 192.168.1.0 and 192.168.1.15. The "/28" notation indicates that the first 28 bits of the IP address are fixed (192.168.1.0), and the remaining 4 bits (from 0 to 15) can vary, resulting in 16 possible IP addresses in the range. This range allows for 16 IP addresses, from 192.168.1.0 to 192.168.1.15.
soniya.rayabagi
Feb 2, 2024
pg_dump commands:
Standard pg_dump without DROP table queries:
Standard pg_dump without DROP table queries:
pg_dump -h your-hostname -p your-port -U your-username -d your-database-name -f output-file.sql``
pg_dump with DROP table queries (clean dump):
pg_dump -h your-hostname -p your-port -U your-username -d your-database-name --clean -f output-file.sql
pg_dump for schema only:
pg_dump -h your-hostname -p your-port -U your-username -d your-database-name --schema-only -f output-file.sql
pg_dump for data only:
pg_dump -h your-hostname -p your-port -U your-username -d your-database-name --data-only -f output-file.sql
pg_dump for data only (no schema, INSERT commands only):
pg_dump -h your-hostname -p your-port -U your-username -d your-database-name --data-only --inserts -f output-file.sql`sujay
Feb 1, 2024
While using
i.e
For eg:
sidekiq-scheduler
if your schedule file is named as sidekiq.yml
make sure to add the schedule config entry.i.e
:scheduler:
-> :schedule
.For eg:
:scheduler:
:schedule:
fetch_user_info_from_slack:
cron: '0 6 * * * Asia/Kolkata'
class: FetchSlackUserInfoJob
queue: 'default'
description: 'This job fetches user info from slack and updates the database'
satya
Jan 31, 2024
AWS - ami
If you want to create two instances in different regions within the same Terraform file, using the
For example :
If you want to create two instances in different regions within the same Terraform file, using the
same AMI,
you should first ensure that the AMI is available in both regions. If it's available in both regions (i.e.- "us-east-1" and "us-east-2")
, you can proceed to use the same AMI for both instances. Otherwise, you should use two different AMIs.For example :
provider "aws" {
alias = "us-east-2"
region = "us-east-2"
}
resource "aws_instance" "instance" {
provider = aws.us-east-2
ami = "ami-id-1"
instance_type = "t2.micro"
}
provider "aws" {
alias = "us-east-1"
region = "us-east-1"
}
resource "aws_instance" "instance1" {
provider = aws.us-east-1
ami = "ami-id-2"
instance_type = "t2.micro"
}
soniya.rayabagi
Jan 31, 2024
Git rebase
is a command to reapply commits from one branch onto another, effectively rewriting the commit history.1. Use
git rebase main
to start.2. Resolve conflicts manually in files.
3. Add resolved files
git add <file>
.4. Continue rebase
git rebase --continue.
5. Finally, force-push changes
git push <remote> <branch-name> —-force
.soniya.rayabagi
Jan 30, 2024
Using the command “git push origin feature-branch -f” forces the remote repository to match the precise state of the local repository. However, it should be used with caution because it has the ability to overwrite remote modifications and cause data loss.
neehar.priydarshi
Jan 30, 2024
Using git rebase command allows you to modify the history of your repository by changing a sequence of commits. It lets you to reorganise, modify, and merge commits. Git rebase is commonly used for resolving conflicts.
neehar.priydarshi
Jan 30, 2024
The
<<-EOF
and EOF
are Terraform's heredoc syntax
, This syntax enables the creation of multiline strings in Terraform configuration files without the need to manually insert newline characters (\n
).soniya.rayabagi
Showing 27 to 29 of 77 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
hello@codemancers.com
+91-9731601276