Skip to content

Instantly share code, notes, and snippets.

View DSKonstantin's full-sized avatar

Konstantin D. DSKonstantin

View GitHub Profile
@DSKonstantin
DSKonstantin / nextjs-deploy.md
Created May 11, 2022 21:26 — forked from jjsquady/nextjs-deploy.md
Deploying NEXTJS site with nginx + pm2

How to setup next.js app on nginx with letsencrypt

next.js, nginx, reverse-proxy, ssl

1. Install nginx and letsencrypt

$ sudo apt-get update
$ sudo apt-get install nginx letsencrypt

Also enable nginx in ufw

@DSKonstantin
DSKonstantin / SQL for material view.
Created July 19, 2019 08:43
Can you check this SQL request? This was made for material view in DB (using gem 'scenic'). I want to know what could go wrong, what risks hidden here?
SELECT
payroll_reports.employee_work_period_id,
(select sum(a.regular_hours) from payroll_reports a where a.salary_type = '1' and a.employee_work_period_id = payroll_reports.employee_work_period_id) as hourly_regular_hours,
(select sum(a.regular_gross_amount_cents) from payroll_reports a where a.salary_type = '1' and a.employee_work_period_id = payroll_reports.employee_work_period_id) as hourly_regular_gross_amount_cents,
(select sum(a.ytd_regular_hours) from payroll_reports a where a.salary_type = '1' and a.employee_work_period_id = payroll_reports.employee_work_period_id) as hourly_ytd_regular_hours,
(select sum(a.ytd_regular_gross_amount_cents) from payroll_reports a where a.salary_type = '1' and a.employee_work_period_id = payroll_reports.employee_work_period_id) as hourly_ytd_regular_gross_amount_cents,
(select sum(a.overtime_hours) from payroll_reports a where a.salary_type = '1' and a.employee_work_period_id = payroll_reports.employee_work_period_id) as hourly_overtime_hours,
@DSKonstantin
DSKonstantin / instruction
Last active December 29, 2022 16:08
SET SSL
For resolve problem in old solution - apt install certbot
======
https://gorails.com/guides/free-ssl-with-rails-and-nginx-using-let-s-encrypt
cd ~
git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt/
./letsencrypt-auto
@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
upstream puma {
server unix:///root/cheapsea/shared/tmp/sockets/cheapsea-puma.sock;
}
server {
#listen 80 default_server deferred;
#server_name cheapsea.net;
listen 443 ssl http2;
listen [::]:443 ssl http2;
.select2-container {
box-sizing: border-box;
display: inline-block;
margin: 0;
position: relative;
vertical-align: middle
}
.select2 {
/*width: calc(100% - 45px) !important;*/
width: 100% !important;