Skip to content

Instantly share code, notes, and snippets.

View ekwoodrich's full-sized avatar

Eliot Woodrich ekwoodrich

View GitHub Profile
@667bdrm
667bdrm / ipcam-clock-set.pl
Last active September 10, 2022 16:54
Simple clock synchronization for some chinese DVRs supporting CMS with json-like protocol. Includes some other API commands. Fork at https://gitlab.com/667bdrm/sofiactl
#!/usr/bin/perl
# latest release at https://gitlab.com/667bdrm/sofiactl
#
# Simple clock synchronization for some chinese HiSilicon based DVRs supporting CMS (Sofia software) with json-like protocol. Tested with:
#
# HJCCTV HJ-H4808BW (XiongMai, Hi3520, MBD6304T)
# http://www.aliexpress.com/item/Hybird-NVR-8chs-H-264DVR-8chs-onvif-2-3-Economical-DVR-8ch-Video-4-AUDIO-AND/1918734952.html
#
#
@paradite
paradite / paste.js
Last active January 24, 2023 10:48
intercept paste and do formatting in JavaScript (in Angular.js)
// tested in Chrome and Firefox
this.onPaste = function (event) {
if($(event.target).is(':focus')) {
// actually typing on the element, stop paste progation to outside paste handler
event.stopPropagation();
// intercept paste and format the text
event.preventDefault();
var newText = (event.originalEvent || event).clipboardData.getData('text/plain');
newText = newText.replace(/\r?\n/g, ' ');