Skip to content

Instantly share code, notes, and snippets.

@buckett
buckett / find-tld.sh
Created May 25, 2017 09:48
Looks for TLD files inside JAR files for Tomcat jar scanning configuration.
#!/bin/bash
# This attempts to look in all the jar files for any tag library description files (tlds).
# This is useful because to speed up tomcat startup you can stop if scanning everything
# and then add back in the files that are needed.
# This needs to be run on a tomcat folder that has unpacked wars as it won't find JARs inside
# WARs.
# It outputs the pattern to put in the `tldScan` attribute of the JAR scanner
<!doctype html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
var spData = null;
var columnTitle = [];
var URL_COL_NUMBER = 11; // Column L
var EMAIL_COL_NUMBER = 8; // Col I
@buckett
buckett / comments.sed
Created November 14, 2017 14:20
This removes comments before the package declaration (useful for .java files). This was used because some files has 2 license headers.
# From end for first comment to package declaration
/*\//,/^package/ {
# Remove anything inside a comment
/^\/\*\*/,/*\// {
d
}
}
@buckett
buckett / OAuth2AccessTokenResponseHttpMessageConverter.java
Created January 21, 2019 15:23
Fix for failure to parse JSON in OAuth access token.
/*
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@buckett
buckett / ccurl
Last active March 19, 2019 08:40
Canvas cURL
#!/bin/bash
# Canvas cURL
# Just pulls OAuth token for Canvas from keychain and puts it in the Authorization header
# You can set passwords with:
# security add-generic-password -a buckett -s canvas.instructure.com -w ....
# and if you need to update a token you need to first delete it with:
# security delete-generic-password -a buckett -s canvas.instructure.com
# This will also mean that the the security tool has read access by default.
@buckett
buckett / FixedIFrame.js
Created October 4, 2020 09:36
Allow Modals to be displayed in the centre of the window when in an iframe
/*
* Copyright (c) 2020, University of Oxford
*/
import React from 'react'
import PropTypes from 'prop-types'
/**
* This is just an div that covers the whole of the iframe. When the surrounding
* page is scrolled the div is moved to the new location. You should just have
* a single one of these components in an application and all components should