Skip to content

Instantly share code, notes, and snippets.

@melignus
melignus / Client Session Timeout Check
Last active April 12, 2022 14:02
Simple session timeout check for client side applications.
// Non-jquery example from http://stackoverflow.com/questions/333634/http-head-request-in-javascript-ajax
/**
* The idea here is to poll against a route that requires authentication,
* in this case /session_health_check, on an interval.
* The important part is the header in the response. Because
* the current session goes with the request, polling against the endpoint
* can either trigger a refresh on the page which should initiate the auth
* flow, or you can popup a dialogue that says that you need to
* re-authenticate with a ?next= to send the use back to the page.
@melignus
melignus / aws_lambda.py
Created October 15, 2015 18:10 — forked from maruks/aws_lambda.py
AWS gateway / lambda function invocation
# AWS Version 4 signing example
# This version makes a POST request and passes request parameters
# in the body (payload) of the request. Auth information is passed in
# an Authorization header.
import sys, os, base64, datetime, hashlib, hmac
import requests # pip install requests
method = 'POST'
service = 'execute-api'
@melignus
melignus / LastLogonReport.ps1
Created January 9, 2017 22:49
Powershell User Last Logon Report
Get-ADUser -Filter * -Properties * |
Select-Object userPrincipalName,@{N='lastLogon'; E={[Datetime]::FromFileTime($_.lastLogon)}} |
ConvertTo-CSV