Skip to content

Instantly share code, notes, and snippets.

View AtulKsol's full-sized avatar

Atul Khanduri AtulKsol

View GitHub Profile
@AtulKsol
AtulKsol / postgres-not-running-fix.md
Last active December 22, 2022 05:10
Postgres on OSX with homebrew not running

Postgres on OSX with homebrew not running [tested in mac]

Fix for following issue:

$ psql
psql: could not connect to server: No such file or directory
	Is the server running locally and accepting
	connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
@DSKonstantin
DSKonstantin / Auto start puma via systemctl description
Last active November 16, 2023 16:14
Auto start puma via systemctl
Article: https://github.com/puma/puma/blob/master/docs/systemd.md
#1 nano /etc/systemd/system/puma.service
#2 paste from puma.service
Commands:
# After installing or making changes to puma.service
systemctl daemon-reload
# Enable so it starts on boot
systemctl enable puma.service
@AtulKsol
AtulKsol / db_backup_commands.md
Last active April 25, 2024 14:36
Commands to backup & restore database
  1. pg_dump is a nifty utility designed to output a series of SQL statements that describes the schema and data of your database. You can control what goes into your backup by using additional flags.
    Backup: pg_dump -h localhost -p 5432 -U postgres -d mydb > backup.sql

    Restore: psql -h localhost -p 5432 -U postgres -d mydb < backup.sql

    -h is for host.
    -p is for port.
    -U is for username.
    -d is for database.

@AtulKsol
AtulKsol / docker-commands.md
Last active June 3, 2019 07:41
Docker commands

Container's IP Address

  • docker inspect CONTAINER-ID | grep IPAddress

Container IP address using docker-compose

  • docker-compose ip

Stop and remove all container

  • docker stop $(docker ps -a -q)
  • docker rm $(docker ps -a -q)
@AtulKhanduri
AtulKhanduri / local-ssl.md
Created February 14, 2016 20:12
Using SSL in your local Rails environment. Runs localhost in HTTPS.

Using SSL in your local Rails environment

Also check this helpful gist.

For every other project, the requirement of using SSL HTTPS crops up. And I’m sure, just like me, you were annoyed that there doesn’t seem to be a simple way to test your SSL stuff in your local development environment.

Well: Not any more. Here’s how you set up your local Rails environment so that you can use SSL in development if you want or need to.

Note: I’m assuming you don’t want to mess with your local Apache but want to use the regular Rails server command.

@timharding
timharding / circle_ci_to_engine_yard_deployment.md
Last active December 14, 2016 12:54
CircleCI to Engine Yard Continuous Deployment

Configuring CircleCI to deploy to Engine Yard

Preamble

This is a brief description of how to get CircleCI builds deployed to an Engine Yard hosted staging environment automatically.

We're essentially asking CircleCI to execute commands on the Engine Yard gem to ask EY to deploy a Rails app.

CircleCI needs an SSH key and an API token to talk to Engine Yard, at that point you can execute the deploy command on the gem when the build succeeds.

@apisznasdin
apisznasdin / Config file for sSMTP sendmail
Created January 24, 2014 08:19
Config file for sSMTP sendmail using Mandrill
#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=user@domain.com
# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=smtp.mandrillapp.com:587
@maxim
maxim / rails_load_path_tips.md
Last active April 13, 2023 13:28
How to use rails load paths, app, and lib directories.

In Rails 3

NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths

If you add a dir directly under app/

Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.

If you add a dir under app/something/