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
# Add info in the ps listing of rails server and delayed jobs processes | |
# app/controllers/application_controller.rb | |
before_action :proctitle | |
after_action :unproctitle | |
def proctitle | |
path = request.env['REQUEST_PATH']&.first(25) | |
Process.setproctitle("#{$PROGRAM_NAME} - #{path}") |
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
#!/usr/bin/env ruby | |
require 'benchmark' | |
require 'cgi' | |
require 'net/http' | |
require 'resolv' | |
require 'resolv-replace' | |
host = '' | |
period = 10 | |
count = 3 |
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
#!/usr/bin/env ruby | |
env_rb = ['../config/environment.rb', 'config/environment.rb'].detect { |file| File.exist? file } | |
raise 'Run this from rails root or a subdirectory.' unless env_rb | |
require File.expand_path(env_rb) | |
if ARGV[0] =~ /^-[cexq]$/ | |
ARGV.shift | |
sql_in = ARGV.join(' ') |
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
#! /usr/bin/env ruby | |
# adapted from https://gist.github.com/gabehollombe/064a90351c204381832d749ca6b569e0 | |
# but it actually edits a file! | |
# `editor.rb [filename]` | |
# arrows, letters, backspace... Just the basics. | |
require 'curses' | |
include Curses | |
include Curses::Key |