Skip to content

Instantly share code, notes, and snippets.

View aurimasniekis's full-sized avatar

Aurimas Niekis aurimasniekis

View GitHub Profile
@aurimasniekis
aurimasniekis / usb-ip.md
Created September 24, 2023 12:14
Proposal for Simplified USB-IP Standard: Enabling TCP/UDP Communication for USB Devices
View usb-ip.md

Title:

Proposal for Simplified USB-IP Standard: Enabling TCP/UDP Communication for USB Devices

Abstract:

This proposal introduces a simplified IP over USB standard to enable direct TCP/UDP communication between USB devices and host machines locally. The standard provides a networking interface to USB devices without encapsulation, allowing existing TCP/UDP application code to be reused easily. This reduces complexity by eliminating the need to learn USB protocols. The host driver handles USB protocols internally, tunneling native TCP/UDP packets bidirectionally. This fosters innovation by lowering barriers to integrating USB capabilities into solutions using familiar networking concepts. The standard ensures cross-platform compatibility while addressing security concerns. Adoption promises accelerated development and enhanced interoperability for USB-based products.

1. Introduction

@aurimasniekis
aurimasniekis / types.php
Created August 4, 2021 09:28
Small example of generating Typescript interfaces from PHP classes
View types.php
<?php
class BaseView extends View
{
}
class AuthorUserView extends BaseView
{
#[Property(type: 'string')]
public Ulid $id;
@aurimasniekis
aurimasniekis / MyWindow.cs
Last active June 6, 2021 06:44
How to allow WPF custom window element to have transparency set from style
View MyWindow.cs
namespace WpfApplication1
{
public class MyWindow : Window
{
public new static readonly DependencyProperty AllowsTransparencyProperty =
DependencyProperty.Register(nameof(AllowsTransparency), typeof(bool), typeof(MyWindow), new PropertyMetadata(false));
public new bool AllowsTransparency
{
get => (bool) GetValue(AllowsTransparencyProperty);
@aurimasniekis
aurimasniekis / KeyboardKey.cs
Last active February 3, 2023 07:11
A simple C# Keyboard Key generic class to map 4 different types of KeyBoard Key values from Win32 Key, Wpf Input Key, WinForm Key and JS Key
View KeyboardKey.cs
using System;
using System.Collections.Generic;
public class KeyboardKey : IEquatable<KeyboardKey>
{
public enum Keys
{
None,
Cancel,
Backspace,
View esk8lightuino.ino
#include <Arduino.h>
#include "PPMInput.h"
#include <FastLED.h>
#define NUM_LEDS 70
#define DATA_PIN 0
#define BRIGHTNESS 200
#define FRAMES_PER_SECOND 60
View hashing.js
(function () {
var t = aaa
, i = ccc.utf8
, a = bbb
, o = ccc.bin
, r = function (e, n) {
e.constructor == String ? e = n && "binary" === n.encoding ? o.stringToBytes(e) : i.stringToBytes(e) : a(e) ? e = Array.prototype.slice.call(e, 0) : Array.isArray(e) || (e = e.toString());
for (var s = t.bytesToWords(e), l = 8 * e.length, c = 1732584193, d = -271733879, u = -1732584194, p = 271733878, h = 0; h < s.length; h++)
s[h] = 16711935 & (s[h] << 8 | s[h] >>> 24) | 4278255360 & (s[h] << 24 | s[h] >>> 8);
s[l >>> 5] |= 128 << l % 32,
View diff_2.8.patch
Only in Raptor2 Sources/bldc-firmware_2_80: .dep
Only in bldc-cc171422641a50c56452280575f2074f8a88aa45: .gitignore
diff -ru bldc-cc171422641a50c56452280575f2074f8a88aa45/Makefile Raptor2 Sources/bldc-firmware_2_80/Makefile
--- bldc-cc171422641a50c56452280575f2074f8a88aa45/Makefile 2015-12-29 01:37:09.000000000 +0000
+++ Raptor2 Sources/bldc-firmware_2_80/Makefile 2016-09-19 10:07:06.000000000 +0100
@@ -270,8 +270,8 @@
# Program
upload: build/$(PROJECT).bin
#qstlink2 --cli --erase --write build/$(PROJECT).bin
- openocd -f interface/stlink-v2.cfg -c "set WORKAREASIZE 0x2000" -f target/stm32f4x_stlink.cfg -c "program build/$(PROJECT).elf verify reset"
@aurimasniekis
aurimasniekis / a.UMDS2
Created October 27, 2018 17:34
ARC200 A and B configuration
View a.UMDS2
comboParam$Control Mode$Torque Forward Only (+-A)
numericParam$Current Command Offset$-0.15$A/(VDC * PWMdec)
numericParam$Torque-Forward-Only Regen Foldback Start-Below PWM$2$% PWM
numericParam$Smart Reversal Threshold$10$A
numericParam$Smart Reversal Time$10$ms
comboParam$Input Throttle Mode$PWM Throttle
numericParam$Input Throttle Min$16005$
numericParam$Input Throttle Max$32255$
numericParam$Input Throttle Zero Neutral$24109$
numericParam$Input Throttle Deadband$300$+/-
View A.json
{
"version" : "1",
"networkId" : "381989",
"parameters" : [
{
"name" : "allow4AId",
"category" : "profile",
"value" : "true"
}
View main.cpp
#include <BLEDevice.h>
#include <BLEServer.h>
#include <BLEUtils.h>
#include <BLE2902.h>
#define DEVICE_NAME "Pomo Light #1"
#define RED_PIN 5
#define GREEN_PIN 18
#define BLUE_PIN 19