Skip to content

Instantly share code, notes, and snippets.

View bangpound's full-sized avatar

Benjamin Doherty bangpound

View GitHub Profile
@DvdKhl
DvdKhl / BytesToIPAddress.sql
Last active April 6, 2025 03:10
SQL Server function to convert varbinary(16) IPv4/IPv6 addresses to its string (shortened) form
--Copyright (C) 2022 DvdKhl
--Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
--to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
--and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
--The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
--THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
--FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
--WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
@hqrd
hqrd / gitlab-runner-cleanup.sh
Last active March 20, 2024 18:13
This script is used to remove offline gitlab runners for every projects
#!/bin/bash
###
# This script is used to remove offline gitlab runners for every projects
###
set -o nounset
set -o errexit
die () {
echo >&2 "$@"
@gene1wood
gene1wood / get_policy_documents_for_role.py
Last active November 20, 2024 15:17
Function to return all AWS IAM policy documents (inline and managed) for a given IAM role
import boto3
'''
This gist is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
'''
@Sjeanpierre
Sjeanpierre / athena_ddl
Created December 6, 2018 06:26
Cloudflare logs Athena DDL - Create Athena schema for Cloudflare logs
CREATE EXTERNAL TABLE `cf_logs`(
`cachecachestatus` string COMMENT 'from deserializer',
`cacheresponsebytes` int COMMENT 'from deserializer',
`cacheresponsestatus` int COMMENT 'from deserializer',
`cachetieredfill` boolean COMMENT 'from deserializer',
`clientasn` int COMMENT 'from deserializer',
`clientcountry` string COMMENT 'from deserializer',
`clientdevicetype` string COMMENT 'from deserializer',
`clientip` string COMMENT 'from deserializer',
`clientipclass` string COMMENT 'from deserializer',
@matthewpalmer
matthewpalmer / pod.yaml
Created July 21, 2018 04:13
kubernetes nginx php-fpm pod
# Create a pod containing the PHP-FPM application (my-php-app)
# and nginx, each mounting the `shared-files` volume to their
# respective /var/www/html directories.
kind: Pod
apiVersion: v1
metadata:
name: phpfpm-nginx-example
spec:
volumes:
@alexcasalboni
alexcasalboni / aws-lambda-static-type-checker.md
Last active May 22, 2023 07:31
AWS Lambda Static Type Checker Example (Python3)

How to use Python3 Type Hints in AWS Lambda

TL;DR

Static Type Checkers help you find simple (but subtle) bugs in your Python code. Check out lambda_types.py and incrementally improve your code base and development/debugging experience with type hints.

Your Lambda Function code will go from this:

@bangpound
bangpound / README.md
Last active November 5, 2017 18:46
INI File from Ansible for use anywhere

INI File

For example:

  • ini_file.py php.ini --section PHP --option memory_limit --value 256M
@alexellis
alexellis / k8s-pi.md
Last active December 13, 2024 23:24
K8s on Raspbian
kubectl get pods | grep Evicted | awk '{print $1}' | xargs kubectl delete pod
@bcremer
bcremer / php-class-name-constant-case sensitivity-and-psr-11.md
Last active July 13, 2017 12:40
PHP class name constant (::class) is case insensitive and that might break your PSR-11 container access

PHP´s magic ::class-constant will not canonical the casing of your imports.

This can lead to hard to debug errors when you a using a case sensitive service PSR-11-locator like Zend\ServiceManager.

namespace FirstNamespace;

class TestClass {}