Skip to content

Instantly share code, notes, and snippets.

View serpent213's full-sized avatar

Steffen Beyer serpent213

  • 213tec
  • Germany
View GitHub Profile
@serpent213
serpent213 / 1_node-red-contrib-home-assistant-websocket.diff
Last active January 22, 2024 09:08
Custom module for NodeRED via dream2nix
diff --git a/heimchen/flake.nix b/heimchen/flake.nix
index d8638c3..fd34ad5 100644
--- a/heimchen/flake.nix
+++ b/heimchen/flake.nix
@@ -13,9 +13,12 @@
nixvim.url = "github:nix-community/nixvim/nixos-23.11";
nixvim.inputs.nixpkgs.follows = "nixpkgs";
+
+ dream2nix.url = "github:nix-community/dream2nix";
@serpent213
serpent213 / disk-config.nix
Created August 23, 2023 12:44
Nix disko config for Hetzner dedicated
# disko config for Hetzner dedicated
# matching grub config:
#
# boot.loader.grub = {
# devices = [ "/dev/nvme0n1" "/dev/nvme1n1" ];
# efiSupport = true;
# efiInstallAsRemovable = true;
# };
@serpent213
serpent213 / simple_pipeline.ex
Created August 2, 2023 14:12
SimplePipeline exploration
defmodule Membrane.Demo.SimplePipeline do
@moduledoc """
Sample Membrane pipeline that will play an `.mp3` file.
## Example
iex> Membrane.Demo.SimplePipeline.start_link(path_to_mp3: "demo.mp3")
iex> Membrane.Pipeline.terminate(Membrane.Demo.SimplePipeline)
"""
@serpent213
serpent213 / scanproof.rb
Last active April 5, 2021 08:20
Chia log analyser
#!/usr/bin/env ruby
# Scans Chia logfiles for gaps in challenge processing and gathers some stats.
# Resolution is 1 minute, log level needs to be set to INFO at least.
require 'date'
LOGDIR = '~/.chia/mainnet/log'
Dir.chdir(File.expand_path(LOGDIR))
@serpent213
serpent213 / chronograf.flux
Created March 20, 2021 11:29
Chia farming rewards in Telegraf/InfluxDB/Chronograf
from(bucket: "SpaceBucket")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "chia_farmed_amount")
|> filter(fn: (r) => r["_field"] == "farmed_amount")
|> map(fn: (r) => ({
r with
_value: r._value / 1000000000000.0
})
)
|> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)
% ray stop -v !10103
Send termination request to `/Users/sonnenbloom/opt/anaconda3/envs/rootshuffle/lib/python3.7/site-packages/ray/core/src/ray/raylet/raylet --raylet_socket_name=/tmp/ray/session_2020-09-23_13-12-25_470404_34955/sockets/raylet --store_socket_name=/tmp/ray/session_2020-09-23_13-12-25_470404_34955/sockets/plasma_store --object_manager_port=0 --min_worker_port=10000 --max_worker_port=10999 --node_manager_port=57276 --node_ip_address=192.168.213.26 --redis_address=192.168.213.26 --redis_port=6379 --num_initial_workers=8 --maximum_startup_concurrency=8 --static_resource_list=node:192.168.213.26,1.0,CPU,8,memory,88,object_store_memory,30 --config_list=plasma_store_as_thread,True "--python_worker_command=/Users/sonnenbloom/opt/anaconda3/envs/rootshuffle/bin/python /Users/sonnenbloom/opt/anaconda3/envs/rootshuffle/lib/python3.7/site-packages/ray/workers/default_worker.py --no
@serpent213
serpent213 / ray_intervals.py
Last active September 23, 2020 10:31
Ray interval playground
#!/usr/bin/env python3
import asyncio
import logging
import ray
import time
@ray.remote
class Worker():
@serpent213
serpent213 / phone.py
Created December 9, 2018 19:02
phone number validation (regex)
#!/usr/bin/env python
import re
def isPhoneNumberRegEx(text):
return bool(re.match(r'^\d{3}-\d{3}-\d{3}$', text))
print('666 666 666 is a phone number: ')
print(isPhoneNumberRegEx('666-666-666'))
print('Moshi moshi is a phone number')
@serpent213
serpent213 / phone.py.diff
Created December 9, 2018 18:52
phone.py diff
--- phone.orig.py 2018-12-09 19:51:18.000000000 +0100
+++ phone.py 2018-12-09 19:46:12.000000000 +0100
@@ -1,23 +1,25 @@
+#!/usr/bin/env python
+
def isPhoneNumber(text):
if len(text) != 11:
return False
for i in range(0,3):
@serpent213
serpent213 / phone.py
Created December 9, 2018 18:47
validate phone number
#!/usr/bin/env python
def isPhoneNumber(text):
if len(text) != 11:
return False
for i in range(0,3):
if not text[i].isdigit():
return False