Skip to content

Instantly share code, notes, and snippets.

View raquo's full-sized avatar

Nikita Gazarov raquo

View GitHub Profile
version = "3.8.4-RC1"
runner.dialect = "scala213"
# !!! TODO !!! Update styles in the generator to match scalafmt config
# - Maybe make a separate config for these files, that has two lines before method names, see https://scalameta.org/scalafmt/docs/configuration.html#fileoverride
# - Does this exclusion actually work? IntelliJ seems to ignore it
project.excludePaths = [
"glob:**/src/main/scala/com/raquo/laminar/defs/**",
"glob:**/project/VersionHelper.scala",
"glob:**/src/test/**", # !!! TODO - sort out binpacking, mostly
@raquo
raquo / prop.lisp
Created December 28, 2022 05:02 — forked from betzuka/prop.lisp
(define #erpm_passive_brake 600)
(define #active_brake_current -100.0)
(define #start_current 10.0)
(define #max_current (conf-get 'l-current-max))
(define #freq 50.0)
(define #ramp_time 0.2)
(define #range_current (- #max_current #start_current))
(define #current_step (/ #range_current (* #freq #ramp_time)))
(define #output_current 0.0)
@raquo
raquo / SplitEnum.scala
Created October 18, 2022 22:04 — forked from felher/SplitEnum.scala
Sum-Type Splitter for Laminar with Exhaustiveness-Checks
import com.raquo.laminar.api.L.*
import scala.deriving.*
import scala.compiletime.*
object SplitEnum:
final case class Splitter[A, Todo <: Tuple, O](sig: Signal[A], keyer: A => Int, handlers: Array[Any => O]):
inline def close: Signal[O] =
inline erasedValue[Todo] match
case _: EmptyTuple.type =>
sig.splitOne(keyer)((key, _, subSig) => handlers(key)(subSig))
@raquo
raquo / workplanePatch.py
Created February 9, 2022 10:08
Patch CadQuery's workplane() method to align resulting workplane's XY plane with that of the provided xyBase
from __future__ import annotations
import math
from typing import Literal, Optional
from cadquery import cq, Workplane, Plane
from cadquery.cq import VectorLike
if not hasattr(Workplane, 'originalWorkplaneMethod'):
Workplane.originalWorkplaneMethod = Workplane.workplane
[2022-01-27 03:41:22.598284] ERROR: CQ-Editor: Uncaught exception occurred
Traceback (most recent call last):
File "/Users/raquo/opt/miniconda3/lib/python3.9/site-packages/cq_editor/widgets/editor.py", line 153, in open
self.load_from_file(fname)
File "/Users/raquo/opt/miniconda3/lib/python3.9/site-packages/cq_editor/widgets/editor.py", line 157, in load_from_file
self.set_text_from_file(fname)
File "/Users/raquo/opt/miniconda3/lib/python3.9/site-packages/spyder/plugins/editor/widgets/codeeditor.py", line 2780, in set_text_from_file
self.filename = filename
File "/Users/raquo/opt/miniconda3/lib/python3.9/site-packages/cq_editor/widgets/editor.py", line 206, in filename
self._update_filewatcher()
(base) ➜ ~ python
Python 3.9.5 (default, May 18 2021, 12:31:01)
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from cq_editor.widgets.editor import Editor
>>> dir(Editor)
['AdjustIgnored', 'AdjustToContents', 'AdjustToContentsOnFirstShow', 'BRACE_MATCHING_SCOPE', 'Box', 'DrawChildren', 'DrawWindowBackground', 'EXTENSIONS', 'HLine', 'IgnoreMask', 'LANGUAGES', 'LineWrapMode', 'NoFrame', 'NoWrap', 'PaintDeviceMetric', 'Panel', 'PdmDepth', 'PdmDevicePixelRatio', 'PdmDevicePixelRatioScaled', 'PdmDpiX', 'PdmDpiY', 'PdmHeight', 'PdmHeightMM', 'PdmNumColors', 'PdmPhysicalDpiX', 'PdmPhysicalDpiY', 'PdmWidth', 'PdmWidthMM', 'Plain', 'Raised', 'RenderFlag', 'RenderFlags', 'SYNC_SYMBOLS_AND_FOLDING_TIMEOUT', 'Shadow', 'Shadow_Mask', 'Shape', 'Shape_Mask', 'SizeAdjustPolicy', 'StyleMask', 'StyledPanel', 'Sunken', 'TAB_ALWAYS_INDENTS', 'UPDATE_DECORATIONS_TIMEOUT', 'VLine', 'WidgetWidth', 'WinPanel', '_BaseEditMixin__move_cursor_anchor', '_BaseEditMix
# Name Version Build Channel
alabaster 0.7.12 py_0 conda-forge
applaunchservices 0.2.1 py_0 conda-forge
appnope 0.1.2 py39h6e9494a_2 conda-forge
argh 0.26.2 pyh9f0ad1d_1002 conda-forge
astroid 2.9.3 py39h6e9494a_0 conda-forge
asttokens 2.0.5 pyhd8ed1ab_0 conda-forge
atomicwrites 1.4.0 pyh9f0ad1d_0 conda-forge
attrs 21.4.0 pyhd8ed1ab_0 conda-forge
autopep8 1.5.6 pyhd8ed1ab_0 conda-forge
# Name Version Build Channel
alabaster 0.7.12 py_0 conda-forge
appnope 0.1.2 py37hf985489_2 conda-forge
astroid 2.9.3 py37hf985489_0 conda-forge
attrs 21.4.0 pyhd8ed1ab_0 conda-forge
babel 2.9.1 pyh44b312d_0 conda-forge
backcall 0.2.0 pyh9f0ad1d_0 conda-forge
backports 1.0 py_2 conda-forge
backports.functools_lru_cache 1.6.4 pyhd8ed1ab_0 conda-forge
bleach 4.1.0 pyhd8ed1ab_0 conda-forge
# Name Version Build Channel
alabaster 0.7.12 py_0 conda-forge
applaunchservices 0.2.1 py_0 conda-forge
appnope 0.1.2 py38h50d1736_2 conda-forge
argh 0.26.2 pyh9f0ad1d_1002 conda-forge
astroid 2.9.3 py38h50d1736_0 conda-forge
asttokens 2.0.5 pyhd8ed1ab_0 conda-forge
atomicwrites 1.4.0 pyh9f0ad1d_0 conda-forge
attrs 21.4.0 pyhd8ed1ab_0 conda-forge
autopep8 1.5.6 pyhd8ed1ab_0 conda-forge
@raquo
raquo / gist:208783abe53607a0ba52eb7bdd640d58
Last active December 31, 2021 03:23
APD telemetry parser notes - adjustments for 32 bit platform
# APD provides example telemetry parsing code, which assumes 16-bit architecture:
# See https://docs.powerdrives.net/products/hv_pro/uart-telemetry-output
#
# Below is the adjustment I had to make to their python code to properly parse current,
# which is encoded in a 16-bit integer in the message buffer
# (on my platform integers are 32 bits, which produced incorrect values out of the box)
def parseUartMessage(fullMessageBuffer: array[int]): # input is a full UART message encoded as array of bytes
# ...