Skip to content

Instantly share code, notes, and snippets.

Henning Kristensen hngkr

  • Aarhus, Denmark
Block or report user

Report or block hngkr

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
View gist:f98472c788ac883086425170b65b3f0d
$ terraform apply
aws_api_gateway_rest_api.terraform_template_rest_api: Creating...
description: "" => "This is for testing a Terraform Template bug"
name: "" => "TerraformTemplateTest"
root_resource_id: "" => "<computed>"
aws_api_gateway_rest_api.terraform_template_rest_api: Creation complete
Error applying plan:
1 error(s) occurred:
View buildspec.yml
version: 0.1
phases:
install:
commands:
- yum -y groupinstall "Development Tools"
- yum -y install libpcap-devel.x86_64 libtool libyaml-devel
- gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
- mkdir -p /var/task
pre_build:
@hngkr
hngkr / terraform.tfvars
Created Dec 12, 2016
tf/terraform.tfvars
View terraform.tfvars
s3bucketname = "hennings-roadworker-backup-bucket"
s3prefix = "roadworker/"
region = "eu-west-1"
codebuild_image = "aws/codebuild/eb-python-2.6-amazonlinux-64:2.1.3"
@hngkr
hngkr / vyos-optimisations
Created May 2, 2017 — forked from RafPe/vyos-optimisations
vyos throughput optimizations
View vyos-optimisations
Server 2 sockets,6 cores each, 2.4ghz
# Set ixgbe options
# Limit RSS queues to the number of physical cores per cpu
# Disable offload
# When you change this, you need to run the command and reboot for it to take.
echo "options ixgbe LRO=0,0 MQ=1,1 RSS=6,6 VMDQ=0,0 vxlan_rx=0,0" > /etc/modprobe.d/ixgbe.conf
# Shut down HT cores
for i in $(seq 1 2 23); do
@hngkr
hngkr / setenviron.py
Created Jul 12, 2019
setenviron contextmanager source code
View setenviron.py
import contextlib
import os
@contextlib.contextmanager
def setenviron(envdict=None, **mapping):
"""``with`` context to temporarily modify the environment variables"""
_environ = os.environ.copy()
if envdict:
View setenviron-example.py
with setenviron(aws_env, PYTHONUNBUFFERED='1'):
pass # set aws_env and PYTHONUNBUFFERED before calling script
@hngkr
hngkr / specific_locale.py
Created Jul 12, 2019
specific_locale context manager
View specific_locale.py
import contextlib
import locale
@contextlib.contextmanager
def specific_locale(category, locale_string):
prev_locale_string = locale.getlocale(category)
locale.setlocale(category, locale_string)
try:
yield
@hngkr
hngkr / specific_locale-example.py
Created Jul 12, 2019
specific_locale example
View specific_locale-example.py
with specific_locale(locale.LC_ALL, "en_US"):
pass # makes sure that dateformats are English
@hngkr
hngkr / cd-example.py
Created Jul 12, 2019
change directory example
View cd-example.py
with cd(project_dirname):
shutil.make_archive(archive_name, "zip")
@hngkr
hngkr / cd.py
Created Jul 12, 2019
change directory source code
View cd.py
import contextlib
import os
@contextlib.contextmanager
def cd(path):
"""Set the working directory
Temporarily set the working directory inside the context manager and
reset it to the previous working directory afterwards
You can’t perform that action at this time.