This file contains hidden or 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
import math | |
# Get this value by reading msr 0x606 | |
rapl_power_unit_value = 0x330A0E08 | |
# pkg_pl_value = 0x860000DD8600 | |
# Extract the power unit values | |
# Power units are in bits 3:0 | |
power_units = pow(0.5, (rapl_power_unit_value & 0xF)) | |
time_units = pow(0.5, ((rapl_power_unit_value & 0xF0) >> 8)) |
This file contains hidden or 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 python3 | |
import subprocess | |
import plistlib | |
import time | |
def send_notification(title, message, sound=None): | |
command = 'display notification "{}" with title "{}" sound name "{}"'\ | |
.format(message, title, sound) \ |
This file contains hidden or 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 | |
API="https://api.open-meteo.com/v1/forecast?latitude=35.6895&longitude=139.69171¤t=temperature_2m,relative_humidity_2m,apparent_temperature,is_day,precipitation,cloud_cover,wind_speed_10m,wind_direction_10m,wind_gusts_10m&timezone=Asia%2FBangkok&forecast_days=1" | |
curl --max-time 2 -s $API | | |
jq -r '"It'"'"'s currently " | |
+ (.current.temperature_2m | tostring) | |
+ (.current_units.temperature_2m | tostring) + | |
" with " | |
+ (.current.relative_humidity_2m | tostring) |
OlderNewer