Skip to content

Instantly share code, notes, and snippets.

View DaniruKun's full-sized avatar
:octocat:
Processing...

Daniils Petrovs DaniruKun

:octocat:
Processing...
View GitHub Profile
.neonHeader {
filter: drop-shadow(0px 0px 10px #ff0000);
}
@DaniruKun
DaniruKun / enable_chime.sh
Created February 26, 2020 18:49
macOS Enable Startup Chime
sudo nvram StartupMute=%00
@DaniruKun
DaniruKun / adoc_status_badge
Last active April 9, 2020 09:18
Asciidoc status badge
image:path.svg?style=svg["Alt", link="link"]
@DaniruKun
DaniruKun / dragon.clj
Created May 20, 2020 20:47
Dragon Autopilot control driver demo
(defn roll
"Roll the Crew Dragon left or right (CCW or CW)."
([driv dir max-roll-rate]
(if (or
(< (math/abs (@tel/telem :roll-rate)) max-roll-rate)
(and
(pos? (@tel/telem :roll-rate)) (= dir "left"))
(and
(neg? (@tel/telem :roll-rate)) (= dir "right")))
@DaniruKun
DaniruKun / telemetry.clj
Created May 20, 2020 20:53
Automatic Docking Telemetry Demo
;; Yaw
(defn get-yaw-delta
""
[driv]
(let [yaw-delta-q (query driv {:css "#yaw > div.error"})
yaw-delta (get-element-text-el driv yaw-delta-q)]
(parse-delta yaw-delta)))
(defn get-yaw-rate
@DaniruKun
DaniruKun / telemetry.clj
Created May 20, 2020 21:02
Automatic Docking telemetry update
(defn poll
"Poll telemetry and update the state."
[driv]
(if true
(do
(Thread/sleep poll-interval)
(let [t (System/currentTimeMillis)
dt (* (+ poll-interval (- t (@telem :t))) 0.001)
x (get-x driv)
y (get-y driv)
@DaniruKun
DaniruKun / dragon.clj
Last active May 20, 2020 22:19
Automatic Docking Dragon alignment demo
(defn align-pitch-rot
"Align rotation on pitch axis."
[driv]
(if (pitch-within-error?)
(kill-pitch-rot driv)
(align-pitch driv))
(recur driv))
@DaniruKun
DaniruKun / dragon.clj
Created May 20, 2020 21:36
Auto docking alignment demo
(defn align-y
"docstring"
[driv]
(let [y (@tel/telem :y)
vy (@tel/telem :vy)]
(if (pos? y)
(when (or (> (math/abs y) deadzone)
(pos? vy))
(translate driv "left"))
(when (or (> (math/abs y) deadzone)
@DaniruKun
DaniruKun / lambda_handler.py
Last active June 8, 2020 20:32
Python Telegram weather radar bot
from html.parser import HTMLParser
import http.client
from http.client import HTTPException
import json
import os
from urllib.parse import urljoin
SRI_HOST = "lietus.lv"
TELEGRAM_API_HOST = "api.telegram.org"
@DaniruKun
DaniruKun / rebar.config
Created June 17, 2020 16:27
Typical Elvis formatter configuration
{elvis,
[#{dirs => ["apps/*/src", "src"],
filter => "*.erl",
rules => [{elvis_style, line_length,
#{ignore => [],
limit => 100,
skip_comments => false}},
{elvis_style, no_tabs},
{elvis_style, no_trailing_whitespace},
{elvis_style, macro_names, #{ignore => []}},