This file contains hidden or 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
| #!/usr/bin/env python3 | |
| import os, io, json, random, datetime, subprocess, ssl, urllib.request | |
| from PIL import Image, ImageDraw, ImageFont | |
| # ---------------- CONFIG ---------------- | |
| DPI = 300 | |
| PAPER = os.getenv("PAPER", "A4").upper() # 'A4' or 'LETTER' | |
| def mm_px(mm): return round(mm / 25.4 * DPI) |
This file contains hidden or 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
| import { readdir, readFile, writeFile } from 'node:fs/promises'; | |
| import { join } from 'node:path'; | |
| async function walk(dir: string) { | |
| for (const e of await readdir(dir, { withFileTypes: true })) { | |
| const p = join(dir, e.name); | |
| if (e.isDirectory()) { | |
| await walk(p); | |
| } else if (e.isFile() && p.endsWith('.d.ts')) { | |
| const src = await readFile(p, 'utf8'); |
This file contains hidden or 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
| extends Node | |
| enum TERRAIN_SHAPE { NONE, FLAT, PEAK, DROP, SLANT } | |
| const QUAD_UVS: = PoolVector2Array([Vector2(0, 0), Vector2(1, 0), Vector2(1, 1), Vector2(0, 1)]) |
This file contains hidden or 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
| // My custom shader for implementing dithered alpha | |
| shader_type spatial; | |
| render_mode blend_mix,depth_draw_opaque,cull_disabled,diffuse_burley,specular_schlick_ggx; | |
| // Texture maps | |
| uniform sampler2D texture_albedo : hint_albedo; | |
| uniform sampler2D texture_masks : hint_white; | |
| uniform sampler2D texture_normal : hint_normal; | |
| // Parameters |
This file contains hidden or 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
| { | |
| "env": { | |
| "node": true, | |
| "es6": true | |
| }, | |
| "extends": "eslint:recommended", | |
| "parserOptions": { | |
| "sourceType": "module", | |
| "ecmaVersion": 8 | |
| }, |
This file contains hidden or 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
| 0000000000000000000000000111111111111111100000000000000000000000000000000000000000000000000000000000 | |
| 0000000000000000000111111111111111111111111111111110000000000000000000000000000000000000000000000000 | |
| 0000000000000111111111111111111111111111111111111111111111111100000000000000000000000000000000000000 | |
| 0000000111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000 | |
| 0000011111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000 | |
| 0000011111111111111111111111111111111111122222222222222221111111111111111111111111111110000000000000 | |
| 0000011111111111111111111111111222222222222222233333333333333333331111111111111111111111000000000000 | |
| 0000111111111111111111222222222222222223333333333333333333333333333333333333311111111111000000000000 | |
| 0000111111111111122222222222222333333333333333333333333333333333333333333333333333111111100000000000 | |
| 0000111111111111122222333333333333333333333333333333333333333333333333333333333333311111100000000000 |
This file contains hidden or 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
| router.post('/:id/title-image', (req, res, next) => { | |
| lwip.open(req.file.buffer, 'jpg', (err, image) => { | |
| if (err) { next(err); return; } | |
| let ratio = (image.width() > 960 ? (960 / image.width()) : 1); | |
| image.scale(ratio, (err, image) => { | |
| if (err) { next(err); return; } | |
| image.crop(image.width(), Math.min((image.width() / 2), image.height()), (err, image) => { | |
| if (err) { next(err); return; } | |
| image.toBuffer('jpg', { quality: 80 }, (err, buffer) => { |
This file contains hidden or 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
| //// | |
| .......... | |
| ..................... | |
| ..T.......T....T...........T... | |
| .......................................... | |
| ...........T........................................ | |
| .....T................T...............T........................ | |
| .........T...................... |
This file contains hidden or 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
| //// | |
| ......................................................... | |
| ..............T........................................................ | |
| ............................T..................T.................................... | |
| .T....................T.......................................T.................................. | |
| .....................T.....T...................T.........................................T........ | |
| ............................................ |
This file contains hidden or 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
| // `domains` is a global containing valid domains grouped by keys | |
| // this module is instantiated via require at the top of some file and | |
| // the following is run once per request: | |
| // Origin.foundKey(blah, blah); | |
| // some origin stuff | |
| var _ = require('underscore'); |
NewerOlder