Skip to content

Instantly share code, notes, and snippets.

View ThomasJunk's full-sized avatar

Thomas Junk ThomasJunk

  • Intevation
  • Osnabrück (GER)
View GitHub Profile
@ThomasJunk
ThomasJunk / DropArea.svelte
Created July 25, 2023 13:32
CSAF Validation
<!--
This file is Free Software under the MIT License
without warranty, see README.md and LICENSES/MIT.txt for details.
SPDX-License-Identifier: MIT
SPDX-FileCopyrightText: 2023 German Federal Office for Information Security (BSI) <https://www.bsi.bund.de>
Software-Engineering: 2023 Intevation GmbH <https://intevation.de
-->
<script lang="ts">
@ThomasJunk
ThomasJunk / convert_statblock.py
Last active October 20, 2022 17:46
Converts statblocks
#!/bin/env python3
import json
# MONSTERS = "test_conversion.json"
MONSTERS = "monstersCompendium.json"
"""
Example Statblock
@ThomasJunk
ThomasJunk / index.html
Last active January 6, 2023 23:46
whatevergrid
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]> <html class="no-js"> <!--<![endif]-->
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title></title>
@ThomasJunk
ThomasJunk / 1.sql
Created July 22, 2021 12:11
Geoserver view
SELECT
b.id,
lower(b.validity) AS valid_from,
COALESCE(upper(b.validity), current_timestamp) AS valid_to,
b.bottleneck_id,
b.objnam,
b.nobjnm,
b.area,
b.rb,
@ThomasJunk
ThomasJunk / goproject.sh
Created June 25, 2021 11:55
Template for personal go projects
#!/bin/bash
WORKDIR=${PWD##*/}
MAINDIR="cmd/$WORKDIR"
mkdir -p "$MAINDIR"
MAIN=$(cat <<-EOF
package main
import "fmt"
@ThomasJunk
ThomasJunk / indexes.sql
Created April 17, 2020 06:12
Missing indexes
SELECT relname,
seq_scan - idx_scan AS too_much_seq,
CASE
WHEN seq_scan - idx_scan > 0
THEN 'Missing Index?'
ELSE 'OK'
END AS result,
pg_relation_size(relid::regclass) AS rel_size,
seq_scan,
idx_scan
python -c "import secrets;print(str(secrets.token_urlsafe(32)))"
#!/usr/bin/env bash
exec 2>&1 ./mingo
@ThomasJunk
ThomasJunk / index1.html
Last active July 30, 2019 08:07
svg2pdf
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title></title>
<meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
const pixelsPerMapMillimeter = resolution / 25.4; // resolution = resolution to print at
const mapSizeForPrint = [
Math.round(this.pdf.width * pixelsPerMapMillimeter), // 210 * resolution / DPI
Math.round(this.pdf.height * pixelsPerMapMillimeter)
];
...
const scale = 100
map.setSize(mapSizeForPrint);
const view = map.getView();
const proj = view.getProjection();