This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```mermaid | |
erDiagram | |
USER ||--o{ SPACE | |
SPACE | |
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1) Put 's3' gem in Gemfile. | |
# 2) Create as3.yml configuration for S3 | |
# 3) Create initializer for as3.yml | |
# 4) Make "assets" folder inside your bucket | |
# 5) After running task run "RAILS_ENV=production rake assets:precompile" | |
# 6) Invoke task by running "rake as3:upload" | |
namespace :as3 do | |
desc "Uploads compiled assets (public/assets) to Amazone AS3" | |
task :upload do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/tailwind.min.css" rel="stylesheet"> | |
<style> | |
.sidebar { | |
width: 5rem; /* Adjust the width as needed */ | |
height: 100vh; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "active_record" | |
namespace :db do | |
db_config = YAML::load(File.open('config/database.yml')) | |
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'}) | |
desc "Create the database" | |
task :create do | |
ActiveRecord::Base.establish_connection(db_config_admin) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
require "sinatra/reloader" if development? | |
require 'http' | |
require 'json' | |
# https://www.linkedin.com/developers/apps | |
class Settings | |
CLIENT_ID = '...' | |
CLIENT_SECRET = '...' | |
ACCESS_TOKEN = '...' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Graph | |
def initialize | |
@graph = { | |
"Odin" => [["Thor", 1], ["Heimdall", 1]], | |
"Fregg" => [["Heimdall", 1], ["Thor", 1]], | |
"Heimdall" => [["Odin", 1], ["Fregg", 1]], | |
"Thor" => [["Odin", 1], ["Loki", 1], ["Fregg", 1]], | |
"Loki" => [["Thor", 1]] | |
} | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# unlogged tables used to speedup tests, but its are not crash proof | |
config.to_prepare do | |
ActiveSupport.on_load(:active_record) do | |
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.create_unlogged_tables = true | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://site.com http://www.site.com https://www.site.com { | |
redir https://site.com{uri} | |
} | |
https://site.com { | |
root * /var/www/site/current/public | |
log { | |
output file /var/www/site/shared/log/access.log { | |
roll_size 10MB |
NewerOlder