Skip to content

Instantly share code, notes, and snippets.

sudo ufw allow 22/tcp # for ssh
sudo ufw allow 80/tcp # for http
sudo ufw allow 443/tcp # only for ssl
sudo ufw show added # make sure ports that you needed are opened.
# only run this if you are ready
sudo ufw enable
upstream MY_APP {
server 127.0.0.1:3000;
server 127.0.0.1:3000 max_fails=1 fail_timeout=30s backup;
keepalive 64;
}
server {
listen 443;
server_name WWW.SOMETHING.COM;
add_header X-Frame-Options "SAMEORIGIN";
server {
passenger_ruby /home/ubuntu/.rvm/gems/ruby-2.6.3@PROJECT_GEM/wrappers/ruby;
ssl_prefer_server_ciphers on;
# Add HSTS
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
client_max_body_size 50M;
listen 443;
server_name WWW.SOMETHING.COM;
passenger_enabled on;
@SaKKo
SaKKo / rails-jsonb-queries
Created June 15, 2019 07:32 — forked from mankind/rails-jsonb-queries
Rails-5 postgresql-9.6 jsonb queries
http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query
http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails
#payload: [{"kind"=>"person"}]
Segment.where("payload @> ?", [{kind: "person"}].to_json)
#data: {"interest"=>["music", "movies", "programming"]}
Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json)
Segment.where("data #>> '{interest, 1}' = 'movies' ")
Segment.where("jsonb_array_length(data->'interest') > 1")
@SaKKo
SaKKo / alfred2-iterm2.9-apple-script.md
Last active October 13, 2015 08:23
Alfred2 iTerm2-9 Apple Script
    on is_running(app_name)
        tell application "System Events" to (name of processes) contains app_name
    end is_running

    on run_script(q)
        if is_running("iTerm2") or is_running("iTerm") then
            run script "
                on run {q}
                    tell application \":Applications:iTerm.app\"

activate