Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

smaller code size to merge with original. #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
656 changes: 656 additions & 0 deletions .github/cidc/pdf.css

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions .github/workflows/deploy-mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: deploy-mkdocs site

on:
push:
branches: [ master ]
paths-ignore:
- '.github/workflows/*.yml'
pull_request:
branches: [ master ]
paths-ignore:
- '.github/workflows/*.yml'

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: pip install mkdocs-material mkdocs-literate-nav mkdocs-gen-files
- run: mkdocs gh-deploy --force
66 changes: 66 additions & 0 deletions .github/workflows/generate-pdf-book-A4.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Generate PDF book (Size A4)

on:
push:
branches: [ master ]
paths-ignore:
- '.github/workflows/*.yml'
pull_request:
branches: [ master ]
paths-ignore:
- '.github/workflows/*.yml'

workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Install emoji fonts & renderer
run: |
sudo apt-add-repository ppa:eosrei/fonts
sudo apt-get update
sudo apt-get install fonts-twemoji-svginot pdftk

- name: Install node
uses: actions/setup-node@v2

- name: Install node dependencies
run: npm install -g mdpdf
- uses: actions/checkout@v2

# At the moment there's an issue with links - it's not possible to create link that would point to same document
- name: Replace All URLs with links that point to website
run: |
export CHAPTERS=($(cat README.md | grep -oEi '(\.\/chapters.*)\)' | sed 's/)$//g'))
for (( i=0; i<${#CHAPTERS[@]}; i++ ))
do
sed -ire "s;[0-9a-zA-Z\.\/\-\)\(]+\#;\#;g" ${CHAPTERS[$i]}
done

- name: Convert markdown to PDF
run: |
mkdir res
export CHAPTERS=($(cat README.md | grep -oEi '(\.\/chapters.*)\)' | sed 's/)$//g'))
for (( i=0; i<${#CHAPTERS[@]}; i++ ))
do
FILE_NAME=$(printf "res/%03d.pdf" ${i})
mdpdf --format A4 "${CHAPTERS[$i]}" "${FILE_NAME}"
done

mdpdf --format A4 README.md README.pdf

- name: Merge PDF into single document
run: |
pdftk README.pdf res/*.pdf cat output ceh-in-bullet-points.pdf

- name: (ENV) Get current date
id: date
run: echo "CURR_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: CEH-in-bulletpoints-${{env.CURR_DATE}}
path: ceh-in-bullet-points.pdf
66 changes: 66 additions & 0 deletions .github/workflows/generate-pdf-book-A5.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Generate PDF book (size A5)

on:
push:
branches: [ master ]
paths-ignore:
- '.github/workflows/*.yml'
pull_request:
branches: [ master ]
paths-ignore:
- '.github/workflows/*.yml'

workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Install emoji fonts & renderer
run: |
sudo apt-add-repository ppa:eosrei/fonts
sudo apt-get update
sudo apt-get install fonts-twemoji-svginot pdftk

- name: Install node
uses: actions/setup-node@v2

- name: Install node dependencies
run: npm install -g mdpdf
- uses: actions/checkout@v2

# At the moment there's an issue with links - it's not possible to create link that would point to same document
- name: Replace All URLs with links that point to website
run: |
export CHAPTERS=($(cat README.md | grep -oEi '(\.\/chapters.*)\)' | sed 's/)$//g'))
for (( i=0; i<${#CHAPTERS[@]}; i++ ))
do
sed -ire "s;[0-9a-zA-Z\.\/\-\)\(]+\#;\#;g" ${CHAPTERS[$i]}
done

- name: Convert markdown to PDF
run: |
mkdir res
export CHAPTERS=($(cat README.md | grep -oEi '(\.\/chapters.*)\)' | sed 's/)$//g'))
for (( i=0; i<${#CHAPTERS[@]}; i++ ))
do
FILE_NAME=$(printf "res/%03d.pdf" ${i})
mdpdf --style=.github/cidc/pdf.css --format=A5 --border=5 "${CHAPTERS[$i]}" "${FILE_NAME}"
done

mdpdf --style=.github/cidc/pdf.css --format=A5 --border=5 README.md README.pdf

- name: Merge PDF into single document
run: |
pdftk README.pdf res/*.pdf cat output ceh-in-bullet-points-A5.pdf

- name: (ENV) Get current date
id: date
run: echo "CURR_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: CEH-in-bulletpoints-A5-${{env.CURR_DATE}}
path: ceh-in-bullet-points-A5.pdf
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Certified ethical hacker in bullet points

[![Quality checks status](https://github.com/undergroundwires/CEH-in-bullet-points/workflows/Quality%20checks/badge.svg)](https://github.com/undergroundwires/CEH-in-bullet-points/actions)

[![Generate PDF book (Size A4)](https://github.com/undergroundwires/CEH-in-bullet-points/actions/workflows/generate-pdf-book-A4.yaml/badge.svg)](https://github.com/undergroundwires/CEH-in-bullet-points/actions/workflows/generate-pdf-book-A4.yaml)

[![Generate PDF book (Size A5)](https://github.com/undergroundwires/CEH-in-bullet-points/actions/workflows/generate-pdf-book-A5.yaml/badge.svg)](https://github.com/undergroundwires/CEH-in-bullet-points/actions/workflows/generate-pdf-book-A5.yaml)

[![GitHub sponsors](https://undergroundwires.dev/img/badges/donate/flat.svg)](https://undergroundwires.dev/donate?project=Azure-in-bullet-points)

- This repo contains study notes for Certified Ethical Hacker exam.
Expand All @@ -25,6 +30,7 @@

## Content

<!--nav-->
1. Introduction
1. Information security
1. [Information security overview](./chapters/01-introduction/information-security-overview.md)
Expand Down
10 changes: 10 additions & 0 deletions gen_index.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import re
import mkdocs_gen_files

# Move the "README.md" file into chapters/, for use by MkDocs.
with open("README.md") as in_f, mkdocs_gen_files.open("README.md", "w") as out_f:
for line in in_f:
line = re.sub(r'\bchapters/', '', line)
# Replace 3-space indentation in lists with 4-space indentation:
line = re.sub(r'^ ?( +)\1\1\b', r'\1\1\1\1', line)
out_f.write(line)
Loading