Skip to content

Instantly share code, notes, and snippets.

@hdo
hdo / drs155m_log_20121206.log
Created December 7, 2012 09:03
Communication capture between application and energy meter via RS-485 (IEC62056-21)
Here is a short capture of a communication between the sample application and the energy meter using RS-485
Energy Meter: DRS110M, DRS155M (from http://www.bg-etech.de/)
/?!
/YTL:001511420144
[ACK]0:1
{SOH}P0{STX}(00000000){ETX}{BCC 0x60}[SOH]P1[STX]()[ETX][BCC 0x61]{SOH}B0{ETX}{BCC 0x75}[SOH]B0[ETX][BCC 0x71]
/?!
/YTL:001511420144
@hdo
hdo / gist:6027504
Last active December 13, 2023 23:20
import struct
import sys
import time
import json
from struct import *
from twisted.web import server, resource
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
from twisted.application.internet import MulticastServer
@hdo
hdo / startdisplay.sh
Created November 5, 2013 12:14
Script for displaying PNG on Kindle 4 NT
#!/bin/sh
while true
do
echo "clear display"
eips -c
eips -c
for i in 1 2 3 4 5 6 7 8 9 10 11 12
do
for i in 1 2 3 4 5 6 7 8 9 10 11 12
do
@hdo
hdo / dahua_squashfs_extract.py
Last active December 30, 2016 19:59
Extract Dahua uImage squashfs files
#!/usr/bin/env python
import os
import sys
def main(argv):
fname = ""
if len(argv) > 0:
fname = argv[0]
@hdo
hdo / gist:42fd73767ff8da4fb5f1
Last active August 29, 2015 14:06
ONVIF GetProfiles for Dahua IPC-HFW2100 with Firmware 2.2 (2013)
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:ns1="http://www.placeholder.org/ver10/tmp/schema" xmlns:ns2="http://www.placeholder.org/ver10/tmp/wsdl" xmlns:tae="http://www.onvif.org/ver10/actionengine/wsdl" xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:ter="http://www.onvif.org/ver10/error" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" xmlns:tmd="http://www.onvif.org/ver10/deviceIO/wsdl" xmlns:tns1="http://www.onvif.org/ver10/topics" xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsrf-bf="http://docs.oasis-open.org/wsrf/bf-2" xmlns:wsse="http://docs.oasis-open.o
@hdo
hdo / gist:e2c15e8bad284ca49c7e
Created September 3, 2014 07:39
ONVIF GetProfile for Dahua IPC-HFW4200S (Firmware 2.4)
<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:trt="http://www.onvif.org/ver10/media/wsdl" xmlns:tt="http://www.onvif.org/ver10/schema">
<s:Header />
<s:Body>
<trt:GetProfilesResponse>
<trt:Profiles token="MediaProfile000" fixed="true">
<tt:Name>MediaProfile_Channel1_MainStream</tt:Name>
<tt:VideoSourceConfiguration token="000">
<tt:Name>VideoSourceConfig_Channel1</tt:Name>
<tt:UseCount>2</tt:UseCount>
@hdo
hdo / gist:17576267445f87a59a23
Created September 4, 2014 12:42
MPlayer parallel hardware decoding test script
mplayer -v vdpau long.mp4 -geometry 480x270+0+0 &
mplayer -v vdpau long.mp4 -geometry 480x270+480+0 &
mplayer -v vdpau long.mp4 -geometry 480x270+960+0 &
mplayer -v vdpau long.mp4 -geometry 480x270+0+270 &
mplayer -v vdpau long.mp4 -geometry 480x270+480+270 &
mplayer -v vdpau long.mp4 -geometry 480x270+960+270 &
mplayer -v vdpau long.mp4 -geometry 480x270+0+540 &
mplayer -v vdpau long.mp4 -geometry 480x270+480+540 &
mplayer -v vdpau long.mp4 -geometry 480x270+960+540 &
@hdo
hdo / 99_myUtilsMuell.pm
Created October 14, 2014 12:39
FHEM Erweiterung für Statusanzeige (Entsorgungskalender)
### by Huy Do (huydo1@gmail.com
package main;
use strict;
use warnings;
use POSIX;
sub muelltonnen_Initialize($$)
{
@hdo
hdo / dahua_event_notification.txt
Created December 4, 2014 07:21
Event notification on Dahua Security Cams
Wichtig ist die Authentifizierung, sonst wird die Session sofort wieder abgebrochen!
TELNET:
GET /cgi-bin/eventManager.cgi?action=attach&codes=[VideoMotion,AlarmLocal] HTTP/1.0
User-Agent: Synology Surveillance Station
Authorization: Basic YWRtaW46YWRtaW4=
HTTP/1.0 200 OK
@hdo
hdo / 3461bs_module.cpp
Created January 5, 2015 12:28
Arduino code for controlling cheap china 7-segment led tube
#include <Arduino.h>
#define LED_PIN 13 // LED connected to digital pin 13
#define SW_PIN 10
#define CLOCK 7
#define LATCH 5
#define DATA 6
byte value[] ={ B11111001, // 1