Skip to content

Instantly share code, notes, and snippets.

View nplusp's full-sized avatar

Mikita Pridorozhko nplusp

View GitHub Profile

How to deploy a Rails 7.1 app with Postgres and Kamal on a single server

I think you have looked at the tutorial from Mr. Heinemeier Hansson at least once or twice and have a similar setup.

rails new kamal_pg --css tailwind --skip-test --database=postgresql

cd kamal_pg
@nplusp
nplusp / git-tag-delete-local-and-remote.sh
Created July 24, 2019 18:36 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@nplusp
nplusp / gist:5f55595ef9bb309bafb603a41bda0094
Created June 10, 2019 13:56
Install PG gem without locally installed Postgres
brew install libpq
gem install pg -- --with-opt-dir="/usr/local/opt/libpq"
bundle config --local build.pg --with-opt-dir="/usr/local/opt/libpq"
bundle install

Keybase proof

I hereby claim:

  • I am nplusp on github.
  • I am nplusp (https://keybase.io/nplusp) on keybase.
  • I have a public key whose fingerprint is 15FB 8132 60B8 3D73 44BC B9CF 5869 568A B841 34B0

To claim this, I am signing this object:

@nplusp
nplusp / gist:5c2a579f14283063743d0b8701171d3f
Created April 12, 2019 12:45
fix mysql max index length of 767
ALTER DATABASE dbname CHARACTER SET utf8 COLLATE utf8_general_ci;
@nplusp
nplusp / ssl_puma.sh
Created July 12, 2018 16:16 — forked from tadast/ssl_puma.sh
localhost SSL with puma
# 1) Create your private key (any password will do, we remove it below)
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@nplusp
nplusp / gist:b6ebd6998e03d9cee83e46f174faab31
Created August 9, 2017 13:59
Catch slow queries in Postgres
cat /etc/postgresql/9.6/main/postgresql.conf | grep log_min_duration_statement
#log_min_duration_statement = -1 # -1 is disabled, 0 logs all statements
log_min_duration_statement = 100
sudo tail -f /var/log/postgresql/postgresql-9.6-main.log
@nplusp
nplusp / gist:34aad8df58974eb2b15162a5d26b0776
Last active March 13, 2017 13:31
using SSH over HTTPS for CircleCI to fix authentication issues
checkout:
post:
# Work around some silly configuration added by Circle that doesn't actually even do what they want it to.
- git config --global --unset url.ssh://git@github.com:.insteadof
@nplusp
nplusp / gist:6299f5cdca45b42506f76c64376f5e26
Created March 13, 2017 11:34
Speed up your bundle install
bundle config --global jobs 3 # Number of cores - 1
@nplusp
nplusp / gist:d46d9cd3f07673e21ecfbb626d6199ad
Created January 27, 2017 12:51
run scripts on Heroku
echo "puts User.count" | heroku run console --app=my-heroku-app --no-tty
cat some_script.rb | heroku run console --app=my-heroku-app --no-tty
heroku run bundle exec rails runner ./scripts/script.rb -a my-heroku-app
heroku run bash