This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
// https://nodejs.org/api/child_process.html | |
const child_process = require('child_process'); | |
child_process.spawn('/usr/bin/pmset', ['-g', 'pslog']) | |
.stdout.on('data', function(chunk) { | |
// parse battery info from pmset output stream | |
var verbose_output = [/(\d+%)/, /(\d+:\d+)\ remaining/] | |
.filter(function(expression) { | |
// output contains battery info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# change this to the MAC of your device | |
MAC="XX:XX:XX:XX:XX:XX" | |
# get the CSRF token required for login | |
TOKEN=$(curl --silent --cookie COOKIE --cookie-jar COOKIE 'http://login.wifionice.de/de/' | grep CSRFToken | cut -d '"' -f 12) |