Skip to content

Instantly share code, notes, and snippets.

View mschae's full-sized avatar

Michael Schaefermeyer mschae

View GitHub Profile
@mschae
mschae / README.md
Last active January 8, 2025 18:01
Autodiscovery for weconnect-mqtt

Very rough autodiscovery message to be used with weconnect-mqtt and Home Assistant.

One needs to replace the follwing placeholders:

  • {VIN} with the vehicel's VIN
  • {NAME} with a name (e.g. "ID.7")
  • {BRAND} with the car's brand (e.g. "Volkswagen")
  • {PREFIX} with a prefix for ids if one wants that.

Can be used like so:

@mschae
mschae / Dockerfile
Last active January 28, 2020 21:32
FROM node:12.2-slim as assets
WORKDIR /app/assets
COPY assets/package*.json ./
RUN npm install
# Copy the entire app so we can put files into /app/priv/static
COPY . /app
@mschae
mschae / install_postgres.md
Last active March 21, 2018 18:43
Postgres Installieren

Zuerst führt installiert ihr postgres:

sudo apt-get update

sudo apt-get install postgresql

Dann startet ihr die Datenbank:

sudo services postgresql start

Keybase proof

I hereby claim:

  • I am mschae on github.
  • I am mschae (https://keybase.io/mschae) on keybase.
  • I have a public key ASAq4ztI5vr2n7MN5O6OMTI2Mavve0WhDp2Ev-1CbIv0Ewo

To claim this, I am signing this object:

[{
"id": 1,
"value": {
"text": "1 article",
"widget": 1
}
},
{
"id": 2,
"value": {
application/1d-interleaved-parityfec 1d-interleaved-parityfec
application/3gpdash-qoe-report+xml 3gpdash-qoe-report+xml
application/3gpp-ims+xml 3gpp-ims+xml
application/A2L A2L
application/activemessage activemessage
application/activemessage activemessage
application/alto-costmap+json alto-costmap+json
application/alto-costmapfilter+json alto-costmapfilter+json
application/alto-directory+json alto-directory+json
application/alto-endpointprop+json alto-endpointprop+json
$ mix ecto.migrate
** (Postgrex.Error) ERROR (42883): function uuid_generate_v4() does not exist
lib/ecto/adapters/sql/worker.ex:26: Ecto.Adapters.SQL.Worker.query!/4
lib/ecto/adapters/sql.ex:186: Ecto.Adapters.SQL.use_worker/3
lib/ecto/adapters/postgres.ex:48: Ecto.Adapters.Postgres.execute_ddl/3
(stdlib) timer.erl:194: :timer.tc/3
lib/ecto/migration/runner.ex:22: Ecto.Migration.Runner.run/5
lib/ecto/migrator.ex:111: Ecto.Migrator.attempt/5
lib/ecto/migrator.ex:60: anonymous fn/4 in Ecto.Migrator.do_up/4
lib/ecto/adapters/sql.ex:424: Ecto.Adapters.SQL.transaction/3
Using worker: worker-linux-bc81d502-2.bb.travis-ci.com:travis-linux-18
system_info
Build system information
Build language: erlang
Build image provisioning date and time
Wed Feb 4 20:27:35 UTC 2015
Operating System Details
Distributor ID: Ubuntu
Description: Ubuntu 12.04 LTS
Release: 12.04
for event <- [:before_save, :before_update, :before_delete] do
defmacro unquote(event)(function) do
quote bind_quoted: [event: event] do
Ecto.Model.Callbacks.register_callback(__MODULE__, event, unquote(function))
def __callbacks__(:before_save), do: Keyword.get_values(@ecto_callbacks, :before_save)
end
end
end
defmodule TrailingFormatCompatibilityPlug do
import Plug.Conn
def init(options), do: options
def call(conn, opts) do
conn.path_info |> List.last |> String.split(".") |> Enum.reverse |> case do
[ _ ] -> conn
[ format | fragments ] ->
new_path = fragments |> Enum.reverse |> Enum.join(".")