Skip to content

Instantly share code, notes, and snippets.

View phillippbertram's full-sized avatar
🚀
Focusing

Phillipp Bertram phillippbertram

🚀
Focusing
View GitHub Profile
@phillippbertram
phillippbertram / find_duplicates.sh
Created July 11, 2023 08:32
find duplicate files by name
#!/usr/bin/env zsh
# Function to find duplicate files in a directory
find_duplicate_files() {
# Create an associative array to store filenames
declare -A filenames
duplicate_found=false
# Find all files in the given directory and its subdirectories
find "$1" -type f | while IFS= read -r file; do
@phillippbertram
phillippbertram / TextLoop.tsx
Created April 24, 2023 07:47
Simple React Tex Loop Component using Framer Motion and tailwind.css
import React, { useEffect, useState } from "react";
import { AnimatePresence, motion } from "framer-motion";
export type TextLoopProps = React.PropsWithChildren & {
interval?: number;
delay?: number;
};
export const TextLoop: React.FC<TextLoopProps> = ({
interval = 3000,
@phillippbertram
phillippbertram / ec2-user-data-hostname.sh
Last active September 5, 2021 18:18
Simple httpd server user data script for ec2 instances that shows the current host name
#!/bin/bash
# use this for the user data
yum update -y
yum install -y httpd
systemctl start httpd
systemctl enable httpd
echo "<h1>Hello from $(hostname -f)</h1>" > /var/www/html/index.html
@phillippbertram
phillippbertram / wordpress-ecs-fargate-with-efs-and-aurora.ts
Last active June 28, 2022 23:33
Example of a production ready, high available containerized wordpress aws infrastructure using AWS-Fargate, AWS-Aurora, EFS via aws-cdk
/*
* Copyright (c) 2020 Phillipp Bertram
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH T
@phillippbertram
phillippbertram / wordpress-ecs-fargate-with-efs.ts
Last active November 21, 2022 12:20
Example AWS-CDK Configuration for Wordpress running on Containers using AWS Fargate with shared EFS Volume. Hope it will Help, until https://github.com/aws/containers-roadmap/issues/825 is implemented 😊
import * as cdk from '@aws-cdk/core';
import * as ec2 from '@aws-cdk/aws-ec2';
import * as ecs_patterns from '@aws-cdk/aws-ecs-patterns';
import * as ecs from '@aws-cdk/aws-ecs';
import * as rds from '@aws-cdk/aws-rds';
import * as efs from '@aws-cdk/aws-efs';
import * as custom_resources from '@aws-cdk/custom-resources';
// tslint:disable-next-line:no-var-requires
require('dotenv').config();
@phillippbertram
phillippbertram / RxCaptureMetadataOutputObjectsDelegateProxy.swift
Created January 16, 2018 10:39
RxSwift DelegateProxy for AVCaptureMetadataOutputObjectsDelegate
import AVFoundation
import RxSwift
import RxCocoa
extension Reactive where Base: AVCaptureMetadataOutput {
/// Reactive wrapper for `delegate`.
///
/// For more information take a look at `DelegateProxyType` protocol documentation.
public var delegate: DelegateProxy<AVCaptureMetadataOutput, AVCaptureMetadataOutputObjectsDelegate> {