Skip to content

Instantly share code, notes, and snippets.

@fallwith
fallwith / span_events.rb
Created April 19, 2024 23:44
Use the New Relic Ruby agent to report 10,000 spans within a minute
#!/usr/bin/env ruby
# frozen_string_literal: true
# Instructions:
# 1. Copy a valid newrelic.yml file to the same directory as span_events.rb
# 2. Make sure at least the following parameters are set in newrelic.yml:
# - license_key: <your license key>
# - audit_log.enabled: true
# - span_events.max_samples_stored: 10000
# 3. ruby span_events.rb
@fallwith
fallwith / README.md
Last active April 5, 2024 04:04
Beta test instructions for observing Ruby based AWS Lambda functions with New Relic

Beta test instructions for observing Ruby based AWS Lambda functions with New Relic

Synopsis

These instructions will explain how to enhance an existing Ruby based AWS Lambda function to have it observed by New Relic.

No Ruby expertise will be required, and any existing Ruby based AWS Lambda functions being observed will not need to have their source code altered.

The observability works through the association of an AWS Lamdba layer with any Lambda function that needs to be observed.

  • 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 / 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'
@fallwith
fallwith / homebrew_mysql_pass_reset.txt
Created May 23, 2011 22:10
Reset MySQL root password (Homebrew)
$> launchctl unload -w ~/Library/LaunchAgents/com.mysql.mysqld.plist
$> /usr/local/Cellar/mysql/5.5.9/bin/mysqld --basedir=/usr/local/Cellar/mysql/5.5.9 --datadir=/usr/local/Cellar/mysql/5.5.9/data --plugin-dir=/usr/local/Cellar/mysql/5.5.9/lib/plugin --log-error=/usr/local/Cellar/mysql/5.5.9/data/errors.err --pid-file=/usr/local/Cellar/mysql/5.5.9/data/pidfile.pid --skip-grant-tables
$> mysql
mysql> UPDATE mysql.user SET Password=PASSWORD('root_password') WHERE User='root';
mysql> FLUSH PRIVILEGES;
$> kill `cat /usr/local/Cellar/mysql/5.5.9/data/pidfile.pid`
@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 / 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 / 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 / instructions.md
Last active November 14, 2023 17:03
Using the New Relic Ruby agent with a standalone Ruby script

Instructions

  1. Download the standalone.rb file to your computer. Place it in an empty directory by itself. The file does not need to be made executable. The first "shebang" line of the file will be ignored, so the path is not important.
  2. Create a newrelic.yml file or copy an existing one from an existing project to the directory containing standalone.rb
  3. At a comand prompt in the directory, run ruby standalone.rb
  4. If the standalone test script is successful, its output will look like this:
Starting New Relic agent...
Waiting for New Relic agent to connect...
@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.
#