Skip to content

Instantly share code, notes, and snippets.


Donal Byrne byrnedo

View GitHub Profile
byrnedo /
Created Feb 15, 2021
selenium standalone tricks
# start a new session
curl --data '{"desiredCapabilities":{"browserName": "chrome"}}' --silent http://localhost:4444/wd/hub/session | jq -r .sessionId
byrnedo /
Created Feb 15, 2021
Fill terminal input and return to interactive
# Sends foo bar and baz then back to you
(printf 'foo\nbar\nbaz\n' && cat) | $1
byrnedo / indexed_sql_file_runner.go
Last active Oct 23, 2020
Run sql commands from a file, saving position in a `.index` file in case of error.
View indexed_sql_file_runner.go
package main
import (
byrnedo / nginx-json-log.conf
Last active May 20, 2020
Json Nginx Logging
View nginx-json-log.conf
map $msec $millis { ~(.*)\.(.*) $2; }
map $time_iso8601 $time_iso8601_m { ~(.*)\+(.*) $1.$millis+$2; }
log_format json_combined escape=json
'"_ms": "$millis",' # Has to be here in order for timestamp to work. Wat
'"timestamp": "$time_iso8601_m",'
'"service": "sp-frontend",'
'"message":"[$status] $request_method $request_uri",'
byrnedo / httpclient.go
Created May 12, 2020
Comprehensive http client base in go
View httpclient.go
package client
import (
byrnedo / useCheckbox.ts
Created Apr 24, 2020
Hook for checkbox functionality
View useCheckbox.ts
import React, {useCallback, useMemo} from 'react';
export const useCheckbox = (allValues: string[], selected: string[], onChange: (newSelection: string[]) => void) => {
const selectedStatesObj = useMemo(() => (selected || []).reduce((p, c) => ({
[c]: true
}), {} as {[id: string]: boolean}), [selected]);
byrnedo / tutils.go
Created Jan 29, 2020
Small assertion helper for testing in go
View tutils.go
package tutils
import (
func AssertNotNil(t *testing.T, obj interface{}) {
byrnedo / aspnet-des-cookie-maker.js
Last active Jul 16, 2020
Javascript module to encrypt, decrtypt, serialize and deserialize a DES encrypted cookie from a Dotnet Aspnet application
View aspnet-des-cookie-maker.js
byrnedo / Startup.vb
Created Jan 11, 2019
VB Dotnet Owin Auth0 Startup
View Startup.vb
Imports Microsoft.Owin
Imports Microsoft.Owin.Security.OpenIdConnect
Imports Owin
Imports Microsoft.Owin.Security
Imports Microsoft.Owin.Security.Notifications
Imports Microsoft.Owin.Security.Cookies
Imports Microsoft.IdentityModel.Protocols.OpenIdConnect
Imports Microsoft.IdentityModel.Tokens
Imports System.Threading.Tasks
byrnedo / RequestLogMiddleware.cs
Last active Aug 10, 2018
Access log middleware for aspnetcore. Add it as your first middleware.
View RequestLogMiddleware.cs
namespace Foobar
public class RequestLogMiddleware
public class LogData {
public IPAddress RemoteAddr {get;set;}
public string User {get;set;}
public int ResponseStatus {get;set;}