Skip to content

Instantly share code, notes, and snippets.

View MoLow's full-sized avatar

Moshe Atlow MoLow

  • tuvis.com
  • Israel
  • 09:52 (UTC +03:00)
View GitHub Profile
@MoLow
MoLow / climate.yaml
Created March 27, 2020 13:14
ha automations
automation:
- id: remind_turning_off_ac
alias: remind_turning_off_ac
trigger:
- platform: state
entity_id:
- climate.parents
- climate.living_room
- climate.study
- climate.mamad
@MoLow
MoLow / Dockerfile
Created January 26, 2020 15:12
NUT UPS for Home Assistant
FROM alpine:3.10
LABEL maintainer="docker@upshift.fr"
ENV NUT_VERSION 2.7.4
ENV UPS_NAME="ups"
ENV UPS_DESC="UPS"
ENV UPS_DRIVER="usbhid-ups"
ENV UPS_PORT="auto"
@MoLow
MoLow / aa
Created November 13, 2019 14:29
aa
aa
@MoLow
MoLow / Benji tdk eima shelcha yona.ts
Last active November 13, 2019 14:11
exists never returns
mport { go, it, describe, beforeEach, text, type, click, exists, afterEach } from 'testim';
import { expect } from 'chai';
const login = async () => {
const a = await exists('.Header-link.name');
console.log(a);
if(!(await exists('.Header-link.name'))) {
await go('https://gist.github.com/auth/github?return_to=https%3A%2F%2Fgist.github.com%2Fdiscover');
await type('input[name="login"]', 'tdkShit');
@MoLow
MoLow / benj
Last active November 13, 2019 13:38
Error on unallowed project
Error: TypeError: Cannot read property 'projectId' of null
at getCredentialProperty (/usr/local/lib/node_modules/@testim/testim-cli/credentialsManager.js:99:23)
From previous event:
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
From previous event:
at main (/usr/local/lib/node_modules/@testim/testim-cli/cli.js:58:10)
at Object.<anonymous> (/usr/local/lib/node_modules/@testim/testim-cli/cli.js:121:5)
at Module._compile (internal/modules/cjs/loader.js:776:30)
@MoLow
MoLow / aa
Created July 25, 2019 23:14
asdasda
asdasd
Observable.fromEvent(this.scrollElement.nativeElement, 'scroll')
.map((e: MouseEvent) => (e.target as HTMLElement).scrollTop * 100 / ((e.target as HTMLElement).scrollHeight - (e.target as HTMLElement).clientHeight))
.pairwise()
.filter(([h1, h2]) => h1 < h2 && h1 > 80)
.startWith([0, 0])
.exhaustMap((x, i) => this.notificationService.getNotifications(i).delay(1000))
.takeWhile(notifs => notifs && notifs.list && notifs.list.length)
.scan((acc, val) => ({ count: val.count, list: [...acc.list, ...val.list || []] }), { list: [], count: 0 });
@MoLow
MoLow / index.js
Created March 7, 2017 21:19
rxjs drag and drop with touch support
var mousemove = Rx.Observable.merge(
Rx.Observable.fromEvent(document, 'mousemove')
.map((e) => { e.preventDefault(); return e; }),
Rx.Observable.fromEvent(document, 'touchmove'))
.map((e) => e.touches[0]),
mouseup = Rx.Observable.merge(
Rx.Observable.fromEvent(dragTarget, 'mouseup'),
Rx.Observable.fromEvent(dragTarget, 'touchend')),
mousedown = Rx.Observable.merge(
Rx.Observable.fromEvent(dragTarget, 'mousedown'),
@MoLow
MoLow / a.png
Last active December 28, 2018 08:47
screenshots
a.png
#include <stdio.h>;
#define kTocMetaData (1L<<1)
#define kTocRawData (1L<<3)
#define kTocDAQmxRawData (1L<<7)
#define kTocInterleavedData (1L<<5)
#define kTocBigEndian (1L<<6)
#define kTocNewObjList (1L<<2)
typedef enum {