Skip to content

Instantly share code, notes, and snippets.

@carey
carey / README.md
Created August 14, 2022 03:36
Windows XML Manifest embedding in Rust

Feeling jealous of the Windows Rust developers that can embed a Windows manifest in their code with /MANIFESTINPUT? Why not embed the manifest directly into your source code using inline assembly?

@carey
carey / README.md
Created July 30, 2022 04:54
Notes on installing App Installer (winget) on Windows Server 2022

Download the package and dependencies:

Install it globally with:

@carey
carey / build.gradle
Last active July 28, 2018 07:46
Use Jetty Ant plugin from Gradle
import org.apache.tools.ant.BuildEvent
import org.apache.tools.ant.BuildListener
plugins {
id 'war'
}
ext {
jettyKey = 'f4f2aada-6224-4480-b2f4-b0063c0eb8a0'
}
@carey
carey / NewRelicControllerNameInterceptor.java
Created January 9, 2017 04:17
See Spring 2 controller names in New Relic
package com.example;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.util.ClassUtils;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import org.springframework.web.servlet.mvc.Controller;
/**
Compiled (c1) 34 6 nmethod nz.geek.carey.unsafe.abstractclasses.TestClass::set (7 bytes)
total in heap [0x022ae748,0x022ae994] = 588
relocation [0x022ae81c,0x022ae84c] = 48
main code [0x022ae850,0x022ae8d0] = 128
stub code [0x022ae8d0,0x022ae8fc] = 44
oops [0x022ae8fc,0x022ae904] = 8
scopes data [0x022ae904,0x022ae930] = 44
scopes pcs [0x022ae930,0x022ae990] = 96
dependencies [0x022ae990,0x022ae994] = 4
Loaded disassembler from hsdis-i386.dll
@carey
carey / gist:5297461
Created April 3, 2013 00:28
Assert that a code block throws an exception or a subclass in Scala.
def assertThrows[A <: Throwable: ClassTag](fn: => Unit) {
val ct = classTag[A]
try {
fn
fail("Expected " + ct)
} catch {
case ct(e: Throwable) => // ok
}
}