Skip to content

Instantly share code, notes, and snippets.

View epaulsen's full-sized avatar

Erling Paulsen epaulsen

  • Kristiansand, Norway
  • X @erlpa
View GitHub Profile
@epaulsen
epaulsen / sparse.ps1
Created February 26, 2025 12:12
SparseCheckout
Write-Host "AI-platform sparse checkout setup"
Write-Host "This will configure a new subfolder under the current folder to only contain a single application from the AI-platform repository."
Write-Host "This will also configure the folder to only pull the files for that application."
Write-Host "Folder willl be created in the current directory. If you want to create it elsewhere, please navigate to the desired location before running this script."
Write-Host ""
$folder = Read-Host -Prompt "Enter the name of the application you want to this repo for(case-sensitive)"
# Create folder and navigate to it
md $folder
@epaulsen
epaulsen / botton-card.yml
Created November 15, 2023 16:49
Button-card og gridview med husmodus
- square: false
columns: 3
type: grid
cards:
- type: custom:button-card
entity: input_text.husmodus
icon: mdi:sun-clock
color_type: card
aspect_ratio: 1/0.5
color: var(--card-background-color)
- name: "Duggpunkt bad oppe"
icon: "mdi:thermometer"
unit_of_measurement: "°C"
state: >
{%set fuktighet = states('sensor.temperatur_bad_oppe_humidity') | float(0) %}
{%set temp = states('sensor.temperatur_bad_oppe_temperature') | float(0) %}
{%set x = (log(fuktighet/100) + (17.625 * temp)) / (243.04 + temp)%}
{{ ((243.04 * x) / (17.625 - x)) | round(2)}}
[
{
"id": "b89fb45572d6615c",
"type": "link in",
"z": "c47a770c26e3be71",
"name": "ChatGPTRandom",
"links": [],
"x": 85,
"y": 580,
"wires": [
@epaulsen
epaulsen / flows.json
Created March 7, 2023 12:19
Workaround for node-red overwriting linkSource object on linked calls
[
{
"id": "3c403b0fd8ac9f67",
"type": "api-current-state",
"z": "c47a770c26e3be71",
"name": "Get price from Nordpool",
"server": "72b5aa9aa9eb914e",
"version": 3,
"outputs": 1,
"halt_if": "",
@epaulsen
epaulsen / configuration.yaml
Created March 6, 2023 19:04
Binary sensor based om attributes from climate entity
binary_sensor:
- platform: template
sensors:
heating_status:
friendly_name: "Heating Status YOUR CLIMATE ENTITY"
value_template: >
{% if state_attr('climate.YOUR_CLIMATE_ENTITY_HERE','hvac_action') == 'heating' %}
on
{% else %}
off
@epaulsen
epaulsen / DateTime.cs
Created March 2, 2021 14:14
DateTime.UtcNow decompiled
/// <summary>Gets a <see cref="T:System.DateTime" /> object that is set to the current date and time on this computer, expressed as the Coordinated Universal Time (UTC).</summary>
/// <returns>An object whose value is the current UTC date and time.</returns>
[__DynamicallyInvokable]
public static DateTime UtcNow
{
[SecuritySafeCritical, __DynamicallyInvokable] get
{
if (!DateTime.s_isLeapSecondsSupportedSystem)
return new DateTime((ulong) (DateTime.GetSystemTimeAsFileTime() + 504911232000000000L | 4611686018427387904L));
DateTime.FullSystemTime time = new DateTime.FullSystemTime();