Skip to content

Instantly share code, notes, and snippets.

@toodooleedoo
Last active August 29, 2015 14:22
Show Gist options
  • Save toodooleedoo/749538f9da65dcd3045f to your computer and use it in GitHub Desktop.
Save toodooleedoo/749538f9da65dcd3045f to your computer and use it in GitHub Desktop.
#NODEJS #SHELL Convert Simplenote Notes to Laverna

#Convert a downloaded export from Simplenote and Import to Laverna

This is not very polished actually rather ugly. Was just used for a one time run however thought someone else would find this useful and maybe even convert it to NodeJS only and give it a little polish.

Don't plan on using unless your familiar with Linux and want to spend a little time.

Requires: NodeJS, Linux, Simplenote and Laverna Account Syncronized with Dropbox.

Instructions

  • From Simplenote select your name in the top right --> Download zip
  • Extract Zip to a linux box with NodeJS
  • Copy convert.js and convert.sh to the same directory
  • Run ./convert.sh
  • Copy produced .json files to Dropbox Storage eg Apps/Laverna/Notes
  • Refresh Laverna
  • Profit
fs = require('fs');
var sys = require("sys");
var title=process.argv[2]
var content=process.argv[3]
var id=process.argv[4]
var x = JSON.parse('{"id":"templateid","title":"templatetitle","content":"templatecontent","taskAll":0,"taskCompleted":0,"created":1433697542202,"updated":1433697545187,"notebookId":0,"tags":["NIX"],"isFavorite":0,"trash":0,"synchronized":0,"images":[],"redirect":true}')
x.id=id;
x.title=title;
x.content=content;
y = JSON.stringify(x)
console.log(y)
rm trash*.txt
for file in `ls *.txt`; do
SIMPLENOTE_FILE_NAME="${file%%.txt}"
LAVERNA_FILE_NAME="abd65ba9-c7e4-552f-ab30-${SIMPLENOTE_FILE_NAME}"
TITLE="`head -n1 ${SIMPLENOTE_FILE_NAME}.txt`"
CONTENT="`tail -n +2 ${SIMPLENOTE_FILE_NAME}.txt`"
z=`nodejs convert.js "${TITLE}" "${CONTENT}" "${LAVERNA_FILE_NAME}"`
echo "$z" > ${LAVERNA_FILE_NAME}.json
exit
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment