Skip to content

Instantly share code, notes, and snippets.

@eflukx
eflukx / parse_kicad_xml.rb
Last active September 2, 2023 13:10
Small script to parse the .xml BOM files exported by KiCad. This allows for easy handling and transforming in a (production) pipeline using Ruby
require 'pry'
require 'json'
require 'nokogiri'
require 'yaml'
require 'hashie'
class GroupedComponents
@@DEFAULT_FIELDS = %w(refs cnt value footprint)
# Array get cycle
# KEY cyclical enumerator
KEY = "code"
SYMBOLS = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z","1","2","3"]
def encrypt(input_text)
crypt input_text, false
end
use core::cell::RefCell;
use bsp::hal;
use embedded_storage::nor_flash::{NorFlash, ReadNorFlash};
use hal::{nvmc::Nvmc, pac::NVMC};
use tickv::{error_codes::ErrorCode, flash_controller::FlashController, TicKV};
pub const FLASH_PAGE_SIZE: usize = 4096;
f~f~øxà~xææ?æø~ff~fæøþff`ffàæþ`~fffæf`æfþf`àæþfæþ`fæøxf~æøf~fæff~fxffþfx~æfx~`æfx~æøfx~`æfx~~æfx~æþ`fx`þààþææxx~àþxæxxxxxàf?àþxæxxxxx`àfàþxàfàxxþ~fààxøæþæ?àþxàfxxxf`øf~àfI (30) boot: ESP-IDF v4.3-beta1-24-g0bbc721a6-dirty 2nd stage bootloader
I (30) boot: compile time 14:32:18
I (31) boot: chip revision: 1
I (32) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (35) boot.esp32: SPI Speed : 40MHz
I (38) boot.esp32: SPI Mode : DIO
I (40) boot.esp32: SPI Flash Size : 4MB
I (42) boot: Enabling RNG early entropy source...
I (44) boot: Partition Table:
I (46) boot: ## Label Usage Type ST Offset Length
2020-04-21 23:25:24.427 [info] <0.702.0> MQTT vhost picked using plugin configuration or default
2020-04-21 23:25:24.443 [info] <0.705.0> rabbit_auth_backend_http:do_http_req Path0 "http://dev4.servername.nl:6980/api/v1/user"
2020-04-21 23:25:24.443 [info] <0.705.0> rabbit_auth_backend_http:do_http_req URI [{fragment,[]},{host,"dev4.servername.nl"},{path,"/api/v1/user"},{port,6980},{query,[]},{scheme,"http"},{userinfo,[]}]
2020-04-21 23:25:24.576 [info] <0.705.0> rabbit_auth_backend_http:do_http_req Path0 "http://dev4.servername.nl:6980/api/v1/vhost"
2020-04-21 23:25:24.576 [info] <0.705.0> rabbit_auth_backend_http:do_http_req URI [{fragment,[]},{host,"dev4.servername.nl"},{path,"/api/v1/vhost"},{port,6980},{query,[]},{scheme,"http"},{userinfo,[]}]
2020-04-21 23:25:24.777 [error] <0.705.0> ** Generic server <0.705.0> terminating
** Last message in was connect
** When Server state == {<0.704.0>,{amqp_params_direct,<<"user2">>,<<"lVvSVe2YNJACzz1TzpzYgke7I83lr34wTpuUwUPMH8X0IULO8m051is9NkEjlGix">>,<<"/">>,rabbit
2020-04-21 22:55:56.713 [info] <0.2547.0> MQTT vhost picked using plugin configuration or default
2020-04-21 22:55:57.011 [error] <0.2550.0> ** Generic server <0.2550.0> terminating
** Last message in was connect
** When Server state == {<0.2549.0>,{amqp_params_direct,<<"user2">>,<<"lerZ1Jq00ATRaQzEKA0kocQWRnRX2za3orx3YXjhk57W589c4th7e7kPmam8Byos">>,<<"/">>,rabbit@aion,{amqp_adapter_info,{10,135,10,6},1883,{10,135,10,207},52496,<<"10.135.10.207:52496 -> 10.135.10.6:1883">>,{'MQTT',"3.1.1"},[{variable_map,#{<<"client_id">> => <<"Rogier214742391">>}},{channels,1},{channel_max,1},{frame_max,0},{client_properties,[{<<"product">>,longstr,<<"MQTT client">>},{client_id,longstr,<<"Rogier214742391">>}]},{ssl,false}]},[]}}
** Reason for termination ==
** {function_clause,[{amqp_gen_connection,terminate,[{{case_clause,{badrpc,{'EXIT',{{case_clause,"\"allow\""},[{rabbit_access_control,check_access,5,[{file,"src/rabbit_access_control.erl"},{line,211}]},{lists,foldl,3,[{file,"lists.erl"},{line,1263}]},{rabbit_direct,connec
@eflukx
eflukx / gen_esp_idf_vscode_include_paths.rb
Last active April 25, 2020 12:03
Generate include paths for ESP32 ESP-IDF for use in VSCode (c_cpp_properties.json)
require 'pry'
require 'json'
APP_ROOT = File.dirname(__FILE__)
def dirs_in path
Dir.each_child(path)
.select{ |e| File.directory? File.join(path, e) }
.map{ |dir| File.realpath File.join(path, dir) }
end
@eflukx
eflukx / chip-flash.sh
Created October 14, 2017 17:24 — forked from foxbunny/chip-flash.sh
Script to flash CHIP
#!/bin/bash
#
# This script programs the CHIP's NAND flash using sunxi-tools' `fel` utiltiy,
# and U-Boot itself. The following tools must be present on the system:
#
# - dd (coreutils)
# - lsusb (usbutils)
# - fel (sunxi-tools)
# - mkimage (android-tools)
#
#ifndef __DRV_LCD5110_FONT__
#define __DRV_LCD5110_FONT__
unsigned char font6_8[][6] =
{
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, // sp
{ 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00 }, // !
{ 0x00, 0x00, 0x07, 0x00, 0x07, 0x00 }, // "
#!/usr/bin/ruby
# probeersel van weleer.
current_terminal = `tty`.gsub(/\n/, '')
dev_handle = IO.sysopen(current_terminal, "w")
io_stream = IO.new(dev_handle, "w")
Process.daemon