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 / .gitignore
Last active September 19, 2023 12:33
Leaflet & webpack
dist/
node_modules/
@simon04
simon04 / en.yaml
Created February 4, 2020 14:15
node-polyglot for angularjs
---
navbar:
homepage: 'Navigate to the homepage'
user: 'Logged in as {{user}}'
load: 'Load {{smart_count}} item |||| Load {{smart_count}} items'
@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 / find-chocolatey-updates.py
Last active December 17, 2019 07:50
Lists outdated win_chocolatey versions of Ansible tasks/roles
import xml.etree.ElementTree as ET
import glob
import urllib.request
import yaml
from ansible.playbook.helpers import load_list_of_tasks
def get_latest_version(id):
url = f'https://chocolatey.org/api/v2/Packages()?$filter=(Id%20eq%20%27{id}%27)%20and%20IsLatestVersion'
xml = ET.parse(urllib.request.urlopen(url))
@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/'
@simon04
simon04 / colorful.ps1
Created May 24, 2019 12:01
Change Windows desktop background to random color
$r = (Get-Random -Maximum 255)
$g = (Get-Random -Maximum 255)
$b = (Get-Random -Maximum 255)
Set-ItemProperty "HKCU:\Control Panel\Colors" -Name Background -Value "$r $g $b"
@simon04
simon04 / generate_smt.py
Created May 11, 2019 19:34
Solving magic squares using SMT solving
# generates SMTLIB input for SMT solvers such as [MiniSmt](http://cl-informatik.uibk.ac.at/software/minismt/)
rows = range(1, 8)
cols = ['a', 'b', 'c', 'd', 'e', 'f', 'g']
def assert_sum(v, cells):
print(f':assumption (= {v} (+ {cells}))')
print('(benchmark none')
print(':logic QF_NIA')
@simon04
simon04 / distances.txt
Created February 3, 2019 21:30
Haltestellenabstände IVB aus OSM-Daten (https://www.openstreetmap.org/copyright, ODbL)
286 m route ("1 Bergisel – Mühlauer Brücke", 46 members)
0 m Bergisel
355 m Stubaitalbahnhof
389 m Fritz-Konzert-Straße
296 m Westbahnhof
319 m Franz-Fischer-Straße
295 m Maximilianstraße
318 m Bürgerstraße
242 m Terminal Marktplatz
306 m Maria-Theresien-Straße
@simon04
simon04 / README.md
Last active January 4, 2019 15:34
Google Truth extension for XMLUnit

This provides a Google Truth extension for XMLUnit in order to allow to compare XML documents in unit tests.

XmlSubject.assertThat("<a><b foo='1' bar='2'></b></a>")
        .isTheSameXmlAs("<a><b bar='2' foo='1'/></a>");
@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;