Skip to content

Instantly share code, notes, and snippets.

View sfgeorge's full-sized avatar

Stephen George sfgeorge

View GitHub Profile
@sfgeorge
sfgeorge / README.md
Last active January 4, 2024 04:24
Carbon / Graphite tip: How to use whisper-resize to change xFilesFactor on existing stats

Carbon / Graphite tip: How to use whisper-resize to change xFilesFactor on existing stats

Detailed Steps

1.) Update /etc/carbon/storage-aggregation.conf to use the new xFilesFactor setting for new stats, if you haven't yet already

2.) Get the retention ranges as defined in storage-schemas.conf

fgrep retentions /etc/carbon/storage-schemas.conf | tr ',' ' '
@sfgeorge
sfgeorge / README.md
Created June 4, 2023 01:21
How to GPG-sign git commits on GitHub, the easy way

How to GPG-sign git commits on GitHub, the easy way

  1. 📋 Copy your GitHub email address.

    Run git config --global user.email and copy the email that is returned. If nothing is returned, you should set that to one of the following 2 addresses on https://github.com/settings/emails :

    i. If you have enabled ✅ Keep my email addresses private, then copy the xxxxx+xxxxx@users.noreply.github.com email address mentioned beneath.
    ii. Otherwise, copy the email address that you have designated under Primary email address.

  2. 📦 Install GPG

@sfgeorge
sfgeorge / rest-client-test.rb
Created January 15, 2021 04:38
exhibit a bug showing that the RestClient::RawResponse#body method doesn't exist in v2.0.2. This was fixed in v2.1.0.
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
# gem 'rest-client', '= 2.1.0'
gem 'rest-client', '= 2.0.2'
end
def run
puts "The rest-client gem is at version #{RestClient::VERSION}"
@sfgeorge
sfgeorge / printf_templating.sh
Created February 18, 2020 12:18
Simple UNIX templating with the printf command
# Create a template
echo 'I am just a lowly %s,
playing with %s and %s,
dancing in a %s and trying not to get %s.' > jolly.template
# Evaluate the template
printf "$(<jolly.template)" scoundrel sticks 'barbed wire' web caught
# Or Evaluate the template and silently set it to a shell variable
printf -v output "$(<jolly.template)" scoundrel sticks 'barbed wire' web caught
@sfgeorge
sfgeorge / jruby_opts.md
Created July 13, 2018 14:37
Looking at deprecated JRUBY_OPTS for JRuby
JRUBY_OPTS='-Xcompile.mode.fastest=true -Xjit.treshold=20' jruby -v
jruby: warning: unknown property jruby.jit.treshold
jruby: warning: unknown property jruby.compile.mode.fastest
jruby 9.1.2.0 (2.3.0) 2016-05-26 7357c8f Java HotSpot(TM) 64-Bit Server VM 24.79-b02 on 1.7.0_79-b15 +jit [darwin-x86_64]
@sfgeorge
sfgeorge / block_nest_monster.rb
Created July 12, 2018 23:40
Creative and weird ways to conditionally nest Ruby blocks, using the ruby_speech DSL as an example
require 'ruby_speech'
def append_phrase(document, phrase, options = {})
build_phrase = Proc.new { prosody(rate: 1) { string phrase } }
if options[:voice_name]
document.embed RubySpeech::SSML.draw { voice(name: options[:voice_name], &build_phrase) }
else
document.embed RubySpeech::SSML.draw &build_phrase
end
@sfgeorge
sfgeorge / adhearsion.god
Created April 12, 2013 20:42
An antiquated god watch for Adhearsion
# run with: rvmsudo god -c /srv/phone/phonzy/current/ahn/config/god/adhearsion.god
# debug with: rvmsudo god quit && rvmsudo god -c /srv/phone/phonzy/current/ahn/config/god/adhearsion.god -D
@deploy_path = '/srv/phone/phonzy'
@shared_path = File.join @deploy_path, 'shared'
@app_path = File.join @deploy_path, 'current', 'ahn'
@log_path = File.join @shared_path, 'log'
@pid_path = File.join @shared_path, 'pids'
@pid_file = File.join @pid_path, 'adhearsion.pid'
@god_env = YAML.load_file("#{@shared_path}/config/god_environment.yml")
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
1 0 52 110832 149208 1530724 0 0 4 232 1593 3277 1 1 98 1 0
0 0 52 111328 149208 1530728 0 0 0 0 1470 3213 0 0 99 0 0
4 0 52 103832 149208 1530744 0 0 0 236 1481 3273 8 4 87 0 0
2 0 52 88852 149208 1530724 0 0 0 0 1498 3227 43 8 49 0 0
2 0 52 65060 149208 1530756 0 0 44 0 1568 3261 42 9 49 0 0
2 0 52 24808 149208 1530804 0 0 0 0 1478 2785 45 6 49 0 0
0 0 52 110772 149208 1530940 0 0 0 0 1192 2196 25 3 72 0 0
1 0 52 110672 149212 1530908 0 0 0 452 1239 2147 0 1 98 0 0
events.after_initialized.each do
puts "Knock, knock"
raise 'fury'
puts "Who's there?"
end