Skip to content

Commit

Permalink
Fix for unwanted anti-aliasing on Chrome (thanks MiniDdigger). Added …
Browse files Browse the repository at this point in the history
…skin dump and quick-n-dirty script to generate the jekyll posts.
  • Loading branch information
TkTech committed Nov 20, 2020
1 parent 92d0b6b commit bbf151f
Show file tree
Hide file tree
Showing 4 changed files with 61,620 additions and 70 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.jekyll-cache/*
venv/
75 changes: 5 additions & 70 deletions css/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -162,77 +162,12 @@ dl.side-by-side {
}
}

/**
* Specific to skins.tkte.ch below.
*/

img.preview {
width: 300px;
image-rendering: -moz-crisp-edges;
image-rendering: pixelated;
}

.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888; font-style: italic } /* Comment */
.highlight .err { background-color: #a848a8 } /* Error */
.highlight .k { color: #2838b0 } /* Keyword */
.highlight .o { color: #666666 } /* Operator */
.highlight .p { color: #888888 } /* Punctuation */
.highlight .ch { color: #287088; font-style: italic } /* Comment.Hashbang */
.highlight .cm { color: #888888; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #289870 } /* Comment.Preproc */
.highlight .cpf { color: #888888; font-style: italic } /* Comment.PreprocFile */
.highlight .c1 { color: #888888; font-style: italic } /* Comment.Single */
.highlight .cs { color: #888888; font-style: italic } /* Comment.Special */
.highlight .gd { color: #c02828 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #c02828 } /* Generic.Error */
.highlight .gh { color: #666666 } /* Generic.Heading */
.highlight .gi { color: #388038 } /* Generic.Inserted */
.highlight .go { color: #666666 } /* Generic.Output */
.highlight .gp { color: #444444 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #444444 } /* Generic.Subheading */
.highlight .gt { color: #2838b0 } /* Generic.Traceback */
.highlight .kc { color: #444444; font-style: italic } /* Keyword.Constant */
.highlight .kd { color: #2838b0; font-style: italic } /* Keyword.Declaration */
.highlight .kn { color: #2838b0 } /* Keyword.Namespace */
.highlight .kp { color: #2838b0 } /* Keyword.Pseudo */
.highlight .kr { color: #2838b0 } /* Keyword.Reserved */
.highlight .kt { color: #2838b0; font-style: italic } /* Keyword.Type */
.highlight .m { color: #444444 } /* Literal.Number */
.highlight .s { color: #b83838 } /* Literal.String */
.highlight .na { color: #388038 } /* Name.Attribute */
.highlight .nb { color: #388038 } /* Name.Builtin */
.highlight .nc { color: #287088 } /* Name.Class */
.highlight .no { color: #b85820 } /* Name.Constant */
.highlight .nd { color: #287088 } /* Name.Decorator */
.highlight .ni { color: #709030 } /* Name.Entity */
.highlight .ne { color: #908828 } /* Name.Exception */
.highlight .nf { color: #785840 } /* Name.Function */
.highlight .nl { color: #289870 } /* Name.Label */
.highlight .nn { color: #289870 } /* Name.Namespace */
.highlight .nt { color: #2838b0 } /* Name.Tag */
.highlight .nv { color: #b04040 } /* Name.Variable */
.highlight .ow { color: #a848a8 } /* Operator.Word */
.highlight .w { color: #a89028 } /* Text.Whitespace */
.highlight .mb { color: #444444 } /* Literal.Number.Bin */
.highlight .mf { color: #444444 } /* Literal.Number.Float */
.highlight .mh { color: #444444 } /* Literal.Number.Hex */
.highlight .mi { color: #444444 } /* Literal.Number.Integer */
.highlight .mo { color: #444444 } /* Literal.Number.Oct */
.highlight .sa { color: #444444 } /* Literal.String.Affix */
.highlight .sb { color: #b83838 } /* Literal.String.Backtick */
.highlight .sc { color: #a848a8 } /* Literal.String.Char */
.highlight .dl { color: #b85820 } /* Literal.String.Delimiter */
.highlight .sd { color: #b85820; font-style: italic } /* Literal.String.Doc */
.highlight .s2 { color: #b83838 } /* Literal.String.Double */
.highlight .se { color: #709030 } /* Literal.String.Escape */
.highlight .sh { color: #b83838 } /* Literal.String.Heredoc */
.highlight .si { color: #b83838; text-decoration: underline } /* Literal.String.Interpol */
.highlight .sx { color: #a848a8 } /* Literal.String.Other */
.highlight .sr { color: #a848a8 } /* Literal.String.Regex */
.highlight .s1 { color: #b83838 } /* Literal.String.Single */
.highlight .ss { color: #b83838 } /* Literal.String.Symbol */
.highlight .bp { color: #388038; font-style: italic } /* Name.Builtin.Pseudo */
.highlight .fm { color: #b85820 } /* Name.Function.Magic */
.highlight .vc { color: #b04040 } /* Name.Variable.Class */
.highlight .vg { color: #908828 } /* Name.Variable.Global */
.highlight .vi { color: #b04040 } /* Name.Variable.Instance */
.highlight .vm { color: #b85820 } /* Name.Variable.Magic */
.highlight .il { color: #444444 } /* Literal.Number.Integer.Long */
56 changes: 56 additions & 0 deletions generate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
"""
Quick hack to turn the image dump (exported to JSON from MariaDB) into
individual Jekyll posts.
"""
import json
import base64
from datetime import datetime
from pathlib import Path

POST_ROOT = Path('_posts')


with open('skins.json') as src:
skins = json.load(src)

for skin in skins:
added = datetime.strptime(skin['added'], '%Y-%m-%d %H:%M:%S')
added = added.strftime('%Y-%m-%d')

preview = base64.b64encode(bytes.fromhex(skin['image_combined'][2:]))
preview = preview.decode('utf-8')

raw = base64.b64encode(bytes.fromhex(skin['image'][2:]))
raw = raw.decode('utf-8')

with open(POST_ROOT / f'{added}-{skin["id"]}.md', 'wb') as out:
out.write(f'''---
title: >
{skin["name"]}
layout: post
permalink: /view/{skin["id"]}
votes: {skin["vote_count"]}
preview: "data:image/png;base64,{preview}"
---
<dl class="side-by-side">
<dt>Preview</dt>
<dd>
<img class="preview" src="data:image/png;base64,{preview}">
</dd>
<dt>Original</dt>
<dd>
<img class="preview" src="data:image/png;base64,{raw}">
</dd>
<dt>Title</dt>
<dd>{skin["name"]}</dd>
<dt>Description</dt>
<dd>{skin["description"]}</dd>
<dt>Added By</dt>
<dd>{skin["author"]}</dd>
<dt>Added On</dt>
<dd>{added}</dd>
<dt>Votes</dt>
<dd>{skin["vote_count"]}</dd>
</dl>
'''.encode('utf-8'))
Loading

0 comments on commit bbf151f

Please sign in to comment.