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 / CameraController.cs
Created December 9, 2023 08:25
cinemachine top down camera
using UnityEngine;
using Cinemachine;
public class CameraController : MonoBehaviour
{
[SerializeField] private CinemachineVirtualCamera cinemachineVirtualCamera;
private const float MIN_FOLLOW_Y_OFFSET = 2f;
private const float MAX_FOLLOW_Y_OFFSET = 12f;
@tombasche
tombasche / EmailClientConfiguration.kt
Last active August 18, 2021 16:20
SES Email client config + Sprint + Kotlin
package com.myapplication.email
import org.springframework.beans.factory.annotation.Value
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import software.amazon.awssdk.regions.Region
import software.amazon.awssdk.services.ses.SesClient
@Configuration
class EmailClientConfiguration {
@tombasche
tombasche / EmailClient.kt
Created August 18, 2021 16:11
Basic email client using AWS SES + Spring + Kotlin
package com.myapplication.email
import arrow.core.Either
import org.springframework.stereotype.Component
import software.amazon.awssdk.services.ses.SesClient
import software.amazon.awssdk.services.ses.model.Body
import software.amazon.awssdk.services.ses.model.Content
import software.amazon.awssdk.services.ses.model.Destination
import software.amazon.awssdk.services.ses.model.Message
import software.amazon.awssdk.services.ses.model.SendEmailRequest
@tombasche
tombasche / EmailTests.kt
Last active August 18, 2021 16:24
Sample test using localstack + testcontainers in Spring
package com.myapplication.email
import arrow.core.Either
import org.junit.jupiter.api.Assertions.fail
import org.junit.jupiter.api.Test
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.test.context.ActiveProfiles
import org.testcontainers.containers.localstack.LocalStackContainer
import org.testcontainers.utility.DockerImageName
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials
@tombasche
tombasche / SecurityConfig.kt
Last active August 11, 2021 15:36
Spring boot security config to allow preflight requests
import org.springframework.web.cors.CorsUtils
import org.springframework.context.annotation.Configuration
import org.springframework.security.config.annotation.web.builders.HttpSecurity
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
@Configuration
class SecurityConfig : WebSecurityConfigurerAdapter() {
override fun configure(http: HttpSecurity) {
http
.authorizeRequests()
@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)