Skip to content

Instantly share code, notes, and snippets.

View brainstorm's full-sized avatar

Roman Valls Guimera brainstorm

View GitHub Profile
@brainstorm
brainstorm / majestic.yaml
Last active September 4, 2023 11:56
openipc_etc_network_interfaces
auto wlan0
iface wlan0 inet dhcp
pre-up devmem 0x100C0080 32 0x530
pre-up echo 7 > /sys/class/gpio/export
pre-up echo out > /sys/class/gpio/gpio7/direction
pre-up echo 0 > /sys/class/gpio/gpio7/value
pre-up modprobe mac80211
pre-up modprobe mt7601sta
pre-up (sleep 3; wpa_supplicant -B -D wext -i wlan0 -c /etc/wpa_supplicant.conf)
post-down killall -q wpa_supplicant
@brainstorm
brainstorm / usb_printer_epson_wireshark_dissector.lua
Created September 3, 2022 14:31
Wireshark EPSON USB printer dissector
usb_printer_epson_protocol = Proto("USB_PRINTER_EPSON", "USB printer EPSON")
local printjob_payload = ProtoField.none("usb_printer_epson.payload", "Payload", base.HEX)
usb_printer_epson_protocol.fields = { printjob_payload }
function usb_printer_epson_protocol.dissector(buffer, pinfo, tree)
length = buffer:len()
--- We are only interested on the 16KB BULK transfers as they contain the PDF being sent?
if length < 10000 then return end
@brainstorm
brainstorm / esp32_promisc.c
Last active July 26, 2023 19:18
esp32 promiscuous mode and packet injection experiments
// Espressif ESP32 promiscuous mode and packet injection experiments
// by brainstorm at nopcode org
#include "freertos/FreeRTOS.h"
#include "esp_wifi.h"
#include "esp_wifi_internal.h"
#include "lwip/err.h"
#include "esp_system.h"
#include "esp_event.h"
#include "esp_event_loop.h"
@brainstorm
brainstorm / openocd_xpc56_session.md
Last active June 10, 2023 14:32
Hyundai CCM OpenOCD

First clone this OpenOCD fork which contains patches for our target board:

git clone https://github.com/calandoa/openocd && cd openocd

Then apply some fixes/patch to the code above:

diff --git a/configure.ac b/configure.ac
@brainstorm
brainstorm / evse-greenphy-tl-pa4010.txt
Last active May 30, 2023 11:34
GreenPHY-compatible TP-Link TL-PA4010 open-plc EVSE-readyness howto
root@ubuntu:/home/ubuntu/dev/open-plc-utils/plc# ip -c link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether 08:00:27:ab:95:77 brd ff:ff:ff:ff:ff:ff
5: enx9cbf0d001240: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether 9c:bf:0d:00:12:40 brd ff:ff:ff:ff:ff:ff
; EVSE PLC board
root@ubuntu:/home/ubuntu/dev/open-plc-utils/plc# ./plcstat -t -i enx9cbf0d001240
@brainstorm
brainstorm / openpnp_opencv.patch
Created May 13, 2023 00:33
Apple Silicon OpenCV patch for OpenPnP
From 31eeed709cde9b32882cb4d0b9ab40e19cb6f537 Mon Sep 17 00:00:00 2001
From: Roman Valls Guimera <brainstorm@nopcode.org>
Date: Sun, 16 May 2021 21:14:21 +1000
Subject: [PATCH 01/17] Technically not sure it falls under ARMv8 for the M1,
should be AARCH64
---
src/main/java/nu/pattern/OpenCV.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
@brainstorm
brainstorm / minio_quickstart.md
Last active May 2, 2023 05:30
minio quickstart
% brew install minio
% brew install
% minio server /tmp
ERROR Unable to use the drive /tmp: drive is not directory or mountpoint: Invalid arguments specified
% minio server /tmp/foo
% export AWS_SECRET_ACCESS_KEY=minioadmin
% export AWS_ACCESS_KEY_ID=minioadmin
% aws s3 mb --endpoint-url http://192.168.1.109:9000/ s3://bucket
make_bucket: bucket
@brainstorm
brainstorm / gist:736c138d60b420c30c7c942ab05fbe14
Created October 8, 2020 03:48
Rust htsget-aws compile times on OSX, Macbook Air, 1.6 GHz Dual-Core Intel Core i5
(base) rvalls@umccr htsget-aws % time cross build --release --target x86_64-unknown-linux-musl
Updating git submodule `https://github.com/samtools/htslib.git`
Compiling libc v0.2.73
Compiling cfg-if v0.1.10
Compiling autocfg v1.0.0
Compiling proc-macro2 v1.0.19
Compiling unicode-xid v0.2.1
Compiling syn v1.0.35
Compiling lazy_static v1.4.0
Compiling log v0.4.11
@brainstorm
brainstorm / vscode-aws
Last active November 7, 2020 13:44
Poor man's vscode on AWS launch script
#!/bin/bash -x
## TODO:
# *** Just use this instead of this pestilent bash script: https://pypi.org/project/cdk-spot-one/ ***
# Monitor when and if the spot request is cancelled by AWS. Default shutdown behaviour is Stop so filesystems are kept intact, only connections die.
# 1. Launches instance w/ launch template and public VPC
# 2. Waits for spot request status to change to active/fulfilled
# 3. Gets public ip address for instance
@brainstorm
brainstorm / Makefile
Last active May 7, 2020 06:45
htslib access (un)compressed offsets, now with newest htslib featuring hts_idx_load3 method.
all:
${CC} -g -Wall -I. -L. -I../rust-htslib/hts-sys/htslib -L../rust-htslib/hts-sys/htslib -I/usr/local/opt/bzip2/include -I/usr/local/Cellar/curl-openssl/7.68.0/include -I/usr/local/Cellar/xz/5.2.4/include -I/usr/local/opt/zlib/include s3_htslib.c -o s3_htslib -llzma -lz -lbz2 -lhts
clean:
rm s3_htslib