Skip to content

Instantly share code, notes, and snippets.

@vincentlkl
vincentlkl / instruction.txt
Created November 6, 2017 14:52
Automate Backup in VPS
1. SSH to server
2. $ sudo gem install backup
3. $ backup generate:model --trigger=db_backup --databases='postgresql' --storages='dropbox'
4. Edit the /Backup folder
5. Test it manually
$ backup perform -t db_backup
6. Install whenever at /Backup folder
$ sudo gem install whenever
7. $ mkdir config
8. $ wheneverize
@brycejohnston
brycejohnston / sidekiq.service
Last active March 18, 2021 11:51
Sidekiq systemd service for Debian
#
# systemd unit file for Debian
#
# Put this in /lib/systemd/system
# Run:
# - systemctl enable sidekiq
# - systemctl {start,stop,restart} sidekiq
#
# This file corresponds to a single Sidekiq process. Add multiple copies
# to run multiple processes (sidekiq-1, sidekiq-2, etc).
POST /oauth/token HTTP/1.1
Content-Type: application/json

{
  "grant_type": "password",
  "client_id": "CLIENT_ID",
  "owner_type": "OWNER_TYPE",
  "username": "OWNER_EMAIL",
 "password": "OWNER_PASSWORD"
@indiesquidge
indiesquidge / subdomain-localhost-rails-5.md
Created January 19, 2016 07:42
how to access subdomains locally with Rails 5

Subdomaining Localhost with Rails 5

I've been following this blog post on how to set up an api-only Rails 5 application. One of the sections talks about creating a subdomain for your api

Rails.application.routes.draw do
  constraints subdomain: "api" do
    scope module: "api" do
@maxivak
maxivak / readme.md
Last active October 18, 2025 00:23
Integrating Gem/Engine and Main Rails App
@tadast
tadast / ssl_puma.sh
Last active September 23, 2025 21:04 — forked from trcarden/gist:3295935
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
@amejiarosario
amejiarosario / rails_migration_cheatsheet.md
Created June 18, 2012 21:40
Rails Migration - Cheatsheet
@rstacruz
rstacruz / index.md
Last active August 2, 2025 18:42
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one