Download from geonames (updated regularly)
curl https://download.geonames.org/export/zip/SE.zip > SE.zip
unzip SE.zip
Download from geonames (updated regularly)
curl https://download.geonames.org/export/zip/SE.zip > SE.zip
unzip SE.zip
import asyncio | |
import logging | |
# Import the device class from the component that you want to support | |
from homeassistant.core import callback | |
from homeassistant.components import light | |
from homeassistant.const import (STATE_OFF, STATE_ON, SERVICE_TURN_ON, | |
SERVICE_TURN_OFF, ATTR_ENTITY_ID) | |
from homeassistant.components.light import (SUPPORT_BRIGHTNESS, | |
SUPPORT_RGB_COLOR, |
#!/bin/bash | |
# | |
# Get the mac address for a certain host. | |
# | |
# Requires ping and arp tool. | |
# | |
# Usage: | |
# get_mac_address HOSTNAME | |
# |
FROM ubuntu as builder | |
ENV CC=gcc-8 | |
ENV CXX=g++-8 | |
RUN apt-get update && apt-get install -y \ | |
software-properties-common &&\ | |
add-apt-repository -y \ | |
ppa:ubuntu-toolchain-r/test &&\ |
Control the number of mining cores on xmrig from home assistant. The script calls the http interface on xmrig and sets the number of cores used for mining with cn-pico
algorithm. Feel free to edit to your usecase.
Put __init__.py
file in <homeassistant_root>/custom_components/xmrig/__init__.py
Then add the following to your configuration.yaml
xmrig:
host: <host>
port:
import libdatachannel from 'node-datachannel'; | |
const do_nothing = (..._) => { }; | |
const decorate_channel = channel => { | |
Object.defineProperty(channel, "readyState", { | |
get: function () { | |
return channel.isOpen() ? 'open' : 'closed' | |
} | |
}); | |
Object.defineProperty(channel, "label", { |
#!/bin/bash | |
date "+%Y-%m-%d %H:%M:%S" | |
sudo sh -c 'truncate -s 0 $(docker system info 2> /dev/null | grep "Docker Root Dir" | cut -d ":" -f2 | cut -d " " -f2-)/containers/*/*-json.log'; |
#! /usr/bin/env node | |
// For info about hdr transcoding, go here: | |
// https://codecalamity.com/encoding-uhd-4k-hdr10-videos-with-ffmpeg/ | |
// | |
// This script takes a hdr video and returns a string for x265 encoder with the correct light levels like this: | |
// "hdr-opt=1:repeat-headers=1:colorprim=bt2020:transfer=smpte2084:colormatrix=bt2020nc:master-display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(11000000,0):max-cll=0,0" | |
// | |
const proc = require('child_process'); |
#!/usr/bin/env bash | |
bash -c "[ $(cat /proc/meminfo | grep MemAvailable | awk '{ printf("%d", $2 < 65536) }') == '1' ] && reboot" |