Skip to content

Instantly share code, notes, and snippets.

View tombasche's full-sized avatar

Thomas Basche tombasche

  • Helsinki, Finland
View GitHub Profile
@tombasche
tombasche / WebServerConfiguration.kt
Created August 11, 2021 15:14
Spring boot (kotlin) Web Server Config for CORS
package com.myapplication
import org.springframework.beans.factory.annotation.Value
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.web.servlet.config.annotation.CorsRegistry
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer
@Configuration
class WebServerConfiguration {
@tombasche
tombasche / devopsreading.md
Last active March 29, 2021 17:26
DevOps Reading List

Books to read to learn DevOps

  • The DevOps Handbook - Kim, Humble, Debois, Willis, Allspaw

  • The Phoenix Project - Gene Kim

  • The Unicorn Project - Gene Kim

  • Reinventing Organisations - Frederic Laloux

@tombasche
tombasche / modal.tsx
Last active February 6, 2021 10:54
Simple React modal
import { RefObject, useEffect, useRef } from 'react';
import styled from 'styled-components';
const ModalDiv = styled.div`
z-index: auto;
display: flex;
position: fixed;
top: 0;
left: 0;
height: 100vh;
@tombasche
tombasche / reverse.s
Created December 5, 2020 08:45
Reverse string in mips
# Mips program to reverse a string
# mips.s
.data
str: .space 128 # character buffer
.text
.globl main
@tombasche
tombasche / the-apartment.lisp
Created October 11, 2020 10:00
A walk through the apartment
(defparameter *nodes* '((balcony (you are on the balcony. a cool wind sways the blossoming trees.))
(lounge-room (a catto snoozes on the lounge.))
(kitchen (bread is proofing on the counter.))
(office (clothes are hung up to dry.))
(bathroom (small stones litter the tiled floor.))
(bedroom (a few articles of clothing lay on the floor.))))
(defparameter *edges* '((balcony (lounge-room inside door))
(lounge-room (balcony outside door)

AWS SysOps Exam Tips

Monitoring

Cloudwatch

  • What are the default host-level metrics for EC2?
    • CPU
    • Network
  • Disk
@tombasche
tombasche / csa_notes.md
Last active March 29, 2021 14:54
AWS CSA Notes

AWS SA Exam Tips

General

What hypervisor does EC2 use?

  • Nitro (was 'Xen')

What are the different virtualization types?

  • HVM
  • PV
@tombasche
tombasche / sync_db.py
Created September 6, 2019 02:22
Given a source and destination database, restore any records that may have occurred concurrently with a pg_dump
"""
Usage:
python sync_db.py
"""
import os
import sys
import json
import psycopg2
"""
Create a tic-tac-toe board of 'n' width and height.
"""
import os
import sys
from typing import List
import numpy as np
@tombasche
tombasche / download.py
Created February 20, 2019 21:23
Download a file and extract it
def download_file(file_location, output_filename='file.json'):
handle = urlopen(file_location)
with open('temp.gz', 'wb') as out:
while True:
data = handle.read(1024)
if len(data) == 0:
break
out.write(data)