Skip to content

Instantly share code, notes, and snippets.

View aurimasniekis's full-sized avatar

Aurimas Niekis aurimasniekis

View GitHub Profile
#!/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
const noble = require('noble');
const { EventEmitter } = require('events');
class PomoLight extends EventEmitter {
constructor(prefix, serviceUUID, writeUUID) {
super();
this.prefix = prefix;
this.serviceUUID = serviceUUID;
this.writeUUID = writeUUID;
@aurimasniekis
aurimasniekis / bms.json
Created June 7, 2018 20:49
BMS data record
{
"state": "charging|discharging|off",
"voltage": 50.40,
"currents": {
"esc": {
"current": 0,
"energy": {
"charged": 0,
"discharged": 0
}
{
"title": "Control + Function Keys to Media Control",
"rules": [
{
"description": "fn + f1 to display_brightness_decrement",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "f1",
output # => ["clang version 5.0.0 (tags/RELEASE_500/final)",
"Target: x86_64-apple-darwin16.6.0",
"Thread model: posix",
"InstalledDir: /usr/local/opt/llvm/bin",
" \"/usr/local/Cellar/llvm/5.0.0/bin/clang-5.0\" \"-cc1\" \"-triple\" \"x86_64-apple-macosx10.12.0\" \"-Wdeprecated-objc-isa-usage\" \"-Werror=deprecated-objc-isa-usage\" \"-emit-obj\" \"-mrelax-all\" \"-disable-free\" \"-disable-llvm-verifier\" \"-discard-value-names\" \"-main-file-name\" \"bindgen.cpp\" \"-mrelocation-model\" \"pic\" \"-pic-level\" \"2\" \"-mthread-model\" \"posix\" \"-mdisable-fp-elim\" \"-masm-verbose\" \"-munwind-tables\" \"-faligned-alloc-unavailable\" \"-target-cpu\" \"penryn\" \"-target-linker-version\" \"278.4\" \"-dwarf-column-info\" \"-debugger-tuning=lldb\" \"-resource-dir\" \"/usr/local/Cellar/llvm/5.0.0/lib/clang/5.0.0\" \"-stdlib=libc++\" \"-fdeprecated-macro\" \"-fdebug-compilation-dir\" \"/Users/aniekis/Projects/Home/Desktop/C++/bindgen/clang\" \"-ferror-limit\" \"
output # => ["clang version 5.0.0 (tags/RELEASE_500/final)",
"Target: x86_64-apple-darwin16.6.0",
"Thread model: posix",
"InstalledDir: /usr/local/Cellar/llvm/5.0.0/bin",
" \"/usr/local/Cellar/llvm/5.0.0/bin/clang-5.0\" \"-cc1\" \"-triple\" \"x86_64-apple-macosx10.12.0\" \"-Wdeprecated-objc-isa-usage\" \"-Werror=deprecated-objc-isa-usage\" \"-emit-obj\" \"-mrelax-all\" \"-disable-free\" \"-disable-llvm-verifier\" \"-discard-value-names\" \"-main-file-name\" \"bindgen.cpp\" \"-mrelocation-model\" \"pic\" \"-pic-level\" \"2\" \"-mthread-model\" \"posix\" \"-mdisable-fp-elim\" \"-masm-verbose\" \"-munwind-tables\" \"-faligned-alloc-unavailable\" \"-target-cpu\" \"penryn\" \"-target-linker-version\" \"278.4\" \"-dwarf-column-info\" \"-debugger-tuning=lldb\" \"-resource-dir\" \"/usr/local/Cellar/llvm/5.0.0/lib/clang/5.0.0\" \"-stdlib=libc++\" \"-fdeprecated-macro\" \"-fdebug-compilation-dir\" \"/Users/aniekis/Projects/Home/Desktop/C++/bindgen/clang\" \"-ferror-li
module SerialPorts
struct PortMetadata
property name : String
property transport : String
property description : String?
property usbVID : Int32?
property usbPID : Int32?
property usbVendorName : String?
property usbProductName : String?
property usbSerialNumber : String?
# Lib
fun cf_string_get_c_string = CFStringGetCString(CfStringRef, UInt8*, CfIndex, UInt32) : Boolean
# Call
result = IOKit.cf_string_get_c_string(cf_path.as(IOKit::CfStringRef), out name, 300, IOKit::CFStringEncodingASCII)
pp String.new(name)
# Error
➜ crystal git:(feature/opensll_pbkdf2_implementation) make std_spec
Using /usr/local/bin/llvm-config [version=5.0.0]
./bin/crystal build -o .build/std_spec spec/std_spec.cr
Undefined symbols for architecture x86_64:
"_PKCS5_PBKDF2_HMAC", referenced from:
_*OpenSSL::PKCS5::pbkdf2_hmac<Symbol, String, String, Int32, Int32>:Slice(UInt8) in O-penS-S-L-5858P-K-C-S-5.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error: execution of command failed with code: 1: `cc "${@}" -o '/Users/aniekis/Projects/Home/Desktop/Crystal/crystal/.build/std_spec' -rdynamic -lyaml `/usr/local/bin/llvm-config --libs --system-libs --ldflags 2> /dev/null` -lstdc++ `command -v pkg-config > /dev/null && pkg-config --libs libssl || printf %s '-lssl -lcrypto'` `command -v pkg-config > /dev/null && pkg-config --libs libcrypto || printf %s '-lcrypto'` -lreadline -lgmp -lz -lxml2 -lpcre -lgc -lpthread /Users/aniekis/Projects/Home/Desktop/Crystal/cryst
This file has been truncated, but you can view the full file.
[{"id":49676025,"broadbandAverageSpeed":200,"superFastMaxSpeedRange":200,"superFastStatusType":"AVAILABLE","superFastAvailableOrComingSoon":true,"price":{"amount":345,"frequency":"weekly","currencyCode":"GBP","displayPrices":[{"displayPrice":"\u00a31,495 pcm","displayPriceQualifier":""},{"displayPrice":"\u00a3345 pw","displayPriceQualifier":""}]},"distance":1.9278,"main_image":"=HYPERLINK(\"http:\/\/www.rightmove.co.uk\/property-to-rent\/property-49676025.html\", IMAGE(\"http:\/\/media.rightmove.co.uk:80\/dir\/crop\/10:9-16:9\/80k\/79624\/49676025\/79624_0615_FJL061500670_IMG_01_0000_max_476x317.jpg\"))","map":"=IMAGE(\"https:\/\/maps.googleapis.com\/maps\/api\/staticmap?&markers=color:red%7Clabel:H%7C51.53293,-0.09372&center=51.53293,-0.09372&zoom=12&size=400x300&key=AIzaSyA0VTCX6MjDW7TTQlfQi_AEHdtaTp0ntJw\")","bedrooms":1,"numberOfImages":10,"numberOfFloorplans":1,"numberOfVirtualTours":1,"summary":" - Available now! Beautiful one bedroom property in a Georgian conversion. Short walk to Old Street and resid