Skip to content

Instantly share code, notes, and snippets.

View mipapo's full-sized avatar

Michael Pohl mipapo

View GitHub Profile
@mipapo
mipapo / keybase.md
Created June 18, 2019 09:21
keybase.md

Keybase proof

I hereby claim:

  • I am mipapo on github.
  • I am mipapo (https://keybase.io/mipapo) on keybase.
  • I have a public key ASDohUCyDNMqWEMVAQDmfTyC6WnkpKjAMRN3jopRzC81Pgo

To claim this, I am signing this object:

@mipapo
mipapo / remove-same-xliff.py
Created March 14, 2019 16:09
xliff-remove trans-unit where source=target
#!/usr/bin/python2
from lxml import etree
from StringIO import StringIO
import sys
file = str(sys.argv[1])
NS = {'x':'urn:oasis:names:tc:xliff:document:1.2'}
Version20170907133700
Version20171103195530
Version20171201214532
Version20171217215800
Version20171217215801
Version20171225193117
Version20180113231353
Version20180116214552
Version20180118193118
@mipapo
mipapo / runalyzequeue.service
Created March 19, 2017 11:13
Runalyze Queue
[Unit]
Description=RUNALYZE queue
After=network.target
[Service]
Type=simple
User=www-data #adjust the user
WorkingDirectory=/var/www/example.runalyze.com/htdocs/
ExecStart=/usr/bin/php /var/www/example.runalyze.com/htdocs/bin/console runalyze:queue:consume --env=prod
Restart=always
#!/bin/bash
tables=(account activity_equipment activity_tag conf dataset equipment equipment_sport equipment_type hrv plugin plugin_conf raceresult route sport swimdata tag trackdata training type user weathercache)
for i in ${tables[@]}; do
mysqldiff --server1=<user>:<pw>@localhost --server2=<user>:<pw>@localhost dbcheck1.runalyze_${i}:dbcheck2.runalyze_${i}
done
@mipapo
mipapo / gist:85a611faccad0f37b556319be11bdc48
Created July 19, 2016 12:25
Importing germany-latest OSM
osm2pgsql -c -d gis --slim germany-latest.osm
24GiB RAM
Intel(R) Core(TM) i5-2500 CPU @ 3.30GHz (4x)
Node stats: total(246102132), max(4306413897) in 1002s
Way stats: total(39447147), max(431445662) in 2087s
Relation stats: total(530858), max(6417662) in 1982s
Committing transaction for planet_osm_point
Committing transaction for planet_osm_line
Committing transaction for planet_osm_polygon
@mipapo
mipapo / referrer-stats.sh
Created January 6, 2016 10:03
Apache Log Referrer Stats (Just domains)
grep "200 " /var/log/apache2/access.log \
| cut -d '"' -f 4 \
| cut -d '#' -f 1 \
| cut -d '?' -f 1 \
| cut -d '/' -f 3 \
| sort \
| uniq -c \
| sort -rn \
| less
@mipapo
mipapo / switch-accountid-to-1.sql
Last active November 12, 2015 06:48
switch-accountid-to-1.sql
-- Statements to set `accountid` to '1' everywhere (you may need to use your own prefix)
--
-- RUNALYZE v2.2+ requires even single-user installations to have a real account
DELETE FROM `runalyze_clothes` WHERE `accountid`='1';
DELETE FROM `runalyze_conf` WHERE `accountid`='1';
DELETE FROM `runalyze_dataset` WHERE `accountid`='1';
DELETE FROM `runalyze_plugin` WHERE `accountid`='1';
DELETE FROM `runalyze_route` WHERE `accountid`='1';
DELETE FROM `runalyze_shoe` WHERE `accountid`='1';
DELETE FROM `runalyze_sport` WHERE `accountid`='1';
@mipapo
mipapo / bulk-trainingstagebuch.js
Created October 25, 2015 17:04
Bulk download trainingstagebuch.org
for(var i=0; i<l.length; i++) {
if( l[i].href.indexOf('http://trainingstagebuch.org/workouts/show/') >= 0){
var newFrame = document.createElement('iframe');
document.body.appendChild(newFrame);
newFrame.style = 'width: 1px; height: 1px;';
link = 'http://trainingstagebuch.org/map/export/'+l[i].href.replace('http://trainingstagebuch.org/workouts/show/','')+'?view=gpx';
console.log(link);
newFrame.src = link;
}
}
@mipapo
mipapo / Bulk download garmin connect
Last active October 16, 2015 09:31
Bulk download garmin conenct ( currently only one page)
function dlgc() { var boxes = document.getElementsByClassName('activityNameLink'),
i = boxes.length;
while(i--) {
var newFrame = document.createElement('iframe');
document.body.appendChild(newFrame);
newFrame.style = 'width: 1px; height: 1px;';
link = 'https://connect.garmin.com/proxy/download-service/files/activity/'+boxes[i].href.replace('https://connect.garmin.com/activity/', '');
newFrame.src = link;
}}