Skip to content

Instantly share code, notes, and snippets.

View hacker-bastl's full-sized avatar

Bastl hacker-bastl

View GitHub Profile
@hacker-bastl
hacker-bastl / verbose-charging.js
Created February 5, 2018 20:10
battery level audio output on Mac
#!/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
@hacker-bastl
hacker-bastl / bahn.sh
Created February 3, 2018 16:49
WIFIonICE token login automation
#!/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)