Skip to content

Instantly share code, notes, and snippets.

View eurica's full-sized avatar

David Hayes eurica

View GitHub Profile
@eurica
eurica / logback-sentry.patch
Last active September 14, 2026 21:33
FusionAuth Sentry logback appender — sends WARN+ logs to Sentry. Obviously not the configuration we'd use in prod.
diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml
index 66e559f76..caa03c3fc 100644
@@ -25,9 +25,17 @@
</triggeringPolicy>
</appender>
+ <!-- Sends WARN-and-above log events to Sentry. DSN and other config come from sentry.properties. -->
+ <appender name="Sentry" class="io.sentry.logback.SentryAppender">
+ <minimumEventLevel>WARN</minimumEventLevel>
+ <minimumBreadcrumbLevel>DEBUG</minimumBreadcrumbLevel>
@eurica
eurica / sentry-integration.patch
Created September 14, 2026 21:28
FusionAuth Sentry integration — browser SDK, logback appender, vite plugin, source maps
diff --git a/package.json b/package.json
index 010506445..df84e6c44 100644
--- a/package.json
+++ b/package.json
@@ -11,13 +11,13 @@
"@types/node": "^25.5.0",
"glob": "^11.1.0",
"js-yaml": "^4.1.1",
+ "jsdom": "^25.0.0",
"sass": "^1.85.1",
@eurica
eurica / app.js
Last active April 18, 2024 02:03
Quick one off to compare LLMs handling tweets
// WARNING: this code is 80% machine generated with Github Copilot
// I've fixed the bugs I've found, but only refactoring in the rare cases I literally can't follow the code.
// This is a bad codebase.
require("dotenv").config();
const { HeliconeProxyOpenAI} = require("@helicone/helicone");
const { Anthropic } = require('@anthropic-ai/sdk');
const OpenAI = HeliconeProxyOpenAI;
const fs = require("fs");
@eurica
eurica / spark2pd.js
Created July 7, 2016 21:13
A custom event transformer to create incidents from Cisco Spark
function transform(PD) {
var webhook = PD.inputRequest.body
var message = webhook.text || "Error: Not a Spark chat message";
var room_link = ciscospark2web(b64decode(webhook.roomId)); // clean up the link
var normalized_event = {
incident_key: room_link, //So that all messages from a room de_dupee into the same incident
event_type: PD.Trigger,
description: message,
details: {
@eurica
eurica / manual_pd.js
Last active August 29, 2015 14:15
Manually Trigger an incident in PagerDuty
/* This is the button I'm using to trigger the incident:
<input type="button" onclick="PDTrigger(prompt('Incident Description'))" value="Trigger Incident">
*/
// Set up the library
PDJS = new PDJSobj()
function PDTrigger(description) {
// Trigger via the rest API
PDJS.trigger({
// As always configure PDJS with your subdomain and api-key
PDJS = new PDJSobj({
subdomain: "webdemo",
token: "CkNpsqH9i6yTGus8VDzA",
})
// Here's the minimum possible UI:
printf = function (str) {
console.log(str)
$("#output").append(str)
#!/bin/bash
me="$0"
#This function will alert PagerDuty that our script failed
alertonfail() {
if [ "$1" -ne "0" ]; then
echo "Error $1 on $me"
curl -H "Content-type: application/json" -X POST \
-d '{
@eurica
eurica / dashboard.pseudocode.js
Last active August 29, 2015 14:09
Pseudocode for dashboard example
// Initiate PDJS:
PDJS = new PDJSobj({
subdomain: config["subdomain"],
token: config["token"],
})
loadIncidents = function () {
//Hit the incidents API:
PDJS.api({
res: "incidents",
<html>
<head>
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script>
// Step 1. Put the URL from <form action="URL"> here:
var form_url = "https://docs.google.com/a/euri.ca/forms/d/1V6pF3NGpEev0Pl8p22V2fmfHtx-09UtF0bnyAuFoN5E/formResponse"
@eurica
eurica / Send-PagerDutyEvent.ps1
Created July 2, 2014 20:47
Trigger PagerDuty event
Param (
[String]$servicekey,
[String]$EventType,
[String]$AlertID,
[String]$AlertDesc = "No Description provided",
[String]$WebLink = "http://www.pagerduty.com/",
[String]$AlertName = "No Name provided",
[String]$AlertSourceName = "No Source provided"
)