Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
Staormin authored and kevin-macquer-omnilog committed Nov 4, 2024
0 parents commit 3e78c4c
Show file tree
Hide file tree
Showing 31 changed files with 4,628 additions and 0 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"]
24 changes: 24 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# In all environments, the following files are loaded if they exist,
# the latter taking precedence over the former:
#
# * .env contains default values for the environment variables needed by the app
# * .env.local uncommitted file with local overrides
# * .env.$APP_ENV committed environment-specific defaults
# * .env.$APP_ENV.local uncommitted environment-specific overrides
#
# Real environment variables win over .env files.
#
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
# https://symfony.com/doc/current/configuration/secrets.html
#
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration

###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=46e7590c2429fbef676225f48cd34c5f
###< symfony/framework-bundle ###

CISTERCIAN_NUMBER_GENERATOR_SEGMENT_LENGTH=~
CISTERCIAN_NUMBER_GENERATOR_LINE_THICKNESS=~
CISTERCIAN_NUMBER_GENERATOR_MERGE_PADDING=~
3 changes: 3 additions & 0 deletions .env.local-dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CISTERCIAN_NUMBER_GENERATOR_SEGMENT_LENGTH=100
CISTERCIAN_NUMBER_GENERATOR_LINE_THICKNESS=4
CISTERCIAN_NUMBER_GENERATOR_MERGE_PADDING=300
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
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###

###> phpstan/phpstan ###
phpstan.neon
###< phpstan/phpstan ###

###> squizlabs/php_codesniffer ###
/.phpcs-cache
/phpcs.xml
###< squizlabs/php_codesniffer ###

output
Binary file added Cistercian numbers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +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 copy-env ## install project

copy-env:
[ -f .env.local ] || cp .env.local-dist .env.local

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

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

cc: phpstan ecs ## Check code

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
54 changes: 54 additions & 0 deletions Readme.md
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
```

21 changes: 21 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env php
<?php

use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;

if (!is_dir(dirname(__DIR__).'/vendor')) {
throw new LogicException('Dependencies are missing. Try running "composer install".');
}

if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) {
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
}

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';

return function (array $context) {
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);

return new Application($kernel);
};
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
73 changes: 73 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"type": "project",
"license": "proprietary",
"minimum-stability": "stable",
"prefer-stable": true,
"require": {
"php": ">=8.2",
"ext-ctype": "*",
"ext-iconv": "*",
"symfony/console": "7.1.*",
"symfony/dotenv": "7.1.*",
"symfony/flex": "^2",
"symfony/framework-bundle": "7.1.*",
"symfony/runtime": "7.1.*",
"symfony/yaml": "7.1.*",
"ext-gd": "*"
},
"require-dev": {
"phpstan/phpstan": "^1.12",
"slevomat/coding-standard": "^8.15",
"symplify/easy-coding-standard": "^12.3"
},
"config": {
"allow-plugins": {
"php-http/discovery": true,
"symfony/flex": true,
"symfony/runtime": true,
"dealerdirect/phpcodesniffer-composer-installer": true
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php72": "*",
"symfony/polyfill-php73": "*",
"symfony/polyfill-php74": "*",
"symfony/polyfill-php80": "*",
"symfony/polyfill-php81": "*",
"symfony/polyfill-php82": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "7.1.*"
}
}
}
Loading

0 comments on commit 3e78c4c

Please sign in to comment.