Skip to content

Instantly share code, notes, and snippets.

View bangpound's full-sized avatar

Benjamin Doherty bangpound

View GitHub Profile
@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
Created July 24, 2019 14:53
Function to return all AWS IAM policy documents (inline and managed) for a given IAM role
import boto3
def get_paginated_results(product, action, key, credentials=None, args=None):
args = {} if args is None else args
credentials = {} if credentials is None else credentials
return [y for sublist in [x[key] for x in boto3.client(
product, **credentials).get_paginator(action).paginate(**args)]
for y in sublist]
@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 April 11, 2024 14:17
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 {}
@wodka
wodka / ThreadPoolCommand.php
Last active February 18, 2021 20:26
Simple Symfony3 command Thread Pool
<?php
namespace AppBundle\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Process\Process;