Skip to content

Instantly share code, notes, and snippets.

Avatar

Aurimas Niekis aurimasniekis

View GitHub Profile
@aurimasniekis
aurimasniekis / types.php
Created Aug 4, 2021
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 Jun 6, 2021
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 Jun 5, 2021
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 Oct 27, 2018
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
View coup-dl
#!/usr/bin/env python3
# Copyright © 2017 Kristof Toth <mrtoth@strongds.hu>
# This program is free software. It comes without any warranty, to the extent
# permitted by applicable law. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
from subprocess import call, Popen, PIPE, DEVNULL
from os import listdir, remove
from os.path import splitext, exists, join, split