Skip to content

Instantly share code, notes, and snippets.

View indisoluble's full-sized avatar

Enrique de la Torre indisoluble

View GitHub Profile
@indisoluble
indisoluble / label_heart_rates.py
Created December 11, 2016 02:10
CSV: <Time>,<BeatsPerMinute> => CSV: <Time>,<BeatsPerMinute>,<WorkingOut>
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Given:
- CSV file with path: <INPUT_DIR>/heartRate-<YYYYMMDD>.csv
- First line of CSV file: <COLUMN_TIME>,<COLUMN_HEARTRATE>
- Rest of the lines: <Timestamp with format YYYY-MM-DD HH:mm:ss>,<Beats per minute>
Then:
- Create a new CSV file in: <OUTPUT_DIR>/heartRate-<YYYYMMDD>.csv
@indisoluble
indisoluble / ViewController.swift
Last active December 10, 2016 22:21
Simple VC to retrieve all heart rate records in an iPhone and store them in CSV files
/*
Steps:
1. Create a new project using template: 'Single View Application'.
2. Enable HealthKit capabilities for the app.
3. Add these properties to 'Info.plist':
- 'NSHealthShareUsageDescription'
- 'NSHealthUpdateUsageDescription'
4. Copy & paste the content of this file into 'ViewController.swift'.
4. Run the app in your iPhone.
5. Using Xcode, download the container for this app.
@indisoluble
indisoluble / connman_agent.py
Last active November 29, 2016 14:45
Simple Web Server (based on CherryPy) to configure Internet Connection (based on Connman + Pyconnman)
#!/usr/bin/python
# Imports
from argparse import ArgumentParser
from gi.repository import GObject
import connman_shared as shared
import dbus.mainloop.glib
import pyconnman
@indisoluble
indisoluble / nc_server.sh
Last active December 8, 2016 11:26
Netcat Web Server: Listen connections on specified port, print requests & response with a 200 OK
#!/bin/bash
echo "Listening port: $1"
while true;
do echo "=====>";
echo -e 'HTTP/1.1 200 OK\r\n' | sudo nc -l $1;
echo "";