-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e671c2c
commit de51c4b
Showing
12 changed files
with
304 additions
and
307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
CISTERCIAN_NUMBER_GENERATOR_SEGMENT_LENGTH=100 | ||
CISTERCIAN_NUMBER_GENERATOR_LINE_THICKNESS=4 | ||
CISTERCIAN_NUMBER_GENERATOR_LINE_THICKNESS=4 | ||
CISTERCIAN_NUMBER_GENERATOR_MERGE_PADDING=300 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,50 @@ | ||
cc: phpstan ecs | ||
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) | ||
|
||
phpstan: | ||
@echo "Running PHPStan" | ||
@./vendor/bin/phpstan | ||
help: ## Show this help. | ||
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' | grep -v '###' | ||
|
||
ecs: | ||
@echo "Running ECS" | ||
@./vendor/bin/ecs | ||
build: ## Build containers | ||
DOCKER_BUILDKIT=1 docker-compose build --pull --build-arg USER_ID=$(USER_ID) --build-arg GROUP_ID=$(GROUP_ID) | ||
|
||
merge: delete-generated | ||
bin/console app:merge | ||
ssh: ## Log into php container | ||
$(DOCKER_COMPOSE_RUN) fish | ||
|
||
generate: | ||
bin/console app:generate | ||
install: destroy build install-vendor copy-env ## install project | ||
|
||
delete-generated: | ||
@rm -f ./var/cistercianNumbers/*.png | ||
copy-env: | ||
[ -f .env.local ] || cp .env.local-dist .env.local | ||
|
||
delete-output: | ||
@rm -rf ./output/* | ||
install-vendor: ## install vendor | ||
$(DOCKER_COMPOSE_RUN) composer install | ||
|
||
regenerate: delete-generated generate | ||
destroy: ## Destroy containers | ||
$(DOCKER_COMPOSE) down -v --remove-orphans --rmi local | ||
rm -rf vendor var output | ||
|
||
count: | ||
@echo "Generated files:" | ||
@find ./output/ -type f | wc -l | ||
cc: phpstan ecs ## Check code | ||
|
||
fix-cs: | ||
@./vendor/bin/ecs --fix | ||
phpstan: ## Run PHPStan | ||
echo "Running PHPStan" | ||
$(DOCKER_COMPOSE_RUN) ./vendor/bin/phpstan | ||
|
||
ecs: ## Run ECS | ||
echo "Running ECS" | ||
$(DOCKER_COMPOSE_RUN) ./vendor/bin/ecs | ||
|
||
merge-view: merge view-last ## Merge and view last | ||
|
||
merge: ## Playground | ||
$(DOCKER_COMPOSE_RUN) bin/console app:merge | ||
|
||
view-last: ## View last generation in imv | ||
imv -f ./output/merge/$(shell ls -Art ./output/merge/ | tail -n 1) | ||
|
||
generate: ## Generate from 1 to 9999 | ||
$(DOCKER_COMPOSE_RUN) bin/console app:generate | ||
|
||
fix-cs: ## Fix code style | ||
$(DOCKER_COMPOSE_RUN) ./vendor/bin/ecs --fix |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Cistercian manipulator | ||
|
||
## Description | ||
|
||
This program was created to help solve the second enigma of "Le Tresor de Gisor" treasure hunt. | ||
|
||
Cistercian numbers are a numeral system that was used by the Cistercian monks in the Middle Ages. It use a set of lines to represent numbers from 1 to 9999. | ||
|
||
![Cistercian numbers](Cistercian%20numbers.png "Cistercian numbers") | ||
|
||
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 | ||
|
||
You can customize the .env.local file to alter the design of the glyphs. | ||
|
||
### Generate all Cistercian numbers from 1 to 9999 | ||
|
||
```bash | ||
make generate | ||
``` | ||
|
||
### Playground | ||
|
||
```bash | ||
make merge | ||
``` | ||
|
||
Alternatively if you have [imv](https://github.com/eXeC64/imv) installed you can run the following command to generate the numbers then view them in a gallery; | ||
|
||
```bash | ||
make merge-view | ||
``` | ||
|
||
### Local CI | ||
|
||
```bash | ||
make cc | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.