Skip to content

Instantly share code, notes, and snippets.

View egavard's full-sized avatar

GAVARD Ewann egavard

View GitHub Profile
@egavard
egavard / moment-date-adapter.ts
Created September 5, 2017 13:50
moment-date-adapter.ts A DateAdapter fully working with Angular material 2
import {DateAdapter} from '@angular/material';
import * as moment from 'moment';
import {Inject, LOCALE_ID} from '@angular/core';
export class MomentDateAdapter extends DateAdapter<moment.Moment> {
constructor(@Inject(LOCALE_ID)locale: any) {
super();
this.setLocale(locale);
moment.locale(locale);
@egavard
egavard / getInvoices.sh
Created July 3, 2024 15:12
Retrieve invoices from Tesla API for the month instead of using the APP
#!/bin/bash
CLIENT_ID=
CLIENT_SECRET=
AUDIENCE=https://fleet-api.prd.eu.vn.cloud.tesla.com
#LOGIN
TESLA_API_TOKEN=$(curl --request POST --header 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'grant_type=client_credentials' --data-urlencode "client_id=$CLIENT_ID" \
--data-urlencode "client_secret=$CLIENT_SECRET" --data-urlencode 'scope=openid vehicle_device_data vehicle_cmds vehicle_charging_cmds' \