Skip to content

Instantly share code, notes, and snippets.

View dietrichmax's full-sized avatar

Max Dietrich dietrichmax

View GitHub Profile
@dietrichmax
dietrichmax / nginxnextjs.conf
Last active March 6, 2025 04:13
Nginx Configuration for Nextjs
# Based on https://steveholgado.com/nginx-for-nextjs/
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=STATIC:10m inactive=7d use_temp_path=off;
upstream nextjs_upstream {
server nextjs:3000;
keepalive 2;
}
server {
import React, { useState, useEffect, useRef } from 'react';
import { Feature, Map, View } from 'ol';
import TileLayer from 'ol/layer/Tile';
import Overlay from 'ol/Overlay';
import OSM from 'ol/source/OSM';
import {fromLonLat} from 'ol/proj';
import 'ol/ol.css';
import VectorLayer from 'ol/layer/Vector';
import VectorSource from 'ol/source/Vector';
@dietrichmax
dietrichmax / gist:f14547acd4eb9c21280cf87c09783844
Created January 17, 2024 19:11
Dockerize existing Strapi v3
FROM node:14 AS base
# Install dependencies only when needed
FROM base AS deps
WORKDIR /app
# Install dependencies based on the preferred package manager
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
RUN npm install
const axios = require('axios');
const { GarminConnect } = require('garmin-connect');
const GCClient = new GarminConnect();
const getExistingActivities = async () => {
const existingActivityIds = []
const activities = await axios.get(`${process.env.HOST}/activities`)
activities.data.map((activity) => {
existingActivityIds.push(activity.activityId)
@dietrichmax
dietrichmax / windows-spotlight-wp.sh
Last active February 1, 2025 23:23 — forked from Aleksandr-ru/windows-spotlight-wp.sh
Windows spotlight wallpaper changer for Linux (Elementary OS) and macOS
#!/usr/bin/env bash
# Elementary OS specific:
# 1) edit file "/etc/lightdm/io.elementary.greeter.conf"
# uncomment line 3 "#default-wallpaper=/usr/share/backgrounds/elementaryos-default"
# 2) change symbolic link "/usr/share/backgrounds/elementaryos-default" to "~/windows-spotlight-wp/last.jpg"
function checkret
{
if [ $1 -ne 0 ]; then
@dietrichmax
dietrichmax / Dockerfile
Last active February 16, 2025 21:40
Nextjs Dockerfile
FROM node:22-alpine AS base
# Base image for all subsequent stages
FROM base AS deps
# Install dependencies (libc6-compat is sometimes required)
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
RUN npm install && npm install sharp