the first time after boot, start a new tmux session:
tmux(it's working if your shell has a green bar at the bottom)
| import math | |
| import bpy | |
| def add_infinite_background(coll_name = None): | |
| mesh = bpy.data.meshes.new("InfiniteBackground") | |
| obj = bpy.data.objects.new(mesh.name, mesh) | |
| col = bpy.data.collections.get("Collection") | |
| col.objects.link(obj) | |
| bpy.context.view_layer.objects.active = obj |
| EC2_NAME = "x1.32xlarge" | |
| # https://stackoverflow.com/a/55109870/979255 | |
| def get_uptime(): | |
| with open('/proc/uptime', 'r') as f: | |
| uptime_seconds = float(f.readline().split()[0]) | |
| return uptime_seconds | |
| #!/usr/bin/env python | |
| import subprocess | |
| import sys | |
| if len(sys.argv) > 1: | |
| subprocess.check_output("amixer sset 'PCM' {}%".format(sys.argv[1]), shell=True) | |
| else: | |
| print(subprocess.check_output("amixer get 'PCM' | grep '%'", shell=True).split()[3].strip('[]')) |
Access REST endpoints in "object" dot-notation and pandas-like index-notation in Python.
Example usage:
Posts = RemoteDataProvider(
list_all=lambda: requests.get("https://jsonplaceholder.typicode.com/posts").json(),
get_one=lambda x: requests.get(f"https://jsonplaceholder.typicode.com/post/{x}").json(),
)