Skip to content

Instantly share code, notes, and snippets.

View vinbarnes's full-sized avatar

Kevin R. Barnes vinbarnes

View GitHub Profile
@vinbarnes
vinbarnes / repl.js
Created April 4, 2019 01:47 — forked from blackwright/repl.js
Sequelize REPL
// Require the REPL module
// and models
let repl = require('repl').start({});
const models = require('./models');
// Make the `models` object
// a global variable in the
// REPL
repl.context.models = models;
@vinbarnes
vinbarnes / optparse-template.rb
Created February 13, 2019 12:22 — forked from rtomayko/optparse-template.rb
Ruby optparse template
#!/usr/bin/env ruby
#/ Usage: <progname> [options]...
#/ How does this script make my life easier?
# ** Tip: use #/ lines to define the --help usage message.
$stderr.sync = true
require 'optparse'
# default options
flag = false
option = "default value"
@vinbarnes
vinbarnes / gist:57de4ab6c60d32d8b72411e883e65f23
Last active April 18, 2017 13:23
stash listing with relative age
$ git stash list --format="%gd (%cr): %s"
stash@{0} (7 weeks ago): On neuter-mssql-in-prod: neuter in production
stash@{1} (6 months ago): On fix-group-messages-being-archived: archived-spec
stash@{2} (1 year, 1 month ago): On staff-comments: staff persona test
stash@{3} (1 year, 3 months ago): On staffng-integration-tests: 77e5f6c added more to staff flow
stash@{4} (1 year, 3 months ago): On staffng-integration-tests: WIP staff onboarding integration test
stash@{5} (1 year, 5 months ago): On staff-ng-add-switch-link: 4823a45 Jk don't hardcode
stash@{6} (1 year, 6 months ago): On staff-ng-groups: staffng-routing
stash@{7} (1 year, 7 months ago): On master: readable policy spec
module NewUserActivation
class UnknownStrategyError < ArgumentError
def initialize
raise self
end
end
end
#!/bin/bash
# to run:
# $ nohup mem_collector.sh &
while :
do
pids=( $(ps auxwww |egrep 'ruby|bundle' | awk '{print $2}') )
echo $(date) >> ruby_usage.log
ps -o pid,pcpu,pmem,rss,args ${pids[@]/#/-p } >> ruby_usage.log
Get the list of ES indices
GET <host>:<port>/*/_aliases?pretty
{
"development-section-16": {
"aliases": {}
},
"development-section-15": {
"aliases": {}
@vinbarnes
vinbarnes / capybara cheat sheet
Created March 2, 2016 04:29 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
module CharacterizationTestHelpers
def currently(description, *options, &block)
it("*CURRENTLY* #{description}", *options, &block)
end
end
@vinbarnes
vinbarnes / changelog_summary.sh
Created November 17, 2015 14:25
get changelog summary
git log -p --no-color --since="5 days ago" -S "*" -- CHANGELOG.md |grep -n "+.*\*" | tr -d '+' | sort -r -n | sed 's/^[0-9]*://g'
merge.conflictstyle=diff3
github.user=vinbarnes
github.password=MQ3i8x@vq$ODGyKJ
alias.st=status
alias.ci=commit
alias.co=checkout
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true