Code Monkey home page Code Monkey logo

runs-to-gadgetfund's Introduction

Runs to gadget fund

What does it do?

graphical overview

This script will convert the kilometers you run and track with endomondo, into payments from (eg.) your savings account to (eg.) a gadget fund to incentivise yourself to run more!

Requirements

  • python 2.7
  • and python 3.6
  • endomondo
  • a bunq premium bank account (bunq.com)
  • sqlite3 installed on your machine

Setup

First clone this repository to your computer or server

git clone [email protected]:KReusen/runs-to-gadgetfund.git

We're going to use a custom python api created by Github user isoteemu. To be able to make use of it, cd into the runs-to-gadgetfund folder and run:

git clone --depth 1 [email protected]:isoteemu/sports-tracker-liberator.git endomondo

The endomondo api sdk is written in Python 2.7, whereas the bunq api is written in Python 3.6. Time to create two seperate virtual environments. Cd into the runs-to-gadgetfund folder and run:

virtualenv venv
python3 -m venv venv3

Temporarily activate the python 3.6 environment to install the bunq sdk:

source venv3/bin/activate
pip install bunq_sdk --upgrade
deactivate

Open config.py, change the folder_path and follow the instructions over there to complete the setup.

Then open gadgetfund.sh and change the paths to the path on your machine.

Lastly, make gadgetfund.sh executable:

chmod +x gadgetfund.sh

Running it

In order to run the script, simply use the following command:

sh gadgetfund.sh

This will automatically acitvate and deactivate a python 2.7 environment that executes fetch_runs.py and will afterwards activate and deactivate a python 3.6 environment that executes process_runs.py.

Running it every 15 minutes

Open crontab:

sudo crontab -e

and paste the following line at the bottom. Change the path with the path on your machine.

*/15 * * * * /home/gadgetfund/gadgetfund.sh >> /home/gadgetfund/log.log $

If you want to test if the cron is working, you can initially replace the 15 in the line above with 1 to make it execute every minute. You can find the execution logs in log.log

runs-to-gadgetfund's People

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.