Skip to content

Instantly share code, notes, and snippets.

View simon04's full-sized avatar

Simon Legner simon04

  • Innsbruck, Austria
View GitHub Profile
@simon04
simon04 / plotly_schema_to_java.js
Created June 6, 2018 07:58
Convert Plot.ly schema to Java POJOs
const schema = JSON.parse(require('fs').readFileSync('dist/plot-schema.json'));
generate("layout", schema.layout.layoutAttributes);
generate("scatter", schema.traces.scatter.attributes);
generate("annotations", schema.layout.layoutAttributes.annotations);
generate("shapes", schema.layout.layoutAttributes.shapes);
function generate(key, value, indent = 0) {
if (key[0] === '_') {
return;
@simon04
simon04 / PngjWriter.java
Last active March 27, 2018 14:28
PngjWriter
import ar.com.hjg.pngj.FilterType;
import ar.com.hjg.pngj.ImageInfo;
import ar.com.hjg.pngj.ImageLineByte;
import ar.com.hjg.pngj.PngWriter;
import ar.com.hjg.pngj.PngjException;
import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;
import java.awt.image.Raster;
import java.awt.image.SinglePixelPackedSampleModel;
@simon04
simon04 / buble-loader.js
Created February 28, 2018 16:25
Minimal buble-loader supporting webpack 4
/* eslint-env node */
const buble = require('buble');
const loaderUtils = require('loader-utils');
const path = require('path');
module.exports = function BubleLoader(source) {
this.cacheable && this.cacheable();
const options = Object.assign({transforms: {modules: false}}, loaderUtils.getOptions(this));
const transformed = buble.transform(source, options);
@simon04
simon04 / Java 8.txt
Last active August 2, 2020 10:06
ISO-8601 for IntelliJ
openjdk version "1.8.0_144"
OpenJDK Runtime Environment (build 1.8.0_144-b01)
OpenJDK 64-Bit Server VM (build 25.144-b01, mixed mode)
12/21/17
ar 21/12/17
ar_AE 21/12/17
ar_BH 21/12/17
ar_DZ 21/12/17
ar_EG 21/12/17
#!/bin/sh
set -e
# setup ssh-agent and provide the GitHub deploy key
eval "$(ssh-agent -s)"
openssl aes-256-cbc -K $encrypted_dc4c0df7bb33_key -iv $encrypted_dc4c0df7bb33_iv -in id_ed25519.enc -out id_ed25519 -d
chmod 600 id_ed25519
ssh-add id_ed25519
# commit the assets in build/ to the gh-pages branch and push to GitHub using SSH
#! /bin/bash
cd $(dirname $0)
verLocal=$(cat josm_version)
verRemote=$(wget -qO - http://josm.openstreetmap.de/latest)
echo local $verLocal remote $verRemote
if [ $verLocal -lt $verRemote ]; then
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@simon04
simon04 / Caddyfile
Last active January 11, 2022 07:44
Nextcloud via Docker and Caddy
# /etc/caddy/Caddyfile
cloud.example.com {
root /srv/http/nextcloud/
fastcgi / localhost:7070 php {
root /var/www/html/
}
timeouts 30m
}
@simon04
simon04 / Interval.java
Last active February 2, 2024 15:36
Migrating from Joda Time to Java 8 JSR 310
import com.google.common.collect.Range;
import java.time.Duration;
import java.time.Instant;
import java.time.Period;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeParseException;
import java.time.temporal.TemporalAmount;
import java.util.Objects;
<?xml version="1.0" encoding="UTF-8"?>
<!-- Using optional BOM (0xEF 0xBB 0xBF) -->
<!-- From http://forum.openstreetmap.org/viewtopic.php?id=7186 -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://openstreetmap.org/osm/0.6"
xmlns="http://openstreetmap.org/osm/0.6">
<xs:element name="osm">
<xs:complexType>
<xs:sequence>