Skip to main content

Migrate WordPress URLs to nginx (hexo)

· 2 min read

I have migrated my blog from WordPress to hexo, but the old URLs need to be permanently redirected. I'm using NGINX as my web server, so I set up some rules for redirecting the old posts to the new URLs. It's a bit tricky because WordPress used query string param for identifying the page, but it can be sorted out using if and the NGINX $arg_ variable. In order to generate these rules, I wrote a simple node script that runs through the exported Markdown files from WordPress. Markdown files were exported using Jekyll Exporter plugin.)

LosslessCut

· One min read

I needed a tool for quickly trimming recorded videos, so I built my first Electron app, check it out: https://mifi.github.io/lossless-cut/

Download links: https://github.com/mifi/lossless-cut/releases

It is a cross platform simple video editor for lossless trimming / cutting of videos using ffmpeg and Electron. Great for rough processing of large video files taken from a video camera, drone, etc. Lets you quickly get rid of the useless parts. It doesn't do any decoding / encoding and is therefore very fast and has no quality loss. Also allows for taking JPEG snapshots of the video at the selected time.

Extract GPS data from "Tracker" iOS app to GPS

· One min read

Quick script for extracting gps data from the Tracker GPS app

First export data from app com.eofster.tracker using something like iPhone Backup Extractor (http://supercrazyawesome.com/)

mkdir tracker-extract && cd tracker-extract

npm install csvtojson
npm install gps-to-gpx

(cd 'com.eofster.tracker/Library/Application Support/com.eofster.tracker' && sqlite3 -header -csv Tracker.sqlite "select * from ZTRACKPOINT order by ZTIMESTAMP;" > out.csv)

Create index.js:

var Converter = require("csvtojson").Converter;
var converter = new Converter({});

const createGpx = require('gps-to-gpx').default;

//end_parsed will be emitted once parsing finished
converter.on("end_parsed", function (jsonArray) {
//console.log(jsonArray);
const converted = jsonArray.map(pos => {
return {
latitude: pos.ZLATITUDE,
longitude: pos.ZLONGITUDE,
elevation: pos.ZALTITUDE,
time: new Date((pos.ZTIMESTAMP+978307200)*1000).toISOString()
};
});

const gpx = createGpx(converted, {
activityName: 'tur',
startTime: converted[0].time,
});

console.log(gpx);
});

//read from file
require("fs").createReadStream("out.csv").pipe(converter);

Run:

node . > out.gpx