Alex Balgavy

Just some stuff about me.

Here's my dotfiles repository.

Check out my blog.

My keys: PGP, SSH

My crypto wallets (BTC, XMR)


What links here:

Sorting phones supported by LineageOS

I want to figure out which phone to get that’s supported by LineageOS, depending on its features.

Retrieve data:

printf '' > /tmp/devicelist.html
curl -sL https://wiki.lineageos.org/devices/ \
  | pup 'div.devices a attr{href}' \
  | sed 's!^!https://wiki.lineageos.org!' \
  | sort -u \
  | while read -r device; do
  printf "Processing: %s\n" "$device"
  curl -sL "$device" | pup 'table.deviceinfo' >> /tmp/devicelist.html
done

Parse:

require 'nokogiri'
doc = Nokogiri::HTML(File.read('/tmp/devicelist.html'))

def filter_phones doc, release_year
  devs = doc.css("table:has(td:contains(' #{release_year}'))")
  # I want a minimum of 128 gb
  enough_storage = devs.select { |dev| dev.css('th:contains("Storage")+td:contains("128")').length > 0 }
  # I also want a card slot
  has_card = enough_storage.select { |dev| dev.css('th:contains("SD ")').length > 0 }
  models = has_card.map { |dev| dev.css('tbody tr:first-child').text.strip }.map {|s| "- #{s}"}
  return models
end

# Latest releases
puts "<details>\n<summary>Current output</summary>"
in2022 = filter_phones doc, 2022
puts "2022:\n#{in2022.join("\n")}" unless in2022.empty?
in2021 = filter_phones doc, 2021
puts "2021:\n#{in2021.join("\n")}" unless in2021.empty?
in2020 = filter_phones doc, 2020
puts "2020:\n#{in2020.join("\n")}" unless in2020.empty?
in2019 = filter_phones doc, 2019
puts "2019:\n#{in2019.join("\n")}" unless in2019.empty?
puts "</details>"
Current output 2021:
  • Fairphone 4 (FP4)
  • Samsung Galaxy A52 4G (a52q)
  • Samsung Galaxy A72 (a72q)
  • Xiaomi Mi 10T Lite / Mi 10i / Redmi Note 9 Pro 5G (gauguin)
  • Xiaomi 11 Lite 5G NE / 11 Lite NE 5G / Mi 11 LE (lisa)
  • Xiaomi POCO M2 Pro / Redmi Note 9S / Redmi Note 9 Pro / Redmi Note 9 Pro Max / Redmi Note 10 Lite (miatoll)
  • Motorola edge s / moto g100 (nio)
  • Xiaomi Mi 11 Lite 5G (renoir)
  • Xiaomi POCO X3 Pro (vayu)

2020:

  • SHIFT SHIFT6mq (axolotl)
  • Xiaomi Mi 10T Lite / Mi 10i / Redmi Note 9 Pro 5G (gauguin)
  • Samsung Galaxy Tab S6 Lite (LTE) (gta4xl)
  • Samsung Galaxy Tab S6 Lite (Wi-Fi) (gta4xlwifi)
  • Motorola moto g 5G / one 5G ace (kiev)
  • Motorola one fusion+ (liber)
  • Xiaomi POCO M2 Pro / Redmi Note 9S / Redmi Note 9 Pro / Redmi Note 9 Pro Max / Redmi Note 10 Lite (miatoll)
  • Motorola moto g 5G plus / one 5G (nairo)
  • Sony Xperia 1 II (pdx203)
  • Sony Xperia 5 II (pdx206)
  • Motorola edge (racer)
  • Xiaomi POCO X3 NFC (surya)

2019:

  • ASUS Zenfone 6 (ZS630KL) (I01WD)
  • Realme 3 Pro (RMX1851)
  • Samsung Galaxy S10e (beyond0lte)
  • Samsung Galaxy S10 (beyond1lte)
  • Samsung Galaxy S10+ (beyond2lte)
  • Xiaomi Redmi Note 8 / 8T (ginkgo)
  • Samsung Galaxy Tab S5e (LTE) (gts4lv)
  • Samsung Galaxy Tab S5e (Wi-Fi) (gts4lvwifi)
  • Motorola one vision / p50 (kane)
  • Xiaomi Redmi Note 7 (lavender)
  • F(x)tec Pro¹ (pro1)
  • Xiaomi Mi CC 9 / Mi 9 Lite (pyxis)
  • Motorola one action (troika)
  • Xiaomi Redmi Note 7 Pro (violet)
  • Lenovo Z6 Pro (zippo)