start new:
tmux
start new with session name:
tmux new -s myname
#!/usr/bin/env ruby | |
# | |
# If you are the first clone of this Project | |
# Please run `ruby cp_config_files` at your command line, Add all config files | |
# Finally, modify the database.yml file parameters (username & password) | |
require "fileutils" | |
def cp_files(yml_files) | |
files = Dir["config/#{yml_files}"] |
#!/usr/bin/env ruby | |
# | |
# Download the configuration file from the server and upload it to another server | |
# | |
# How to run it | |
# | |
# ruby sync-files.rb source_server target_server config_folder | |
require 'fileutils' |
require 'sidekiq/api' | |
stats = Sidekiq::Stats.new | |
stats.queues | |
=> { "mailers"=>80 } | |
queue = Sidekiq::Queue.new('mailers') | |
queue.count | |
queue.clear |
Warning on ruby 2.6.3 after you upgrade rbenv | |
/Users/encore/.rbenv/versions/2.6.1/bin/ruby: warning: RUBY_FREE_MIN is obsolete. Use RUBY_GC_HEAP_FREE_SLOTS instead. | |
/Users/encore/.rbenv/versions/2.6.1/bin/ruby: warning: RUBY_HEAP_MIN_SLOTS is obsolete. Use RUBY_GC_HEAP_INIT_SLOTS instead. | |
/Users/encore/.rbenv/versions/2.6.1/bin/ruby: warning: RUBY_FREE_MIN is obsolete. Use RUBY_GC_HEAP_FREE_SLOTS instead. | |
/Users/encore/.rbenv/versions/2.6.1/bin/ruby: warning: RUBY_HEAP_MIN_SLOTS is obsolete. Use RUBY_GC_HEAP_INIT_SLOTS instead. | |
=> Booting WEBrick | |
=> Rails 5.2.2.1 application starting in development on http://localhost:3000 | |
=> Run `rails server -h` for more startup options | |
[2019-05-21 20:03:34] INFO WEBrick 1.4.2 |
-- Create a group | |
CREATE ROLE readaccess; | |
-- Grant access to existing tables | |
GRANT USAGE ON SCHEMA public TO readaccess; | |
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess; | |
-- Grant access to future tables | |
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess; |
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
#!/usr/bin/env ruby | |
require 'english' | |
require 'rubocop' | |
ADDED_OR_MODIFIED = /A|AM|^M/.freeze | |
changed_files = `git status --porcelain`.split(/\n/). | |
select { |file_name_with_status| | |
file_name_with_status =~ ADDED_OR_MODIFIED |
" ============================================================================= | |
" Miller Medeiros .vimrc file | |
" ----------------------------------------------------------------------------- | |
" heavily inspired by: @factorylabs, @scrooloose, @nvie, @gf3, @bit-theory. | |
" ============================================================================= | |
" ----------------------------------------------------------------------------- | |
" BEHAVIOR | |
" ----------------------------------------------------------------------------- |
upstream puma { | |
server unix:///var/www/production/icmoc.com/shared/tmp/sockets/blog-puma.sock; | |
} | |
server { | |
listen 80 default_server deferred; | |
# server_name example.com; | |
root /var/www/production/icmoc.com/current/public; | |
access_log /var/www/production/icmoc.com/current/log/nginx.access.log; |