Skip to content

Instantly share code, notes, and snippets.

View gloriouslyawkwardlife's full-sized avatar

Steven Buehler gloriouslyawkwardlife

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gloriouslyawkwardlife
gloriouslyawkwardlife / dailynotebookmaker.wl
Last active October 22, 2024 15:18
Wolfram Language - Create Daily Log Notebook
ExternalEvaluate[{"Python",
"Evaluator" -> <|
"PythonRuntime" -> File["/opt/homebrew/bin/python3.12"]|>},
File["/Users/steven/Library/Mobile \
Documents/com~apple~CloudDocs/Scripts/Python/datacollection.py"]];
dbr = DatabaseReference[
URL["mysql://xxx:[email protected]/\
personalinformatics"]];
accessToken =
"xxx";
@gloriouslyawkwardlife
gloriouslyawkwardlife / datacollection.py
Created October 22, 2024 14:41
Python code I use to pull my data sources into MariaDB for my Daily Log creation. 'xxxx' indicates values to be provided by the end-user.
#!/usr/bin/env python3.12
import pandas as pd
import sqlalchemy
import requests as r
from datetime import datetime, timedelta
import xml.etree.ElementTree as et
import zipfile
import json
@gloriouslyawkwardlife
gloriouslyawkwardlife / bouncie.wl
Last active September 9, 2024 15:56
Wolfram Language: Create a daily map from Bouncie API webhook data
(*
Requires creation of a webhook on https://bouncie.dev to post to an Apache CouchDB database exposed to the Internet.
Substitute '6984' as the port number if you prefer a secure connection after setting up SSL according to the Apache
CouchDB Instructions.
The 'tripData' view used here to retrieve just tripData entries is as follows in CouchDB:
function (doc) {
if (doc.eventType == 'tripData')
emit(doc.data, null);
@gloriouslyawkwardlife
gloriouslyawkwardlife / Faceboook_to_DayOne2.ps1
Last active January 6, 2024 18:27
Retrieves Facebook history as entries into the Mac version of DayOne
#!/usr/local/bin/pwsh
$access_token="<INSERT FACEBOOK ACCESS TOKEN HERE: https://developers.facebook.com/tools/accesstoken/"
$data = invoke-restmethod "https://graph.facebook.com/v18.0/me/posts?fields=title,application,backdated_time,caption,child_attachments,id,coordinates,created_time,description,event,full_picture,message,name,object_id,parent_id,place,scheduled_publish_time,status_type,story,type,updated_time,attachments,comments,link,permalink_url,reactions&limit=100&access_token=$access_token" -ErrorAction Stop
while ($true) {
foreach ($p in $data.data) {
if ($p.backdated_time -ne $null) {
$posttime = $p.backdated_time.toString('s').replace('T', ' ')
}
else {