Skip to content

Instantly share code, notes, and snippets.

Avatar

J. Scott Johnson fuzzygroup

View GitHub Profile
View starship.toml
[git_status]
conflicted = "🏳"
ahead = "🏎💨"
behind = "😰"
diverged = "😵"
untracked = "🤷‍"
stashed = "📦"
#modified = "📝"
staged.value = "++"
staged.style = "green"
View benchmark_config_file_.rb
require 'json'
require 'benchmark'
class BaseRuntime
def figlet
puts "starting service..."
end
end
class MainRuntime < BaseRuntime
View watching_deploy.txt
ruby -e 'loop { puts `ps -ef --sort=start_time`.split("\n").last(10) << "\n-----\n"; sleep 1; }'
root 25888 22481 0 18:03 ? 00:00:00 docker-containerd-shim be068eef4b51530beba2ef40ade7c179a38dd440660b5b262ca97589758efe0a /var/run/docker/libcontainerd/be068eef4b51530beba2ef40ade7c179a38dd440660b5b262ca97589758efe0a docker-runc
root 25906 25888 0 18:03 ? 00:00:00 /bin/sh -c cd workspace && eval $(ssh-agent) && ssh-add && (rbenv install $(cat .ruby-version) || rbenv version) && gem install bundler && rbenv rehash && bundle install && bundle exec cap $DEPLOY_ENV deploy --trace
root 25946 25906 0 18:03 ? 00:00:00 ssh-agent
root 26114 25906 4 18:03 ? 00:00:06 /root/.rbenv/versions/2.2.3/bin/cap staging deploy --trace
root 26144 3291 0 18:03 ? 00:00:00 sshd: jenkins [priv]
jenkins 26148 26144 0 18:03 ? 00:00:00 sshd: jenkins@pts/2
jenkins 26149 26148 0 18:03 pts/2 00:00:00 -bash
jenkins 26240 26149 0 18:04 pts/2
View migrations_are_dynamic.txt
MariaDB [rails_logs_development]> alter table log_entries add column wizard_key int
-> ;
Query OK, 0 rows affected (0.22 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [rails_logs_development]> Ctrl-C -- exit!
Aborted
ScottiMac:rails_logs sjohnson$ bundle exec rails c
DEPRECATION WARNING: ActiveSupport.halt_callback_chains_on_return_false= is deprecated and will be removed in Rails 5.2. (called from <top (required)> at /Users/sjohnson/fuzzygroup/hyde/coding_tests/rails_logs/config/initializers/new_framework_defaults.rb:21)
Loading development environment (Rails 5.1.4)
@fuzzygroup
fuzzygroup / divide.rb
Created Mar 21, 2018
Divide a number (the dividend) by another number (the divisor) without using division; assume integers and assume positive integers
View divide.rb
def divide(dividend, divisor)
quotient = 0
while(dividend >= divisor) do
dividend = dividend - divisor
quotient = quotient + 1
end
quotient
end
@fuzzygroup
fuzzygroup / reverse_string.rb
Created Mar 21, 2018
reverse a string with recursion in Ruby
View reverse_string.rb
def reverse_recursive(string)
return string if string.size <= 1
tail = string[-1]
head = string[0...-1]
rest = reverse_recursive(head)
tail + rest
@fuzzygroup
fuzzygroup / array_tools.rb
Created Feb 7, 2018
Flatten array of arbitrarily nested arrays
View array_tools.rb
=begin
Ruby code that will flatten an array of nested arrays of integers (or whatever)
into a flat array of integers. e.g. [[1,2,[3]],4] -> [1,2,3,4].
A tail recursion was adopted so the minimal amount of variables is added to the stack.
Usage examples:
ArrayTools.flatten([])
View health_controller.rb
class HealthController < ApplicationController
def index
results = {:status => "ok"}
respond_to do |format|
format.html { render :status => 200, :html => "ok" and return }
format.json { render :status => 200, :json => results.to_json and return }
end
end
end
View keybase.md

Keybase proof

I hereby claim:

  • I am fuzzygroup on github.
  • I am fuzzygroup (https://keybase.io/fuzzygroup) on keybase.
  • I have a public key ASAc0uLHZZur7k3KmRfr0GLgIPiWeaFVJmhMasz0XGbP1wo

To claim this, I am signing this object:

View dockerstats
#!/bin/bash
docker stats --format "table {{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}" $(docker ps|grep -v "NAMES"|awk '{ print $NF }'|tr "\n" " ")