Skip to content

Instantly share code, notes, and snippets.

@fallwith
fallwith / demo.rb
Created November 17, 2022 23:47
Ruby threads and fibers testing
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'async', '~> 2.2'
end
@fallwith
fallwith / reporter.rb
Last active March 28, 2023 00:00
New Relic Ruby agent demo: set an error group callback used for noticed errors
#!/usr/bin/env ruby
# frozen_string_literal: true
# INSTRUCTIONS:
# - Place this file somewhere. It can be called something like `reporter.rb`
#
# - Either place a newrelic.yml file in the same directory as this file OR
# export the NEW_RELIC_LICENSE_KEY and NEW_RELIC_HOST environment variables.
# If using a newrelic.yml file, it should look like this:
# # newrelic.yml
@fallwith
fallwith / increment.rb
Created March 31, 2023 21:49
A standalone example of using the New Relic Ruby agent's increment_metric public API
#!/usr/bin/env ruby
# frozen_string_literal: true
# A standalone example of using the New Relic Ruby agent's
# NewRelic::Agent.increment_metric public API
#
# INSTRUCTIONS:
# - Place this file somewhere. It can be called something like `increment.rb`
#
# - Either place a newrelic.yml file in the same directory as this file OR
@fallwith
fallwith / new_relic_ruby_agent_with_sidekiq.md
Last active July 14, 2023 19:30
New Relic Ruby agent Sidekiq demonatration

New Relic Ruby agent Sidekiq demonstration

This guide will demonstrate using the New Relic Ruby agent to report metrics for Sidekiq jobs being performed by workers. A minimal Ruby on Rails app with a minimal Sidekiq job class will be created.

Prerequisites

required

  • Ruby
@fallwith
fallwith / test.rb
Created July 19, 2023 17:12
New Relic Ruby agent demonstration of the notice_error API inside a transaction
#!/usr/bin/env ruby
# frozen_string_literal: true
# INSTRUCTIONS:
# - Place this file somewhere. It can be called something like `test.rb`
#
# - Either place a newrelic.yml file in the same directory as this file OR
# export the NEW_RELIC_LICENSE_KEY environment variable. For a
# non-production host, also export the NEW_RELIC_HOST environment variable.
#
  • A Short Hike (Nintendo Switch) [2019]
  • Alien Carnage (originally Halloween Harry) (PC) [1993]
  • Assassin's Creed II (PS3) [2009]
  • Assassin's Creed IV (PC) [2013]
  • Choplifter (Sega Master System) [1986]
  • Baldur’s Gate II (PC) [2000]
  • Baldur's Gate III (PC) [2023]
  • Below the Root (PC) [1984]
  • Borderlands (PC) [2009]
  • Burnout 3 (PS2) [2004]
@fallwith
fallwith / standalone.rb
Created November 14, 2023 17:18
Standalone New Relic Ruby agent demonstration
#!/usr/bin/env ruby
# frozen_string_literal: true
# Instructions:
# 1. Copy newrelic.yml with a valid license key to the same directory as
# standalone.rb
# 1. rm -rf log
# 2. ruby standalone.rb
# 3. inspect log/newrelic_agent.log
@fallwith
fallwith / steam_deck_rclone.md
Last active December 28, 2023 09:08
Setting up Rclone on Steam Deck to upload screenshots to Dropbox

Setting up Rclone on Steam Deck to upload screenshots to Dropbox

Launch Konsole and install Neovim and Rclone:

NOTE: Neovim is optional and only used here for editing your ~/.bashrc script

mkdir -p ~/bin
mkdir -p ~/scratch
@fallwith
fallwith / fake_server.rb
Created February 8, 2024 22:35
A "fake" HTTP server for local development or testing of HTTP clients
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'webrick'
class FakeServlet < WEBrick::HTTPServlet::AbstractServlet
RESPONSE_BODY = "Success\n"
TEXT_PLAIN = 'text/plain'
def do_GET(_request, response)
@fallwith
fallwith / Gemfile
Created February 28, 2024 10:21
New Relic with Resque Demonstration
# frozen_string_literal: true
source 'https://rubygems.org'
gem 'resque', '1.27.4'
gem 'newrelic_rpm'