Skip to content

Instantly share code, notes, and snippets.

View deitry's full-sized avatar
🤷‍♂️

Dmitry Vornychev deitry

🤷‍♂️
View GitHub Profile
@deitry
deitry / vscode-explorer-fix-indent.css
Created July 2, 2019 12:39
vscode-explorer-fix-indent
/* Explorer tree view patch */
/* Adjust level indentation */
:root { --tree-width: 16px; }
.explorer-folders-view .monaco-list-row { overflow: visible !important; }
.explorer-folders-view .monaco-list-row[aria-level= "1"] { padding-left: calc( 0 * var(--tree-width)) !important; }
.explorer-folders-view .monaco-list-row[aria-level= "2"] { padding-left: calc( 1 * var(--tree-width)) !important; }
.explorer-folders-view .monaco-list-row[aria-level= "3"] { padding-left: calc( 2 * var(--tree-width)) !important; }
.explorer-folders-view .monaco-list-row[aria-level= "4"] { padding-left: calc( 3 * var(--tree-width)) !important; }
@deitry
deitry / test-vscode-uncrustify.cpp
Last active August 6, 2019 09:24
test-vscode-uncrustify.cpp
;;
//ааааббббввввггггддддееееёёёёжжжжззззииииййййкккклллл
//ааааббббввввггггддддееееёёёёжжжжззззииииййййкккклллл
//ааааббббввввггггддддееееёёёёжжжжззззииииййййкккклллл
//ааааббббввввггггддддееееёёёёжжжжззззииииййййкккклллл
//ааааббббввввггггддддееееёёёёжжжжззззииииййййкккклллл
//ааааббббввввггггддддееееёёёёжжжжззззииииййййкккклллл
//ааааббббввввггггддддееееёёёёжжжжззззииииййййкккклллл
//ааааббббввввггггддддееееёёёёжжжжззззииииййййкккклллл
//ааааббббввввггггддддееееёёёёжжжжззззииииййййкккклллл
@deitry
deitry / i2c_test.py
Last active October 3, 2023 07:55
Test data read from U-Blox Neo-7M via I2C using Python + smbus
import smbus
import time
bus = smbus.SMBus(1)
device = 0x1e
maxLen = 32
len_reg = 0xFD
@deitry
deitry / ura.py
Last active November 26, 2019 10:41
PID-controller for simple aperiodic model
"""
PID-controller for simple aperiodic model.
Features:
- Parameter renormalization to different time step between solver iterations.
- Limits for control and target signals.
"""
import math
@deitry
deitry / toolchain.cmake
Created December 9, 2019 09:51
Cross-compile scripts
# https://github.com/ros2-for-arm/ros2/blob/master/aarch64_toolchainfile.cmake
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_SYSTEM_PROCESSOR armhf)
# specify the cross compiler
set(CMAKE_C_COMPILER /usr/bin/arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER /usr/bin/arm-linux-gnueabihf-g++)
set(PYTHON_INCLUDE_DIR $ENV{TOOLCHAIN_PATH}/usr/include/python3.6)
@deitry
deitry / 1.py
Created December 13, 2019 13:18
Python decorators example
def deco(func):
def inner(x):
print("I multiply with " + str(x))
return func(x)
return inner
@deco
def make_multiplier_of(n):
def multiply(x):
return x*n
@deitry
deitry / setup.cfg
Created January 15, 2020 17:39
Python tools config
[yapf]
# https://github.com/google/yapf
based_on_style = pep8
blank_lines_around_top_level_definition = 2
blank_line_before_nested_class_or_def = True
coalesce_brackets = True
column_limit = 99
continuation_indent_width = 4
dedent_closing_brackets = False
@deitry
deitry / .gitignore
Created March 6, 2020 22:11
Typical .gitignore for Unity project
.vs/
.vscode/
Library/
Logs/
Temp/
obj/
@deitry
deitry / Serializer.cs
Created March 11, 2020 06:37
Example of NativeArray Serialization
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.Collections;
using System.IO;
using System.Xml.Serialization;
public class Serialization : MonoBehaviour
{
private bool initialized = false;
@deitry
deitry / bits.cs
Created March 12, 2020 07:23
Trivial bitfield in C#
using System;
namespace bits
{
public struct Output
{
// since bool is not blittable
public byte _flags;
const byte GotResultFlag = 0b01;
const byte DiscardedFlag = 0b10;