This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.
Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).
This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.
Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).
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| # save history to ~/.bash_history as soon as command is run | |
| export PROMPT_COMMAND='history -a' | |
| # save unlimited history | |
| # osx doesn't seem to respect =-1 or = options | |
| export HISTSIZE=9999999999 | |
| export HISTFILESIZE=999999999 | |
| # osx doesn't actually respect this and it'll fall back to unix timestamp (which we want) | |
| export HISTTIMEFORMAT="%d/%m/%y %T " |
| #!/bin/bash | |
| while read oldrev newrev ref | |
| do | |
| branch=`echo $ref | cut -d/ -f3` | |
| if [ "master" == "$branch" ]; then | |
| git --work-tree=./path/under/root/dir/live-site/ checkout -f $branch | |
| echo 'Changes pushed live.' | |
| fi |
| HTTP status code symbols for Rails | |
| Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings. | |
| Status Code Symbol | |
| 1xx Informational | |
| 100 :continue | |
| 101 :switching_protocols | |
| 102 :processing |
| class UserProfile < ActiveRecord::Base | |
| has_attached_file :picture, | |
| styles: { | |
| original: {geometry: '1000x0>'}, | |
| thumb: '100x100#', | |
| large: '300x200>', | |
| }, | |
| convert_options: {large: "-quality 80 -strip -interlace Plane"}, | |
| default_url: "http://s3-ap-southeast-1.amazonaws.com/#{ENV["S3_BUCKET"]}/user_profiles/placeholder.png", | |
| path: (Rails.env == 'test' || Rails.env == 'development') ? ":rails_root/public/images/:class/:id/:style/:filename" : "/:class/:id/:style/:filename", |
| FROM tensorflow/tensorflow:latest-gpu-py3 | |
| RUN apt update -y && apt install -y \ | |
| libsm6 \ | |
| libxext6 \ | |
| libxrender-dev | |
| RUN pip install \ | |
| opencv-python |
| class CustomFileStringIO < StringIO | |
| def initialize(*args) | |
| super(*args[1..-1]) | |
| @file_name = args[0] | |
| end | |
| def original_filename | |
| @file_name | |
| end | |
| end |