Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

#! /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
#!/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(' ')
#!/usr/bin/env ruby
require 'benchmark'
require 'cgi'
require 'net/http'
require 'resolv'
require 'resolv-replace'
host = ''
period = 10
count = 3
# 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}")