Skip to content

Instantly share code, notes, and snippets.

View mlankenau's full-sized avatar

Marcus Lankenau mlankenau

  • SLL Automotive Group GmbH
  • Erika-Mann-Straße 63, 80636 München
View GitHub Profile
from PIL import Image, ImageDraw
# https://github.com/dezhin/osmread
from osmread import parse_file, Way, Node, Relation
points = {}
ways = {}
relations = []
lat_from = 47.7192
@mlankenau
mlankenau / lock.js
Last active December 18, 2018 15:15
// idea, we want to start two async processes a and b.
const a = async () => { do_async_stuff() }
const b = async () => { do_async_stuff() }
// but we need to isolate them. So b should not run before a
const result = Promise.all([a, b])
// this way they can overlap, not good. So lets use a lock
defmodule MailService.SendAdapters.SendGrid do
@mailer_url "https://api.sendgrid.com/v3/mail/send"
@doc """
Send a mail to a list of persons (recipients)
* from from address
* recipients array of email addresses
* subject subject text
defmodule TextFileUtils do
def fix_line_breaks(file_path) do
{:ok, file} = File.open(file_path)
out_file_path = "/tmp/fixed_file_#{:erlang.system_time}.tmp"
{:ok, out_file} = File.open(out_file_path, [:write])
process_file(file, out_file, "")
File.close(file)
File.close(out_file)
out_file_path
end
defmodule NumberService do
import Plug.Conn
@doc "server loop"
def server(i) do
receive do
{:next, caller} ->
send caller, {:next_num, i}
server(i+1)
end
defmodule CsvParser do
def main([file | _args]) do
{:ok, file_content} = File.read(file)
parse(file_content)
end
def parse(content) when is_binary(content) do
content
|> String.split("\n")
|> parse
<template>
<div class="datetime-edit">
<input type="text" class="date" name="date"
v-on:change="changed" placeholder="01.01.2017" v-model="dateStr">
<input type="text" class="time" name="date"
v-on:change="changed" placeholder="13:30" v-model="timeStr">
</div>
</template>
<script>
require 'rubygems'
require 'websocket-client-simple'
require 'json'
class Client
LOBBY = "games:lobby"
def initialize
@mode = :lobby
set -g prefix C-a
set -g default-terminal "xterm"
######################
### DESIGN CHANGES ###
######################
# panes
set -g pane-border-fg black
set -g pane-active-border-fg brightred
@mlankenau
mlankenau / vue_sample.html
Last active April 1, 2016 12:18
Vue sample with login and lobby
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title></title>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.20/vue.js" charset="utf-8">
</script>
</head>
<body>
<template id="login-template">