Skip to content

Instantly share code, notes, and snippets.

John Bachir jjb

Block or report user

Report or block jjb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jjb
jjb / config.ru
Created Oct 17, 2017
How to log file descriptor count in a rails or rack application
View config.ru
require_relative 'config/environment'
class FileDescriptorLogger
def initialize(app)
@app = app
end
def call(env)
if 1000==rand(1001)
unclosed_files = 0
View dumping only create table statements from postgres.sh
pg_dump --schema-only --no-privileges --no-owner DBNAME | awk 'RS="";/CREATE TABLE[^;]*;/' > DBNAME.sql
@jjb
jjb / file.md
Last active Mar 16, 2017 — forked from wam/gist:a86c51eaad03689a14fcd0d58e6cca0c
converting img tags to ruby image_tag helper
View file.md

intro

Goal is to convert

<img src="<%= ENV["IMAGE_URL"] %>/icons/app-ui-logo-white.png" id="topbar-logo" alt="Freedom logo">

to

View How to install ruby and gitsh on macOS with macports.md
sudo port selfupdate
sudo port install ruby26 # will include readline
sudo port select ruby ruby26

### >>> OPEN A NEW TERMINAL!!! <<<
### otherwise, the configuration won't point to the correct version of readline, no matter what you do.
### not sure if this is "through" the ruby binary, or something else in the environment
### i just saved you 17 hours of your life, you're welcome
@jjb
jjb / file.md
Last active Jun 6, 2018
Trying to figure out performance impact of RUBY_GC_HEAP_GROWTH_FACTOR
View file.md
View alert.sh
function alert {
if (( $? == 0 )) then
unicornleap > /dev/null &
say -v trinoids 'successfully done'
else
say -v bad 'failed'
fi
}
View gist:2e0f8fa4fc79954888b7
➔ time sudo port install phantomjs
---> Fetching archive for phantomjs
---> Attempting to fetch phantomjs-2.0.0_0.darwin_14.x86_64.tbz2 from http://packages.macports.org/phantomjs
---> Attempting to fetch phantomjs-2.0.0_0.darwin_14.x86_64.tbz2.rmd160 from http://packages.macports.org/phantomjs
---> Installing phantomjs @2.0.0_0
---> Activating phantomjs @2.0.0_0
---> Cleaning phantomjs
---> Updating database of binaries
---> Scanning binaries for linking errors
---> No broken files found.
View gist:fcda61801b54cc3f13d1
print "Fat: "
fat = gets.strip
print "Protein: "
protein = gets.strip
print "Carbohydrates: "
carbs = gets.strip
fat_calories = fat.to_f*9
View Cypher.md
Match (C:Cell) <- [*1..2] – (p:Cell) return c,p
You can’t perform that action at this time.