Skip to content

Instantly share code, notes, and snippets.

View wanion's full-sized avatar

Fred Young wanion

View GitHub Profile
@wanion
wanion / README.md
Created March 21, 2019 02:30 — forked from lcrilly/README.md
NGINX OAuth 2.0 Token Introspection

OAuth 2.0 Token Introspection with NGINX and njs

This configuration enables NGINX to validate an authentication token against an authorization server by using OAuth 2.0 Token Introspection (RFC 7662). This solution uses the auth_request module and the NGINX JavaScript module to require authentication and perform the token introspection request.

By default, the client's authentication token is expected as a bearer token supplied in the Authorization header. If supplied elsewhere in the HTTP request, the $access_token variable must be configured to specify where to obtain the token.

Token introspection requests are authenticated. By default, the $oauth_client_id and $oauth_client_secret variables are used to perform HTTP Basic authentication with the Authorization Server. If only the $oauth_client_secret variable is specified then that value is used

<h2 id="tenantSearchTitle">Search for reading lists by course&nbsp;code&nbsp;or&nbsp;name</h2>
<!-- Google Tag Manager -->
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-MHC9XR"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-MHC9XR');</script>
<!-- End Google Tag Manager -->
@wanion
wanion / expiry.ps1
Last active August 29, 2015 14:27
Find accounts whose passwords are 45-60 days old
# configure how old passwords have to be to expire, and how many days warning to give
$expiry = new-timespan -days 60
$warning = new-timespan -days 15
$window_start = (get-date).add($expiry.negate())
$window_end = $window_start.add($warning)
$searcher = new-object system.directoryservices.directorysearcher "LDAP://dc=waikato,dc=ac,dc=nz"
$searcher.filter = "(&(samaccounttype=805306368)(mail=*)(!useraccountcontrol:1.2.840.113556.1.4.804:=65538)(pwdlastset>={0})(pwdlastset<={1}))" -f $window_start.tofiletime(), $window_end.tofiletime()
"mail", "pwdlastset", "samaccountname" | % { $searcher.propertiestoload.add($_) | out-null }
foreach ($account in $searcher.findall()) {
select lab_name, capacity, in_use, available, low_point, case when booked=1 then 'Booked'
when open=0 then 'Closed'
else
cast(available as char)
end as status from
(
select lab_details.lab_name, capacity, ifnull(in_use, 0) as in_use, (capacity - ifnull(in_use, 0)) as available, greatest(ceil(capacity * 0.1),3) as low_point, if(start_datetime is not null, true, false) as booked, if(time(sysdate()) between open_time and close_time,true,false) as open, sorthint
from lab_details
join (select lab_name,count(*) as capacity from computer_details group by lab_name) as lab_capacity
on lab_capacity.lab_name = lab_details.lab_name
select lab_name, capacity, in_use, available, low_point, case when booked=1 then 'Booked'
when open=0 then 'Closed'
else
cast(available as char)
end as status from
(
select lab_details.lab_name, capacity, ifnull(in_use, 0) as in_use, (capacity - ifnull(in_use, 0)) as available, greatest(ceil(capacity * 0.1),3) as low_point, if(start_datetime is not null, true, false) as booked, if(time(sysdate()) between open_time and close_time,true,false) as open, sorthint
from lab_details
join (select lab_name,count(*) as capacity from computer_details group by lab_name) as lab_capacity
on lab_capacity.lab_name = lab_details.lab_name
WITH missing_overrides AS
(SELECT DISTINCT circ_profile_id,
listagg(trim(trailing '.'
FROM patron_block), ','||chr(10)) within GROUP(
ORDER BY patron_block) over(partition BY circ_profile_id) AS patron_unblock,
listagg(trim(trailing '.'
FROM item_block), ','||chr(10)) within GROUP(
ORDER BY item_block) over(partition BY circ_profile_id) AS item_unblock
FROM
(SELECT circ_profile_id,
@wanion
wanion / Pre-check items in holdings before item batch move in Voyager.md
Last active August 29, 2015 14:16
From barcodes, from all items in same holdings, and list any not in list of barcodes
Instructions for newline separated turning list of barcodes into quoted comma separated list in Word

Find (<[0-9]{12,15}>)[^13^11]{1,}
Replace ^39\1^39,

Make sure Use wildcards is selected under >>> More.

@wanion
wanion / bibs.sql
Last active August 29, 2015 14:16
Bibs and holdings by location code in Voyager 8.1.1
SELECT bib_text.bib_id, bib_master.suppress_in_opac AS suppressed, utl_i18n.raw_to_nchar(rawtohex(
title), 'utf8') AS title, utl_i18n.raw_to_nchar(rawtohex(author), 'utf8') AS author
FROM bib_text
JOIN bib_master ON bib_master.bib_id = bib_text.bib_id
JOIN bib_location ON bib_text.bib_id = bib_location.bib_id
JOIN location ON bib_location.location_id = location.location_id
WHERE upper(location_code) = upper('&location_code')
ORDER BY 3, 1
@wanion
wanion / BatchCat.cs
Last active August 29, 2015 14:16 — forked from bricestacey/BatchCat.cs
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BatchCat;
using System.Collections;
namespace Batch
{