This tutorial uses Homebrew to install colima and Docker.
It was tested on Apple MacBook Pro (13-inch, M1, 2020) 8G and macOS Monterey version 12.1 (21C52).
Make sure you have fully uninstall any versions of Docker. You can check using:
| database: &default | |
| host: 127.0.0.1 | |
| adapter: proxy_mysql2 | |
| ... |
| # Gemfile | |
| gem 'aws-sdk-s3' |
| # Check server process is using jemalloc | |
| # ref. [Japanese] https://tech.studyplus.co.jp/entry/2019/09/09/094140 | |
| class AppController < ActionController::Base | |
| def show | |
| r = `strings /proc/#{Process.pid}/maps | grep jemalloc` | |
| render plain: "<h1>#{ENV['LD_PRELOAD'].presence || 'empty'}</h1><pre>#{r}</pre>" | |
| end | |
| end |
| 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 |
| class Tree | |
| attr_reader :raw_data, :nodes, :tree | |
| def initialize(string) | |
| @raw_data = string | |
| @tree = {} | |
| end | |
| def format_data | |
| @nodes = raw_data.split("\n").map{ |d| n= d.split(','); { name: n[0], id: n[1], parent_id: n[2] } } |
This is just some code I recently used in my development application in order to add token-based authentication for my api-only rails app. The api-client was to be consumed by a mobile application, so I needed an authentication solution that would keep the user logged in indefinetly and the only way to do this was either using refresh tokens or sliding sessions.
I also needed a way to both blacklist and whitelist tokens based on a unique identifier (jti)
Before trying it out DIY, I considered using:
| ## | |
| ## This nginx.conf servers as the main config file for webflow reverse proxy | |
| ## | |
| ## RCS: | |
| ## https://gist.github.com/sansmischevia/5617402 | |
| ## | |
| ## Hardening tips: | |
| ## http://www.cyberciti.biz/tips/linux-unix-bsd-nginx-webserver-security.html | |
| ## |
Requires
Configure path to your ECS SSH key file ~/.bashrc
echo 'export ECS_PEM_FILE=$HOME/docker.pem' >> ~/.bashrc
| # | |
| # Check for every table with temporal columns if there are records that have dates set to '0000-00-00' | |
| conn = ActiveRecord::Base.connection | |
| # get a list of tables and columns with a date type excluding merge tables | |
| query = "select concat(`table_schema`,'.',`table_name`) as table_name,`COLUMN_NAME` from information_schema.`columns` where data_type like '%date%' AND concat(`table_schema`,'.',`table_name`) not in (select concat(`table_schema`,'.',`table_name`) from information_schema.tables where engine='mrg_myisam');" | |
| list = conn.select_all( query ) | |
| # transform the list a bit for later querying |