This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'websocket-client-simple' | |
require 'json' | |
class Client | |
LOBBY = "games:lobby" | |
def initialize | |
@mode = :lobby |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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"> |
NewerOlder