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 / 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 / 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 / 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 / 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 / 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