-
Notifications
You must be signed in to change notification settings - Fork 2
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
0 parents
commit a2fb88f
Showing
199 changed files
with
15,773 additions
and
0 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,116 @@ | ||
""" builder """ | ||
from string import Template | ||
import os | ||
from os.path import getmtime, getsize, join | ||
from datetime import datetime | ||
|
||
|
||
def size(size_in_bytes): | ||
"""convert""" | ||
size_kb = size_in_bytes / 1024.0 | ||
size_mb = size_kb / 1024.0 | ||
|
||
if size_mb >= 1: | ||
return f"{size_mb:.2f}M" | ||
elif size_kb >= 1: | ||
return f"{size_kb:.2f}K" | ||
return size_in_bytes | ||
|
||
|
||
PATH_TO_TEMPLATE = ".github/workflows/index.html" | ||
with open(PATH_TO_TEMPLATE, "r", encoding="utf-8") as template_file: | ||
html = template_file.read() | ||
|
||
EXCLUDE_LIST = [".git", ".github", ".static"] | ||
EXCLUDE_LIST_FULL = ["./README.md", "./.gitignore"] | ||
|
||
CSS = """.thumbnail { | ||
position: relative; | ||
z-index: 0; | ||
} | ||
.thumbnail:hover { | ||
background-color: transparent; | ||
z-index: 50; | ||
} | ||
.thumbnail span { | ||
position: absolute; | ||
padding: 5px; | ||
left: -1000px; | ||
border: 1px dashed gray; | ||
visibility: hidden; | ||
color: black; | ||
text-decoration: none; | ||
} | ||
.thumbnail span img { | ||
border-width: 0; | ||
padding: 2px; | ||
min-width: 500px; | ||
} | ||
.thumbnail:hover span { | ||
visibility: visible; | ||
top: 0; | ||
left: 60px; /*position where enlarged image should offset horizontally */ | ||
}""" | ||
|
||
HEADER = """ | ||
""" | ||
|
||
html = html.replace("<style></style>", f"{HEADER}<style>{CSS}</style>") | ||
|
||
t = Template( | ||
"""<tr> | ||
<td valign="top"><img src="$url" alt="[ ]" /></td> | ||
<td><a $add href="$file">$file $other</a></td> | ||
<td align="right">$date</td> | ||
<td align="right">$size</td> | ||
<td> </td> | ||
</tr>""" | ||
) | ||
|
||
URL = "https://bel-art.github.io/telecom-logos" | ||
REPO = "https://github.com/Bel-Art/telecom-logos" | ||
LINK = f'<a href="{REPO}">{REPO}</a>' | ||
|
||
UNKNOWN = f"{URL}/.static/unknown.gif" | ||
FOLDER = f"{URL}/.static/folder.gif" | ||
|
||
|
||
def create_index_html(folder): | ||
"""create an index.html""" | ||
listed = sorted(os.listdir(folder)) | ||
s = "" | ||
correct_html = f"{html}".replace( | ||
"<title></title>", f"<title>Index of {folder}</title>" | ||
) | ||
correct_html = correct_html.replace( | ||
"<h1></h1>", | ||
f"<h1>Index of {folder} - {LINK}</h1>", | ||
) | ||
for name in listed: | ||
if name == "index.html" or name in EXCLUDE_LIST: | ||
continue | ||
p = join(folder, name) | ||
if p in EXCLUDE_LIST_FULL: | ||
continue | ||
isdir = os.path.isdir(p) | ||
date = datetime.fromtimestamp(getmtime(p)).strftime("%Y-%m-%d %H:%M:%S") | ||
url = FOLDER if isdir else UNKNOWN | ||
preview = not isdir and not name.endswith(".md") | ||
add = 'class="thumbnail"' if preview else "" | ||
other = f'<span><img src="{name}"></span>' if preview else "" | ||
s += t.substitute( | ||
file=name, date=date, size=size(getsize(p)), url=url, add=add, other=other | ||
) | ||
if isdir and name not in EXCLUDE_LIST: | ||
create_index_html(p) | ||
file_data = correct_html.replace("<placeholder></placeholder>", s) | ||
with open(join(folder, "index.html"), "w", encoding="utf-8") as file: | ||
file.write(file_data) | ||
|
||
|
||
if __name__ == "__main__": | ||
create_index_html(".") |
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,44 @@ | ||
# Simple workflow for deploying static content to GitHub Pages | ||
name: Deploy static content to Pages | ||
|
||
on: | ||
# Runs on pushes targeting the default branch | ||
push: | ||
branches: ["main"] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
# Single deploy job since we're just deploying | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v4 | ||
- name: render index.html | ||
run: python3 .github/workflows/build.py | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v2 | ||
with: | ||
path: "." | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v3 |
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,38 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title></title> | ||
<style></style> | ||
</head> | ||
<body> | ||
<h1></h1> | ||
<table> | ||
<tr> | ||
<th valign="top"> | ||
<img src="https://bel-art.github.io/telecom-logos/.static/folder.gif" alt="[ICO]" /> | ||
</th> | ||
<th><a href="?C=N;O=D">Name</a></th> | ||
<th><a href="?C=M;O=A">Last modified</a></th> | ||
<th><a href="?C=S;O=A">Size</a></th> | ||
<th><a href="?C=D;O=A">Description</a></th> | ||
</tr> | ||
<tr> | ||
<th colspan="5"><hr /></th> | ||
</tr> | ||
<tr> | ||
<td valign="top"> | ||
<img src="https://bel-art.github.io/telecom-logos/.static/back.gif" alt="[PARENTDIR]" /> | ||
</td> | ||
<td><a href="..">Parent Directory</a></td> | ||
<td> </td> | ||
<td align="right">-</td> | ||
<td> </td> | ||
</tr> | ||
<placeholder></placeholder> | ||
<tr> | ||
<th colspan="5"><hr /></th> | ||
</tr> | ||
</table> | ||
</body> | ||
</html> |
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,13 @@ | ||
#!/bin/bash | ||
|
||
# useful to reset history when it's too big | ||
# the git history in this context is not very important | ||
|
||
rm -rf .git | ||
|
||
git init | ||
git add . | ||
git commit -m "Initial commit" | ||
|
||
git remote add origin [email protected]:Bel-Art/telecom-logos.git | ||
git push -u --force origin main |
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,2 @@ | ||
index.html | ||
!.github/workflows/index.html |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file not shown.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.