Skip to content

Instantly share code, notes, and snippets.

Trond Hindenes trondhindenes

Block or report user

Report or block trondhindenes

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
@trondhindenes
trondhindenes / doit.py
Last active Mar 29, 2019
testing out the aws-cdk for Python
View doit.py
#Install pips:
#aws-cdk-cdk
#aws-cdk-aws-ec2
import json
from aws_cdk import cdk
from aws_cdk import aws_ec2
app = cdk.App()
stack = cdk.Stack(app, 'MyStack')
@trondhindenes
trondhindenes / .gitlab-ci.yml
Last active Feb 17, 2019
Run KinD (Kubernetes in Docker) as part of Gitlab CI job
View .gitlab-ci.yml
#Spin up Kubernetes control plane as part of before_script, and destroys it using after_script
#Some custom logic to get to the right ip address
#Requres the gitlab docker runner, with "pass-thru" to the host docker socket.
stages:
- test
image: python:3.6.6 #the docker image you run in needs Docker installed, and access to the host docker socket.
test_integration_k8s:
tags:
@trondhindenes
trondhindenes / main.py
Created Dec 28, 2018
Flask-Injector example
View main.py
import boto3
from bloop import BaseModel, Column, String, Engine
from flask import Flask
from flask_injector import FlaskInjector, singleton
from flask_restful import Api, Resource
from injector import inject, provider
import random
import string
from bloop_local import patched_local_bloop_engine
View TraefikReplayRRuleExample.yml
- name: Replay GETs against staging #arbitrary name
methods: #only replay these requests
- get
paths: #replay these paths (use wildcard-notation because I suck at regex)
- "/api/1/*"
host_names: #The hostnames to match on
- api.domain.com
strip_headers: #remove these headers before replaying the request (list of strings). You can use wildcards such as
- "X-*" #strip away all X-type headers
- "User-Agent" #Strip away this and add a new one down below
View ingress_example.yml
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: config-ansiblejobservicefrontend-v{{ major_version }}-{{ environment }}-{{ environmentid }}-httpsecure
namespace: sre
annotations:
traefik.frontend.passHostHeader: "true"
labels:
expose: internal-httpsecure
@trondhindenes
trondhindenes / traefik_daemonset.yml
Created Apr 29, 2018
traefik_daemonset_example
View traefik_daemonset.yml
---
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: traefik-ingress-controller-internal-httpsecure-{{ environment }}
namespace: networking
labels:
app: traefik-ingress-lb-internal-httpsecure
environment: "{{ environment }}"
environmentid: "{{ environmentid }}"
View pycharm2018stacktrace.txt
Traceback (most recent call last):
File "/home/trond/apps/pycharm-community-2018.1.1/helpers/pydev/pydevd.py", line 1664, in <module>
main()
File "/home/trond/apps/pycharm-community-2018.1.1/helpers/pydev/pydevd.py", line 1658, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "/home/trond/apps/pycharm-community-2018.1.1/helpers/pydev/pydevd.py", line 1068, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/home/trond/apps/pycharm-community-2018.1.1/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/home/trond/Documents/projects-rikstv/SRE/RiksTV.Utils.ServiceOwnership/runserver.py", line 1, in <module>
View filebeat_stats_output.json
{
"beat": {
"cpu": {
"system": {
"ticks": 62,
"time": 62
},
"total": {
"ticks": 155,
"time": 155,
@trondhindenes
trondhindenes / site.yml
Created Mar 25, 2018
example of using the mssql role to provision RDS databases
View site.yml
- name: do sql things
hosts: sqlserver_jumphost
tasks:
- name: doit
include_role:
name: rikstv_windows_mssqlconfig
vars:
admin_login: "superduperadmin"
admin_password: "superduperpassword"
sql_server_name: "super-duper-mssql01.eu-west-1.rds.amazonaws.com"
@trondhindenes
trondhindenes / main.yml
Created Mar 25, 2018
MSSQL config ansible role
View main.yml
- name: Create MSSQL Logins
win_dsc:
resource_name: SqlServerLogin
Ensure: "{{ item['state'] | default('present')}}"
LoginType: "SqlLogin"
ServerName: "{{ sql_server_name }}"
Name: "{{ item['username'] }}"
InstanceName: MSSQLSERVER
LoginCredential_username: "{{ item['username'] }}"
LoginCredential_password: "{{ item['password'] }}"
You can’t perform that action at this time.