Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Roman Valls Guimera brainstorm

🏠
Working from home
View GitHub Profile
@brainstorm
brainstorm / esp32_promisc.c
Last active Sep 11, 2021
esp32 promiscuous mode and packet injection experiments
View esp32_promisc.c
// 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 / gist:736c138d60b420c30c7c942ab05fbe14
Created Oct 8, 2020
Rust htsget-aws compile times on OSX, Macbook Air, 1.6 GHz Dual-Core Intel Core i5
View gist:736c138d60b420c30c7c942ab05fbe14
(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 Nov 7, 2020
Poor man's vscode on AWS launch script
View vscode-aws
#!/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
htslib access (un)compressed offsets, now with newest htslib featuring hts_idx_load3 method.
View Makefile
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
@brainstorm
brainstorm / anritsu_bootlog.txt
Last active Apr 13, 2020
Anritsu builtin telnet debugger
View anritsu_bootlog.txt
[25 Sep 2019 at 22:14:46]:
...-> max contiguous free space: 26,544,177,156 bytes
# of files: 1,348
# of folders: 133
total bytes in files: 115,534 Kb
# of lost chains: 0
total bytes in lost chains: 0
Checking for log file (/card0/sys/evt/evt.log)
Purge old events: Found 11 events in the log
Initializing keypad driver
View gist:d41fb302f05a7f277a99cfdc82f60d83
$ brew test-bot --skip-setup --root-url=https://dl.bintray.com/brainstorm/bottles-musl-cross --bintray-org=brainstorm --tap=brainstorm/musl-cross
Homebrew/homebrew-test-bot fe05361 (Merge pull request #338 from Bo98/dep_no_dev)
ARGV: --skip-setup --root-url=https://dl.bintray.com/brainstorm/bottles-musl-cross --bintray-org=brainstorm --tap=brainstorm/musl-cross
Homebrew.args: #<Homebrew::CLI::Args argv=["test-bot", "--skip-setup", "--root-url=https://dl.bintray.com/brainstorm/bottles-musl-cross", "--bintray-org=brainstorm", "--tap=brainstorm/musl-cross"], remaining=[], cmdline_args=["--skip-setup", "--root-url=https://dl.bintray.com/brainstorm/bottles-musl-cross", "--bintray-org=brainstorm", "--tap=brainstorm/musl-cross"], skip_setup?=true, root_url="https://dl.bintray.com/brainstorm/bottles-musl-cross", bintray_org="brainstorm", tap="brainstorm/musl-cross">
Error: No known CI provider detected! If you are using GitHub Actions or Jenkins
ghprb-plugin, then we cannot find the expected environment
variables! Ch
@brainstorm
brainstorm / c2rust_reg2bins.rs
Last active Jan 16, 2020
SAMv1 specification: C, C2Rust and Rust source code for computing bin number and overlapping bins
View c2rust_reg2bins.rs
#![allow(dead_code, mutable_transmutes, non_camel_case_types, non_snake_case,
non_upper_case_globals, unused_assignments, unused_mut)]
#![register_tool(c2rust)]
#![feature(register_tool)]
pub type __uint16_t = libc::c_ushort;
pub type uint16_t = __uint16_t;
#[no_mangle]
pub unsafe extern "C" fn reg2bins(mut beg: libc::c_int, mut end: libc::c_int,
mut list: *mut uint16_t) -> libc::c_int {
let mut i: libc::c_int = 0 as libc::c_int;
@brainstorm
brainstorm / pcgr.service
Last active Oct 22, 2019
systemd with python3 virtualenv does not find modules
View pcgr.service
(venv) ubuntu@localhost:/etc/systemd/system$ sudo cat pcgr.service
[Unit]
Description=PCGR sample consumer process
After=network-online.target
[Service]
Type=simple
WorkingDirectory=/home/ubuntu
ExecStart=/mnt/pcgr/venv/bin/python3 /mnt/pcgr/pcgr_consumer.py pcgr ap-southeast-2 pcgr 10 10 /home/ubuntu
@brainstorm
brainstorm / anritsu_symbols_dump.py
Created Aug 17, 2019
Anritsu MS2721B quick and dirty over-telnet symbol enumeration
View anritsu_symbols_dump.py
#!/usr/bin/env python
import re
import csv
import telnetlib
from collections import defaultdict
## EXAMPLE FROM MS2721B telnet session
TEST_PAYLOAD='''lkAddr 0\r\n0x0c002000 _usrEntry text \r\n0x0c002040 _sysInit text \r\n0x0c002064 _intPrioTable text \r\n0x0c0
0216c _intPrioTableSize text \r\n0x0c002180 _ataDrv text \r\n0x0c002e40 _ataDevCreate text \r\n0x0c0030c0 _ataRawio
@brainstorm
brainstorm / fix_osx_pcbnew_kicad_libs.sh
Created Sep 1, 2017
Fix KiCAD's pcbnew python scripting support for OSX
View fix_osx_pcbnew_kicad_libs.sh
#!/bin/bash
# Inspired on: https://www.bountysource.com/issues/31269729-libwx_osx_cocoau-3-1-dylib-not-found
KICAD_LIBS_TOFIX="libwx_osx_cocoau_gl-3.0.0 libwx_osx_cocoau_adv-3.0.0 libwx_osx_cocoau_aui-3.0.0 libwx_osx_cocoau_adv-3.0.0 libwx_osx_cocoau_html-3.0.0 libwx_osx_cocoau_core-3.0.0 libwx_osx_cocoau_stc-3.0.0 libkicad_3dsg.2.0.0 libGLEW.2.0.0 libcairo.2 libpixman-1.0 libwx_baseu_net-3.0.0 libwx_baseu-3.0.0 libwx_baseu_xml-3.0.0"
#KICAD_LIBS_TOFIX=`find /Applications/Kicad/kicad.app/Contents/Frameworks/ -iname *.dylib | xargs otool -L | grep executable_path | awk '{print $1}' | awk -F'/' '{print $4}'`
for kicadlib in $KICAD_LIBS_TOFIX;
do
echo "Fixing ${kicadlib} broken path on pcbnew..."