Skip to content

Instantly share code, notes, and snippets.

View joe-niland's full-sized avatar

Joe Niland joe-niland

View GitHub Profile
@Lh4cKg
Lh4cKg / mongodb_backup.py
Created January 22, 2020 07:50
MongoDB Dump And Restore Database With Python PyMongo Driver
import bson
from pymongo import MongoClient
def dump(collections, conn, db_name, path):
"""
MongoDB Dump
@maxkostinevich
maxkostinevich / dev.yml
Last active March 12, 2024 17:18
Github Actions - Deploy Serverless Framework (AWS)
#
# Github Actions for Serverless Framework
#
# Create AWS_KEY and AWS_SECRET secrets in Github repository settings
# If you're using env.yml file, store its content as ENV Github secret
#
# Master branch will be deployed as DEV and every new tag starting with "v**" (e.g. v1.0, v1.2, v2.0, etc) will be deployed as PROD
#
# Learn more: https://maxkostinevich.com/blog/how-to-deploy-serverless-applications-using-github-actions/
#
@krisleech
krisleech / renew-gpgkey.md
Last active April 22, 2024 20:13
Renew Expired GPG key

Renew GPG key

Given that your key has expired.

$ gpg --list-keys
$ gpg --edit-key KEYID

Use the expire command to set a new expire date:

#!/bin/bash -e
export IGNORE_FILES=$(ls -p | grep -v /)
detect_changed_folders() {
if [[ "${DRONE_PULL_REQUEST}" ]]; then
folders=$(git --no-pager diff --name-only FETCH_HEAD FETCH_HEAD~1 | sort -u | awk 'BEGIN {FS="/"} {print $1}' | uniq);
else
folders=$(git --no-pager diff --name-only HEAD~1 | sort -u | awk 'BEGIN {FS="/"} {print $1}' | uniq);
fi
export changed_components=$folders
@kyleferguson
kyleferguson / Dockerfile
Last active December 19, 2023 06:10
Example Laravel deployment for Kubernetes
FROM php:7.1-apache
ADD . /var/www
ADD ./site.conf /etc/apache2/sites-enabled/000-default.conf
RUN apt-get update && apt-get install -y libmcrypt-dev mysql-client && \
docker-php-ext-install mcrypt pdo_mysql opcache && \
pecl install redis-3.1.2 && docker-php-ext-enable redis && \
a2enmod rewrite
@BretFisher
BretFisher / docker-for-mac.md
Last active April 26, 2024 09:38
Getting a Shell in the Docker Desktop Mac VM

2021 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Docker VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


@manuelselbach
manuelselbach / README.md
Last active February 19, 2024 11:41
xdebug docker on macOS with PhpStorm

Use xdebug with docker on macOS and PhpStorm

To use xdebug with macOS and docker is quite, let´s call it tricky ;)

The following steps need to be proceed to get it working:

  1. use the config from the xdebug.ini wihtin your docker web container. Important: set remote_connect_back to off

UPDATE

@pauldwhitman
pauldwhitman / excelStampDutyNewSouthWalesAustralia-LongForm
Last active October 2, 2023 00:11
Microsoft Excel formula for calculating stamp duty in New South Wales (NSW), Australia. Long form edition without "magic numbers".
=ROUND(IF(A1>3000000,(0.0125*14000)+(0.015*(30000-14000))+(0.0175*(80000-30000)+(0.035*(300000-80000)+(0.045*(1000000-300000))))+(0.055*(3000000-1000000))+0.07*(A1-3000000),IF(A1>1000000,(0.0125*14000)+(0.015*(30000-14000))+(0.0175*(80000-30000)+(0.035*(300000-80000)+(0.045*(1000000-300000))))+0.055*(A1-1000000),IF(A1>300000,(0.0125*14000)+(0.015*(30000-14000))+(0.0175*(80000-30000)+(0.035*(300000-80000)))+0.045*(A1-300000),IF(A1>80000,(0.0125*14000)+(0.015*(30000-14000))+(0.0175*(80000-30000))+0.035*(A1-80000),IF(A1>30000,(0.0125*14000)+(0.015*(30000-14000))+0.0175*(A1-30000),IF(A1>14000,(0.0125*14000)+0.015*(A1-14000),A1*0.0125)))))),)
@hemebond
hemebond / 0_article.md
Last active March 13, 2022 11:51
A SaltStack AWS Auto Scaling Solution

A SaltStack AWS Auto Scaling Solution

Overview

The AWS Auto Scaling Goup, configured with a customised Cloud-Init file, sends a notification to an SNS Topic, which in turn passes it onto an SQS queue that the Salt Master is subscribed to. A Reactor watches for the auto scaling events and pre-approves the new minion based on its Auto Scaling group name and instance ID.

Salt Master Configuration

@sjparkinson
sjparkinson / RDS-Aurora-CloudFormation-Example.yaml
Last active May 10, 2022 10:43
A basic CloudFormation template for an RDS Aurora cluster.
---
AWSTemplateFormatVersion: 2010-09-09
Description: >
A basic CloudFormation template for an RDS Aurora cluster.
Parameters:
DatabaseUsername:
AllowedPattern: "[a-zA-Z0-9]+"
ConstraintDescription: must be between 1 to 16 alphanumeric characters.