Skip to content

Instantly share code, notes, and snippets.

View maegnes's full-sized avatar

Magnus Buk maegnes

View GitHub Profile
@dnoegel
dnoegel / sungrow_modbus_register.tsv
Last active April 11, 2024 12:52
Modbus Register für Sungrow Wechselrichter zum Import in Iobroker
_address name description unit type len factor offset formula role room cw isScale
4999 Device type code Geräte Typ-Code int8be 1 1 0 value false false
5000 Nominal Output Power Installierte Leistung Kw uint16be 1 0.1 0 value false false
5002 Daily Output Energy Eigene Energienutzung heute (PV & Akku) Kwh uint16be 1 0.1 0 value false false
5003 Total Output Energy Eigene Energienutzung gesamt (PV & Akku) Kwh uint32sw 2 0.1 0 value false false
5007 Inside Temperature Temperatur im Wechselrichter °C int16be 1 0.1 0 value false false
5010 MPPT 1 Voltage MPPT1 Spannung V uint16be 1 0.1 0 value false false
5011 MPPT 1 Current MPPT1 Strom A uint16be 1 0.1 0 value false false
5012 MPPT 2 Voltage MPPT2 Spannung V uint16be 1 0.1 0 value false false
5013 MPPT 2 Current MPPT2 Strom A uint16be 1 0.1 0 value false false
@stuartlangridge
stuartlangridge / icloud-cal.php
Created January 26, 2016 22:49
PHP to fetch a calendar from iCloud with authentication and CalDAV
<?php
// get this data by logging into icloud.com on the calendars page and looking at the dev tools
// as per https://translate.google.com/translate?sl=de&tl=en&js=y&prev=_t&hl=de&ie=UTF-8&u=http%3A%2F%2Fnico-beuermann.de%2Fblogging%2Farchives%2F115-Zugriff-auf-iCloud-Kalender-mit-Thunderbird.html&edit-text=&act=url
$account = array(
'server' => '', // note, this will be p12 or something, not P0; see the server that iclod.com serves json from
'icloudid' => '', // the "dsid"
'appleid' => '', // your Apple ID; will be an email address
'pass' => '', // password for your Apple ID
'calid' => '' // the "pGuid"
@djm
djm / aws.lambda.upload.error.output
Last active July 4, 2020 07:19
Node Lambda Upload Error: "Cross-account pass role is not allowed"
Reading zip file to memory
Uploading zip file to AWS Lambda eu-west-1 with parameters:
{ FunctionName: 'xxx-staging-1-0-0',
FunctionZip: <Buffer 50 478 0b 00 ...>,
Handler: 'index.handler',
Mode: 'event',
Role: 'arn:aws:iam::xxx:role/xxx',
Runtime: 'nodejs',
Description: 'Resizes images for the xxx project.',
MemorySize: '512',
@YOUR1
YOUR1 / Darts.class.php
Created January 19, 2014 19:08
PHP Dart score calculater
<?php
/**
* PHP Dartgame calculating class
* @author Youri van den Bogert
*/
class Darts {
/**
* @var string
@sindresorhus
sindresorhus / post-merge
Last active February 14, 2024 06:20
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@tawfekov
tawfekov / generator.php
Last active March 2, 2024 16:06
Doctrine2 Generate Entities form Existing Database
<?php
include '../vendor/autoload.php';
$classLoader = new \Doctrine\Common\ClassLoader('Entities', __DIR__);
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Proxies', __DIR__);
$classLoader->register();
// config
$config = new \Doctrine\ORM\Configuration();
@basham
basham / nodejs-rfid.js
Last active July 17, 2023 04:06
Use NodeJS to read RFID ids through the USB serial stream.
/*
DESCRIPTION
-----------
Use NodeJS to read RFID ids through the USB serial stream. Code derived from this forum:
http://groups.google.com/group/nodejs/browse_thread/thread/e2b071b6a70a6eb1/086ec7fcb5036699
CODE REPOSITORY
---------------
https://gist.github.com/806605
@jakebellacera
jakebellacera / ICS.php
Last active April 19, 2024 09:06
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
<?php
/**
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*