MacOS Sierra High comes with preinstalled postfix. Follow these steps to configure it on a local system:
sudo nano /etc/postfix/sasl_passwd- Add this to the file
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #define B 4 | |
| static unsigned char* ntb(unsigned char b[], unsigned int n) { | |
| b[0] = n >> 24; | |
| b[1] = n >> 16; | |
| b[2] = n >> 8; |
| digitalocean_domain.example example.com | |
| digitalocean_record.example example.com,<DO ID> | |
| digitalocean_record.fd-gmail-txt example.com,<DO ID> | |
| digitalocean_record.fd-mx["alt1.aspmx.l.google.com."] example.com,<DO ID> | |
| digitalocean_record.fd-mx["alt2.aspmx.l.google.com."] example.com,<DO ID> | |
| digitalocean_record.fd-mx["aspmx.l.google.com."] example.com,<DO ID> | |
| digitalocean_record.fd-mx["aspmx2.googlemail.com."] example.com,<DO ID> | |
| digitalocean_record.fd-mx["aspmx3.googlemail.com."] example.com,<DO ID> | |
| digitalocean_record.fd-ns["1"] example.com,<DO ID> | |
| digitalocean_record.fd-ns["2"] example.com,<DO ID> |
| upstream site { | |
| server unix:/home/site/web/site.com.ua/site/shared/sockets/puma.sock fail_timeout=0; | |
| } | |
| server { | |
| listen 80; | |
| server_name site.com.ua www.site.com.ua; | |
| rewrite ^(.+)$ https://site.com.ua$uri permanent; | |
| } |
Based on this tutorial but simplified and inlined. Particularly removed any Rails and 3rd party services part, assumed you just need deployment to any Ubuntu machine.
dhcp-script=/etc/detect_new_device.sh
Reference:
| INSTALL JAVA | |
| $ sudo apt-get update && sudo apt-get install default-jre | |
| INSTALL ELASTIC SEARCH https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-repositories.html | |
| $ wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - | |
| $ echo "deb https://packages.elastic.co/elasticsearch/2.x/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list | |
| $ sudo apt-get update && sudo apt-get install elasticsearch | |
| $ sudo update-rc.d elasticsearch defaults 95 10 | |
| $ sudo service elasticsearch restart | |
| $ sudo service elasticsearch status |
Question: How do we safely compare a date to an unknown value within a Rails application?
Example: params[:date_field] > 2.years.ago
Doing a bit of digging, it looks like 2.years.ago returns an instance of ActiveSupport::TimeWithZone.
In ruby, whenever you do a comparison of any sort ruby will follow the rules outlined in the Comparable module of stdlib.
ActiveSupport::TimeWithZone will create a instance of Time in a UTC time zone when doing comparisons with ActiveSupport::TimeWithZone#<=>.
The following document is intended to be a quick guide to getting you setup for doing local development with Chef. This guide was created on my MacBook, but should work fine with Linux, and Windows workstations as well.