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 / git.sh
Created January 14, 2020 07:16
Git merge/replace orphan branch into master
git checkout --orphan new-framework
# completely rewrite your application in new framework
git merge --strategy=ours --allow-unrelated-histories master
git commit-tree -p HEAD^2 -p HEAD^1 -m "Merge branch 'new-framework'" "HEAD^{tree}"
git reset --hard $OUTPUT_FROM_PREVIOUS_COMMAND
git checkout master
git merge --ff-only new-framework
@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;
@simon04
simon04 / jira2gitlab.py
Last active January 26, 2024 01:34 — forked from Gwerlas/jira2gitlab.py
Migrate Jira issues to Gitlab
#!/usr/bin/env python2
import requests
from requests.auth import HTTPBasicAuth
import re
from StringIO import StringIO
import uuid
# Inspired from https://gist.github.com/toudi/67d775066334dc024c24
# Tested on Jira 7.4 and Gitlab 2.2 with Python 2.7
JIRA_URL = 'https://your-jira-url.tld/'
> neofetch
             .',;::::;,'.                simon@simon-ssd
         .';:cccccccccccc:;,.            ---------------
      .;cccccccccccccccccccccc;.         OS: Fedora Linux 39 (Workstation Edition) x86_64
    .:cccccccccccccccccccccccccc:.       Kernel: 6.5.11-300.fc39.x86_64
  .;ccccccccccccc;.:dddl:.;ccccccc;.     Uptime: 10 days, 9 hours, 40 mins
 .:ccccccccccccc;OWMKOOXMWd;ccccccc:.    Packages: 2938 (rpm)
.:ccccccccccccc;KMMc;cc;xMMc:ccccccc:.   Shell: fish 3.6.1
,cccccccccccccc;MMM.;cc;;WW::cccccccc,   Terminal: /dev/pts/0
@simon04
simon04 / Application.java
Last active September 29, 2023 08:06
Lightweight REST API using Jersey on embedded Jetty server
package root;
import root.resources.HelloResource;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.servlet.ServletContainer;
public class Application {
@simon04
simon04 / .gitignore
Last active September 19, 2023 12:33
Leaflet & webpack
dist/
node_modules/
@simon04
simon04 / MapCSS.peggy
Last active April 10, 2023 21:56
MapCSS grammar written for @peggyjs (a parser generator for JavaScript)
/*
* Parser definition for the main MapCSS parser:
*
* <pre>
*
* rule
* _______________________|______________________________
* | |
* selector declaration
* _________|___________________ _________|____________
@simon04
simon04 / index.html
Created June 9, 2021 11:50
Leaflet example using JavaScript modules
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
rel="stylesheet"
href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
/>
</head>
@simon04
simon04 / leaflet-fullscreen-control.js
Created February 2, 2023 12:06
A Leaflet Control, to request fullscreen for map (no CSS, no image)
/**
* A Leaflet Control, to request fullscreen for map (no CSS, no image)
*
* @example new FullscreenControl({ position: "topleft" }).addTo(map);
*/
export class FullscreenControl extends L.Control {
onAdd() {
const container = L.DomUtil.create("div", " leaflet-bar");
const link = L.DomUtil.create("a", undefined, container);
link.innerHTML = "⛶";