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 / MazeGenerator.cs
Created November 9, 2024 09:42
Generating a "perfect" maze using recursive backtracking
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
public class MazeGenerator : MonoBehaviour
{
[SerializeField]
int seed;
@tombasche
tombasche / blender_batch_export.py
Created October 30, 2024 11:18
Batch export selected objects from Blender to FBX
import bpy
import os
from copy import copy
# export to blend file location
basedir = os.path.dirname(bpy.data.filepath)
if not basedir:
raise Exception("Blend file is not saved")
@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;