Skip to content

Instantly share code, notes, and snippets.

Vincent Meijer veuncent

Block or report user

Report or block veuncent

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@veuncent
veuncent / docker_tls_ubuntu_16.04
Created Oct 5, 2018
Setup TLS for Docker (Ubuntu 16.04)
View docker_tls_ubuntu_16.04
- Create a CA, keys and certificates
- Source: https://docs.docker.com/engine/security/https/
# Create certs dir
mkdir ~/certs
cd ~/certs
# Ca key
openssl genrsa -aes256 -out ca-key.pem 4096
@veuncent
veuncent / create_wagtail_pages_through_migration
Last active Apr 16, 2019
Set wagtail (home)pages programmatically during Django Migrations
View create_wagtail_pages_through_migration
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from wagtail.wagtailcore.models import Page, Site
def forwards_func(apps, schema_editor):
HomePage = apps.get_model('website', 'HomePage')
@veuncent
veuncent / aws_glacier_delete_vault.md
Last active Sep 13, 2019
Delete all archives in an AWS Vault
View aws_glacier_delete_vault.md

AWS Glacier: Delete vault

Follow these steps to remove all archives from an AWS vault. After this is finished, you will be able to delete the vault itself through the browser console.

Step 1 / Retrieve inventory

This will create a job that collects required information about the vault.

$ aws glacier initiate-job --job-parameters '{"Type": "inventory-retrieval"}' --account-id YOUR_ACCOUNT_ID --region YOUR_REGION --vault-name YOUR_VAULT_NAME 
@veuncent
veuncent / toggleAutoScalingGroup.md
Last active Aug 15, 2019
AWS Auto Scaling Groups: scheduled start/stop
View toggleAutoScalingGroup.md

Tutorial: scheduled start/stop of EC2 instances managed by Auto Scaling Groups

If your EC2 instances in AWS are managed through Auto Scaling Groups, it is easy to schedule startup and shutdown of those instances, e.g. to save money.

This tutorial walks you through setting up an AWS Lambda function that is triggered by CloudWatch Events and automatically changes the min, max and desired instances in your Auto Scaling Group(s).

The idea is to toggle between 0 (stop) and a specifed min, max and desired amount of instances (start), so you only need a single Lambda function. The premise is that you do not touch these Auto Scaling Group settings manually, or you might make your EC2 instances nocturnal.

Create new Lambda function and Start Event

@veuncent
veuncent / docker_debugging.md
Last active Sep 21, 2019
Debugging Django apps running in Docker using ptvsd - Visual Studio (Code)
View docker_debugging.md

Remote debugging in Docker (for Django apps)

In order to enable debugging for your Django app running in a Docker container, follow these steps using Visual Studio (Code):

  1. Add ptvsd to your requirements.txt file
ptvsd == 4.3.2
  1. To your launch.json, add this:
You can’t perform that action at this time.