Skip to content

Instantly share code, notes, and snippets.

View erikvullings's full-sized avatar

Erik Vullings erikvullings

View GitHub Profile
@erikvullings
erikvullings / README.md
Created September 4, 2023 08:53
Sort photos by EXIF date taken in a folder structure (WINDOWS).

Introduction

My camera photos on my phone all end up in one big folder. I wanted to sort them by date taken in a simple format year-month format, YYYY-MM. I tried the application PhotoMove, but unfortunately, this simple requirement is only available with the PRO version, so instead, I've asked ChatGPT to create a PowerShell script for me.

Usage:

  1. Download the Windows version from exif tool and unzip it into a folder. Make sure that the name is exiftool.exe (in my case, it had a weird name exiftool(-k).exe so rename it if that's the case).
  2. Save the PowerShell script you can find below in the same folder.
  3. Open a PowerShell window (WIN+R and enter powershell)
  4. Run the script ./sort.ps1
@erikvullings
erikvullings / .env
Created September 1, 2023 15:43
Docker setup with Traefik as a reverse proxy + let's encrypt certificates, keycloak + postgres as identity provider, and a simple service that is protected by it
POSTGRESQL_PASSWORD="PASSWORD"
POSTGRESQL_POSTGRES_PASSWORD="PASSWORD"
KEYCLOAK_ADMIN_PWD="PASSWORD"
HOST="LOCALHOST"
EMAIL="YOUR.EMAIL"
@erikvullings
erikvullings / Docker-compose.yml
Created May 22, 2023 09:40
Traefik reverse proxy settings in Docker (swarm), including strip path prefix
---
version: "3.3"
networks:
icem-net:
driver: overlay
attachable: true
services:
reverse-proxy:
@erikvullings
erikvullings / README.md
Last active May 19, 2023 16:31
Create a new Docker volume and fill it with local data

Create Docker volume

When moving from a local development environment to the cloud, e.g. Docker swarm or Kubernetes, you often need a way to access local files. However, in the cloud your local file system cannot be accessed anymore, so you need a way to copy your local files to a volume and mount that instead. This is the purpose of the script. You supply it with the volume name (e.g. schemas) and the local folder containing the schemas, e.g. ../../schemas, and a schemas volume is created, containing all data that is copied into the container.

./create_volume.sh schemas ../../schemas
@erikvullings
erikvullings / extract_domain_name.ts
Created October 23, 2022 08:25
Extract main domain name from a URL
const url = "https://www.lancasterguardian.co.uk/read-this/womens-world-cup-2023-groups-england-to-face-denmark-and-china-see-the-full-draw-3890113";
const url1 = "https://www.tudelft.nl";
const url2 = "https://whatsnew2day.com/world-cup-2023-draw-uswnt-face-vietnam-netherlands-playoff-winner-new-zealand-htmlns_mchannelrssns_campaign1490ito1490/";
const url3 = "https://www.news4jax.com/news/politics/2022/10/22/weapons-shortages-could-mean-hard-calls-for-ukraines-allies/";
const extractAgency = (url = '') => {
if (url.startsWith('https://t.me/')) return 'TELEGRAM';
let hostname: string;
try {
const u = new URL(url);
@erikvullings
erikvullings / local-ldb.ts
Created June 11, 2022 10:43
IndexedDB wrapper in TypeScript
/**
* Use IndexedDB for local storage.
* Based on https://github.com/DVLP/localStorageDB, but converted to TypeScript and using async instead of callbacks.
* @source: https://github.com/DVLP/localStorageDB/blob/master/localdata.js
*
* Usage example
*
*
```ts
const test = async () => {
@erikvullings
erikvullings / utils.ts
Last active September 22, 2022 08:51
Utility functions
/* A list of useful functions snippets */
/**
* Create a GUID
* @see https://stackoverflow.com/a/2117523/319711
*
* @returns RFC4122 version 4 compliant GUID
*/
export const uuid4 = () => {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {