Skip to content

Instantly share code, notes, and snippets.

View jdheywood's full-sized avatar
😃
Hi

James jdheywood

😃
Hi
View GitHub Profile
@jdheywood
jdheywood / show-me-teh-secretz.yml
Created November 3, 2022 13:21
(re)Discover GitHub action secret values
# Thanks to https://stackoverflow.com/users/413924/dannyb
# And this SO post: https://stackoverflow.com/questions/63003669/how-can-i-see-my-git-secrets-unencrypted#:~:text=In%20order%20to%20see%20your,and%20view%20your%20secrets%20file.
name: Show me teh secretz
on: [push]
jobs:
debug:
name: Debug
runs-on: ubuntu-latest
@jdheywood
jdheywood / s3.py
Created November 17, 2021 09:03
Example wrapping S3 to upload a file like object and generate pre-signed URL for this
import boto3
from botocore.exceptions import ClientError
from django.conf import settings
class S3ConfigException(Exception):
'''
Raised when an issue is found during S3 client creation
'''
@jdheywood
jdheywood / authorisation.js
Last active January 28, 2020 12:48
Example of simple token authorisation middleware for use in Express application, with unit test (depends on service to get tokens from env vars)
/* eslint-disable consistent-return */
import { getAPIAuthToken } from '../services/environment';
const authorisation = () => (req, res, next) => {
if (!req.headers.authorization) {
return res.status(401).json({ error: 'Credentials missing' });
}
const clientToken = req.headers.authorization;
const serverToken = getAPIAuthToken();
@jdheywood
jdheywood / python.json
Created February 1, 2019 10:33 — forked from sinistamunkey/python.json
VSCode snippets - Python
{
"test_case": {
"prefix": "test_case",
"body": [
"import unittest",
"",
"",
"class ${1:class_name}TestCase(unittest.TestCase):",
"",
" def test_${2:does_thing}(self):",