Skip to content

Instantly share code, notes, and snippets.

@Juul
Juul / lte_mbim_from_scratch.md
Last active May 6, 2024 15:17
How to use 4G LTE modems like the MC7455 on both Debian/Ubuntu and OpenWRT using MBIM

The purpose of this document is to get you familiar with the concepts and command line tools involved with connecting to the internet using modern 4G LTE modems on both Debian/Ubuntu and OpenWRT.

This writeup is based on my experiences with the Sierra Wireless AirPrime MC7455 modem and a Calyx (Sprint) SIM card, but it should apply to most modern 4G LTE modems.

High level overview

These are the steps required:

  • Physically connect antennas
@Juul
Juul / luks2_to_luks1.md
Last active March 15, 2024 09:47
Converting LUKS2 to LUKS1

If you want to use GRUB to unlock your encrypted drive on boot then you likely want to use LUKS1 instead of LUKS2. If you already have a LUKS2 partition, most guides around the web will tell you that you simply have to convert your keys to PBKDF2 before you can convert a LUKS2 partition to LUKS1, however, as seen in this bug report, that's not quite the whole truth.

Run luksDump:

cryptsetup luksDump /dev/<your_device>

You will get output like this:

@Juul
Juul / amazon_fire_2015_7_inc_lineageos_install.md
Last active March 3, 2024 01:32
How to install install LineageOS on a 2015 7" Amazon Fire tablet

This is a guide for getting LineageOS (an older and unofficial version) onto an Amazon Fire 2015 7" tablet (also known as the 5th generation 7" Amazon Fire or under the internal codename "ford").

NOTE: This guide was originally written before someone figured out how to unlock the bootloader. There is now a newer method. Here it is very briefly. The old guide can be found below.

Unlocked bootloader method

First unlock the bootloader using this guide.

Once you're booted into TWRP download the latest LineageOS 14 release for your device here.

@Juul
Juul / wds_bridge_notes.md
Last active December 6, 2023 13:00
4-address mode aka WDS for OpenWRT

To turn a router into a bridge between wifi and ethernet, with the router being a wifi client/station, you need 4-address mode aka Wireless Distributions System or WDS.

This does not necessarily work between vendors so make sure your AP and client use chips from the same manufacturer.

It seems that enabling WDS on an AP's wifi interface does not prevent non-WDS clients from connecting normally, at least in my limited experience.

On the AP you simply add option wds '1' to the relevant wifi-iface section. E.g:

config wifi-iface 'default_radio0'
@Juul
Juul / gpib_linux_82350.md
Last active October 27, 2023 10:11
Guide for setting up GPIB support in Linux for the HP/Agilent 82350 A and B PCI cards

This is a guide for getting the HP/Agilent 82350 A or B GPIB cards working on Linux.

There are other guides made by other people for a couple of other GPIB adapters here:

Unfortunately the mainline Linux kernel does not have any GPIB support. Even more unfortunate is that neither Ubuntu nor Debian appear to have packages for the kernel modules nor do any third-party apt repos appear to exist that are remotely up to date.

@Juul
Juul / openwrt_dsa_vlan_config.md
Created April 20, 2021 14:03
Overview of VLAN config on OpenWRT using DSA

This a quick guide to configuring tagged VLAN using DSA on OpenWRT routers with a switch and only a single physical ethernet port.

This was tested on a Xiaomi Redmi AC2100 (MT7621 chipset) running OpenWRT Snapshot from April 19th 2021.

Here's how you make an interface lan3.2 which will send tagged packets on lan port 3. This assumes the lan port 3 interface is called lan3.

config interface 'pub'
        option ifname 'lan3.2'
@Juul
Juul / autossh_reverse_tunnel.md
Last active September 24, 2023 06:40
How to configure a reverse SSH tunnel that auto-establishes and auto-reconnects

This is a brief guide on how to configure an SSH reverse tunnel that automatically establishes on boot and will continuously attempt to re-connect when it fails.

It is very useful if you are deploying a device somewhere without a public IP, e.g. behind a NAT, and need to be able to SSH into it from the wider internet.

Let's refer to the NAT'ed device as the client. This guide assumes that the client is able to create outgoing SSH connections to at least destination port 443.

You will need root access to a server with a static IP on the internet which runs an openssh server.

On my-server.example.com add the following to /etc/ssh/sshd_config, changing tunnel-user to whichever username you want to use (this will be a new user, not an exising user) and changing the PermitOpen line:

@Juul
Juul / ssh-copy-id-openwrt
Last active August 23, 2023 11:10
ssh-copy-id but for openwrt / dropbear
#!/bin/sh
if [ "$#" -ne 1 ]; then
echo "Example: ${0} root@192.168.1.1"
exit 1
fi
cat ~/.ssh/id_rsa.pub | ssh ${1} "cat >> /etc/dropbear/authorized_keys && chmod 0600 /etc/dropbear/authorized_keys && chmod 0700 /etc/dropbear"

The banana pi m1 works with the cheap ~$15 chinese 5 port sata multipliers.

Warning: The multipliers will get really hot and unreliable under load or if more than three drives are attached. Definitely put at least a heatsink on it.

With the official bananian distro it appears to work out of the box but it unfortunately only works with one drive at a time.

To get it working with multiple drives you need to enable the sunxi pmp support. The reason this is not enabled per default is that when it is enabled you will be unable to use the sata port without a port multiplier.

The kernel in the official bananian distro does not have sunxi pmp support compiled into it and the kernel is too old anyway.

@Juul
Juul / how_to_autorandr.md
Last active July 20, 2023 02:09
How to automatically change screen setup when docking/undocking

The tool autorandr can save configurations for various monitor setups and load them based on what's plugged in, or be used to manually load a saved configuration.

Use the latest version of autorandr. The version in Ubuntu 20.04 didn't work for me. To install:

sudo pip3 install "git+http://github.com/phillipberndt/autorandr#egg=autorandr"

Then for each monitor configuration, plug monitors in as needed and configure them correctly manually, then run: