Skip to content

Instantly share code, notes, and snippets.

@jrgutier
jrgutier / rivian_charging_card-ha.yaml
Created June 15, 2023 21:07
Rivian Charging Curve HA Card
type: custom:config-template-card
variables:
FIND_SPAN: |
temp => {
if (temp == 'unknown') {
return '12h';
}
else {
return temp+'s';
}
abrp_request:
url: >
{% set token = "REPLACE_ME_WTH_ABRP_TOKEN" %}
{% set params = [] %}
{% set params = params + ['"utc":' ~ now().timestamp()] %}
{% set params = params + ['"soc":' ~ states('sensor.r1t_battery_state_of_charge')] %}
{% set params = params + ['"lat":' ~ state_attr('device_tracker.r1t_location', 'latitude')] %}
{% set params = params + ['"lon":' ~ state_attr('device_tracker.r1t_location', 'longitude')] %}
{% set params = params + ['"heading":' ~ states('sensor.r1t_bearing')] %}
{% set params = params + ['"speed":' ~ (0 if is_state('sensor.r1t_gear_selector', 'Park') else states('sensor.r1t_speed') | float * 1.609344)] %}
@shamasis
shamasis / describe-it.min.js
Last active May 4, 2018 02:58
mocha/jasmine compatible test framework for postman test scripts (in less than 1KB minified)
(typeof tests!=='object')&&(tests={});var
it=((it=function(k,v){it.d.push(k);it.t[it.d]=1;it.b.forEach(it.c);try{v()}catch(e){it.t[it.d]=0;setTimeout&&setTimeout(function(){throw e;})}it.a.forEach(it.c);it.d.pop()}),
it.a=[],it.b=[],it.c=function(x){x()},it.d=[],it.d.toString=function(){return this.join(' ')},
it.t=tests,it.x=function(v){this.v=v},it.xp=it.x.prototype,it.xp.toBe=function(x){(this.v!==x)&&it._()},
it.xp.toNotBe=function(x){(this.v===x)&&it._()},it.xp.toEql=function(x){(this.v!=x)&&it._()},
it.xp.toNotEql=function(x){(this.v==x)&&it._()},it.xp.toBeOk=function(){!this.v&&it._()},
it.xp.toNotBeOk=function(){this.v&&it._()},it),describe=function(k,v){it.d.push(k);v();it.d.pop()},
expect=function(v){return new it.x(v)},beforeEach=it.b.push.bind(it.b),afterEach=it.a.push.bind(it.a);
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active June 5, 2024 22:16
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application: