Skip to content

Commit

Permalink
RIP - En fait, c'était pas ça
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-macquer-omnilog committed Nov 4, 2024
1 parent e671c2c commit 6d12ada
Show file tree
Hide file tree
Showing 10 changed files with 285 additions and 301 deletions.
41 changes: 41 additions & 0 deletions .docker/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FROM php:8.3-cli-alpine

ARG USER_ID
ARG GROUP_ID

RUN addgroup -g ${GROUP_ID} -S app
RUN adduser -u ${USER_ID} -S app -G app

COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

RUN apk add --no-cache \
git \
unzip \
fish \
curl

RUN apk add --no-cache \
freetype-dev \
libjpeg-turbo-dev \
libpng-dev

RUN docker-php-ext-configure gd --with-freetype --with-jpeg
RUN docker-php-ext-install -j$(nproc) gd

USER app

RUN curl https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install -o /tmp/installomf

RUN chown app:app /tmp/installomf && \
chmod u+x /tmp/installomf && \
/tmp/installomf --noninteractive --yes

RUN fish -c "omf install bobthefish"

STOPSIGNAL SIGKILL

WORKDIR /app

COPY --chown=app:app . /app

SHELL ["/usr/bin/fish", "-c"]
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: ci

on:
push:
branches: [ main ]

jobs:
check-code:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: 8.3
coverage: none
extensions: gd
- uses: ramsey/composer-install@v2
- name: PHPStan
run: vendor/bin/phpstan analyse
- name: Easy Coding Standard
run: vendor/bin/ecs check
52 changes: 36 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,30 +1,50 @@
USER_ID := $(shell id -u)
GROUP_ID := $(shell id -g)
CONTAINER_NAME := php
DOCKER_COMPOSE := docker-compose
DOCKER_COMPOSE_RUN := $(DOCKER_COMPOSE) run --user=$(USER_ID) --rm --no-deps $(CONTAINER_NAME)

help: ## Show this help.
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' | grep -v '###'

build: ## Build containers
DOCKER_BUILDKIT=1 docker-compose build --pull --build-arg USER_ID=$(USER_ID) --build-arg GROUP_ID=$(GROUP_ID)

ssh: ## Log into php container
$(DOCKER_COMPOSE_RUN) fish

install: destroy build install-vendor ## install project

install-vendor: ## install vendor
$(DOCKER_COMPOSE_RUN) composer install

destroy:
$(DOCKER_COMPOSE) down -v --remove-orphans --rmi local
rm -rf vendor var output

cc: phpstan ecs

phpstan:
@echo "Running PHPStan"
@./vendor/bin/phpstan
echo "Running PHPStan"
$(DOCKER_COMPOSE_RUN) ./vendor/bin/phpstan

ecs:
@echo "Running ECS"
@./vendor/bin/ecs
echo "Running ECS"
$(DOCKER_COMPOSE_RUN) ./vendor/bin/ecs

merge-view: merge view-last

merge: delete-generated
bin/console app:merge
$(DOCKER_COMPOSE_RUN) bin/console app:merge

view-last:
imv -f ./output/merge/$(shell ls -Art ./output/merge/ | tail -n 1)

generate:
bin/console app:generate
$(DOCKER_COMPOSE_RUN) bin/console app:generate

delete-generated:
@rm -f ./var/cistercianNumbers/*.png

delete-output:
@rm -rf ./output/*

regenerate: delete-generated generate

count:
@echo "Generated files:"
@find ./output/ -type f | wc -l

fix-cs:
@./vendor/bin/ecs --fix
$(DOCKER_COMPOSE_RUN) ./vendor/bin/ecs --fix
42 changes: 42 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Cistercian manipulator

## Description

This program was created to help solve the second enigma of "Le Tresor de Gisor" treasure hunt.

The enigma has Roman numerals and a Cistercian number. We assumed that we needed to convert the Romans numerals to Arabic numerals and then to Cistercian numbers and assemble the glyphs to form some word or number.

It turned out to be a very wrong assumption which was invalidated by the author of the treasure hunt.

You can use it for other enigma that may use this mechanism.

## Requirements

[Docker](https://www.docker.com/)

## Installation

```bash
make install
```

## Usage

### Generate all Cistercian numbers from 1 to 9999

```bash
make generate
```

### Playground

```bash
make merge
```

### Local CI

```bash
make cc
```

8 changes: 8 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
php:
env_file:
- .env.local
build: ./.docker/php/
volumes:
- .:/app
working_dir: /app
Loading

0 comments on commit 6d12ada

Please sign in to comment.