Skip to content

Instantly share code, notes, and snippets.

@Epictetus
Epictetus / sunrise.rb
Created September 16, 2023 19:50 — forked from njh/sunrise.rb
Ruby Code to calculate sunrise and sunset times where I live
#!/usr/bin/env ruby
require 'rubygems'
require 'solareventcalculator'
solar = SolarEventCalculator.new(Date.today, BigDecimal.new('51.563'), BigDecimal.new('-0.499'))
puts "Sunrise: #{solar.compute_utc_civil_sunrise.getlocal}"
puts "Sunset: #{solar.compute_utc_civil_sunset.getlocal}"
@Epictetus
Epictetus / Gemfile
Created September 16, 2023 19:41 — forked from zxjinn/Gemfile
Ruby sunrise daemon
source 'https://rubygems.org'
gem 'daemons'
gem 'RubySunrise'
gem 'rufus-scheduler'
@Epictetus
Epictetus / blockmetatwitter.md
Created June 26, 2023 21:23 — forked from dangovorenefekt/blockmetatwitter.md
Block Meta and Twitter (nginx)
@Epictetus
Epictetus / nginx-config-rails4-with-puma-ssl-version.conf
Created August 13, 2022 11:14 — forked from rkjha/nginx-config-rails4-with-puma-ssl-version.conf
Nginx config for rails 4 application using puma [ssl and non-ssl version]
upstream myapp_puma {
server unix:/tmp/myapp_puma.sock fail_timeout=0;
}
# for redirecting to https version of the site
server {
listen 80;
rewrite ^(.*) https://$host$1 permanent;
}
@Epictetus
Epictetus / crontab
Created August 13, 2022 02:52 — forked from xfyuan/crontab
Nginx + Let's Encrypt + Rails5 + Puma
00 05 01 * * /home/alea12/letsencrypt/letsencrypt-auto certonly --webroot -w /var/www/html -d example.net --renew-by-default && nginx -t && nginx -s reload
@Epictetus
Epictetus / 1 SETUP Ubuntu 20.04 LTS (DigitalOcean)
Created May 23, 2022 08:54 — forked from VasylShevchenko/1 SETUP Ubuntu 20.04 LTS (DigitalOcean)
Deploy Rails to VPS(Ubuntu 20.04LTS). Nginx mainline + pagespeed, Puma with Jungle, Capistrano3, PostgreSQL, RVM, Certbot
//------ ROOT --------
root# apt-get update
root# apt-get upgrade
// Dependencies
apt-get install -y git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev \
libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev \
libpcre3-dev unzip htop zip

Change SSH Port and Disable Root Login

Edit SSH Config File (You need sudo permission)

vi /etc/ssh/sshd_config

Update/Uncomment the # Port 22 line and change the port number to something else, let's say 9044, to be something similar to the following:

Port 9044

Disable Root Login, by uncommenting # PermitRootLogin yes and change it to

@Epictetus
Epictetus / 1 Gist conventions
Created May 13, 2022 05:10 — forked from rubywarlock/1 Gist conventions
Deploy Rails 5.0.0.beta3 to VPS(Ubuntu 14.04.4 LTS). Nginx, Puma, Capistrano3, PostgreSQL, RVM.
<<APP>> change this variables
@Epictetus
Epictetus / example.md
Created May 13, 2022 04:55 — forked from 0x263b/example.md
Puma + Nginx + Upstart

Assuming your domain is example.com and your apps root directory is /var/www/example.com

Puma

cd into the root directory and create directories var/run, var/log. This is where your domain socket and server logs will be stored.

Next create a file puma.rb with the following

threads 1, 6
# /etc/init/puma.conf - Puma config
# This example config should work with Ubuntu 12.04+. It
# allows you to manage multiple Puma instances with
# Upstart, Ubuntu's native service management tool.
#
# See puma-manager.conf for how to manage all Puma instances at once.
#
# Save this config as /etc/init/puma.conf then manage puma with:
# sudo start puma app=PATH_TO_APP