<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:base="en">
    <title>Technically Competent</title>
    <subtitle>I dunno something</subtitle>
    <link href="https://technicallycompetent.com/feed.xml" rel="self"/>
    <link href="https://technicallycompetent.com/"/>
    <updated>2026-06-13T18:52:26Z</updated>
    <id>https://technicallycompetent.com/</id>
    <author>
        <name>mtfurlan</name>
        <email>contact@technicallycompetent.com</email>
    </author>
    
    <entry>
        <title>debian trixie luks unlock with dropbear-initramfs</title>
        <link href="https://technicallycompetent.com/blog/debian-dropbear-initramfs/"/>
        <updated>2026-06-13T18:52:26Z</updated>
        <id>https://technicallycompetent.com/blog/debian-dropbear-initramfs/</id>
        <content type="html">&lt;p&gt;I have a lot of computers with luks encrypted root drives
Setting them up to allow ssh unlock was less easy than could be hoped&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;a href=&quot;UPDATE&quot;&gt;UPDATE&lt;/a&gt;: fun fact if the computer doesn&#39;t have network, it will block for somewhere between 60 and 240 seconds on boot, even after typing the password
&lt;a href=&quot;https://groups.google.com/g/linux.debian.bugs.dist/c/8Yt_Kkc-DzQ&quot;&gt;https://groups.google.com/g/linux.debian.bugs.dist/c/8Yt_Kkc-DzQ&lt;/a&gt;
Not sure what to do about this yet, setting IP on the kernel boot line doesn&#39;t seem to do anything, but removing IP=dhcp from  initramfs.conf seems to have kept IP stuff enabled, but it doesn&#39;t wait forever?
I haven&#39;t confirmed dropbear still works&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;the &lt;a href=&quot;https://wiki.debian.org/DropBear&quot;&gt;debian wiki&lt;/a&gt; has some information, but it&#39;s not complete, and is overly complicated in a few ways&lt;/p&gt;
&lt;p&gt;here is what I did:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;apt install dropbear-initramfs
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;have the kernel do dhcp on boot (docs &lt;a href=&quot;https://www.kernel.org/doc/Documentation/filesystems/nfs/nfsroot.txt&quot;&gt;online&lt;/a&gt; or at &lt;code&gt;/usr/share/doc/linux-doc/Documentation/admin-guide/nfs/nfsroot.rst.gz&lt;/code&gt;:
&lt;code&gt;/etc/initramfs-tools/initramfs.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;IP=dhcp
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;configure dropbear
&lt;code&gt;/etc/dropbear/initramfs/dropbear.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# -I 180 : Disconnect the session if no traffic is transmitted or received in 180 seconds.
# -j : Disable ssh local port forwarding.
# -k : Also disable remote port forwarding.
# -c cryptroot-unlock : Disregard the command provided by the user and always run forced_command.
DROPBEAR_OPTIONS=&amp;quot;-I 180 -j -k -c cryptroot-unlock&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;setup the dropbear keys to be the same as the system keys, and use the user&#39;s authorized_keys as the dropbear authorized_keys&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo rm /etc/dropbear/initramfs/dropbear_*
sudo dropbearconvert openssh dropbear /etc/ssh/ssh_host_ecdsa_key /etc/dropbear/initramfs/dropbear_ecdsa_host_key
sudo dropbearconvert openssh dropbear /etc/ssh/ssh_host_rsa_key /etc/dropbear/initramfs/dropbear_rsa_host_key
sudo ln -s $HOME/.ssh/authorized_keys /etc/dropbear/initramfs/
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I tried to set a password or the username, but wasn&#39;t able to get it working&lt;/p&gt;
&lt;p&gt;it&#39;s going to be some kind of patch to &lt;code&gt;/usr/share/initramfs-tools/scripts/init-bottom/dropbear&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;update initramfs&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;update-initramfs -c -k all
&lt;/code&gt;&lt;/pre&gt;
</content>
    </entry>
    
    <entry>
        <title>US resident credit agency &amp; information broker todo list</title>
        <link href="https://technicallycompetent.com/blog/information-broker-todo/"/>
        <updated>2026-02-13T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/information-broker-todo/</id>
        <content type="html">&lt;p&gt;This is a list of places you should have accounts to prevent fraud as well as
information brokers and credit agencies you should freeze for both fraud and
privacy reasons.&lt;/p&gt;
&lt;p&gt;It&#39;s based on Brian Krebs&#39; posts as well as the Consumer Financial Protection
Bureau&#39;s (CFBP) list of consumer reporting companies&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.consumerfinance.gov/consumer-tools/credit-reports-and-scores/consumer-reporting-companies/companies-list/&quot;&gt;CFBP: List of consumer reporting companies&lt;/a&gt; last updated 2025 January&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://krebsonsecurity.com/2020/08/why-where-you-should-you-plant-your-flag/&quot;&gt;Krebs on Security: Why &amp;amp; Where You Should Plant Your Flag&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://krebsonsecurity.com/2018/09/credit-freezes-are-free-let-the-ice-age-begin/&quot;&gt;Krebs on Security: Credit Freezes are Free: Let the Ice Age Begin&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://krebsonsecurity.com/2018/05/another-credit-freeze-target-nctue-com/&quot;&gt;Krebs on Security: Think You’ve Got Your Credit Freezes Covered? Think Again.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://krebsonsecurity.com/2017/11/how-to-opt-out-of-equifax-revealing-your-salary-history/&quot;&gt;Krebs on Security: How to Opt Out of Equifax Revealing Your Salary History&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You also should log into all the stupid accounts every year or two, because they
randomly unfreeze, or even sometimes delete your account.&lt;/p&gt;
&lt;p&gt;Never give any of them money for anything, it&#39;s all free.&lt;/p&gt;
&lt;p&gt;The descriptions of companies and the data they track are either directly or
slightly edited from the CFPB list.&lt;/p&gt;
&lt;h2&gt;Places you must have accounts&lt;/h2&gt;
&lt;h3&gt;Credit Reporting&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.equifax.com/personal/credit-report-services/&quot;&gt;Equifax&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.experian.com/freeze/center.html#content-01&quot;&gt;Experian&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://service.transunion.com/dss/orderStep1_form.page&quot;&gt;TransUnion&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.innovis.com/personal/securityFreeze&quot;&gt;Innovis&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Government&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.ssa.gov/myaccount/&quot;&gt;SSA&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://sa.www4.irs.gov/ola/&quot;&gt;IRS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;state DMV/SOS&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://informeddelivery.usps.com/box/pages/intro/start.action&quot;&gt;USPS informed delivery&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Companies&lt;/h3&gt;
&lt;p&gt;Even if you don&#39;t use the online account, make it so someone else can&#39;t.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;all your utilities&lt;/li&gt;
&lt;li&gt;all your financial institutions&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Places you should place a freeze / opt out&lt;/h2&gt;
&lt;h3&gt;Misc&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.chexsystems.com/&quot;&gt;ChexSystems&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;Used by financial institutions and lenders&lt;/li&gt;
&lt;li&gt;Provides data on checking account applications, openings, and closures,
including reasons for account closure&lt;/li&gt;
&lt;li&gt;Chex Systems is owned by the eFunds subsidiary of Fidelity National
Information Services, Inc. (FNIS)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://nctueconsumerportal.com/&quot;&gt;NCTUE&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;National Consumer Telecommunications and Utilities Exchange&lt;/li&gt;
&lt;li&gt;This consortium of member companies collects and shares information on new
telecom and utility connect requests, paid-as-agreed and past-due account
and payment histories including delinquencies and charge-offs, associated
with telecommunications, pay TV, and utility (electric, gas, water)
services&lt;/li&gt;
&lt;li&gt;Equifax Information Services is the contracted servicer that manages the
NCTUE database on its members behalf. Equifax is not a member of the NCTUE&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.optoutprescreen.com/&quot;&gt;opt out of pre-approved offers&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;blockquote&gt;
&lt;p&gt;ID thieves like to intercept offers of new credit and insurance sent via
postal mail, so it’s a good idea to opt out of pre-approved credit offers.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://consumer.risk.lexisnexis.com/freeze&quot;&gt; LexisNexis Risk Solutions / LexisNexis C.L.U.E. &amp;amp; Telematics OnDemand /
SageStream LLC&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;three things that combined sometime between 2025 January and 2026 Febuary&lt;/li&gt;
&lt;li&gt;Used by auto lenders, credit cards, retailers, mobile phone
providers, insurance, financial institutions, healthcare providers,
government agencies&lt;/li&gt;
&lt;li&gt;data about auto lenders, credit card issues, retailers, utitlies, mobile
phone, several years of auto and personal property claims, Telematics
OnDemand driving behavior, real estate transaction/ownership, lein,
jusgement, bankrupcy, professional license&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;work history reporting&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://blend.com/insights/&quot;&gt;Blend Insights&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;Used by lenders&lt;/li&gt;
&lt;li&gt;Provides consumer permissioned employment, income and bank asset
verification&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://fadv.com/candidates/free-report/&quot;&gt;First Advantage Corporation&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;Provides background screening and post-hire workforce monitoring services&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;employees.theworknumber.com&quot;&gt;The Work Number&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;Used by employers, government agencies (determine an applicant&#39;s
eligibility for public assistance programs), and lenders&lt;/li&gt;
&lt;li&gt;Provides employment and income information, collected from employers and
payroll processors&lt;/li&gt;
&lt;li&gt;Equifax Workforce Solutions, LLC (EWS), formerly known as TALX Corporation,
is a wholly owned subsidiary of Equifax&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;More information reporting companies&lt;/h2&gt;
&lt;p&gt;It is probably also a good idea to go through the &lt;a href=&quot;https://www.consumerfinance.gov/consumer-tools/credit-reports-and-scores/consumer-reporting-companies/companies-list/&quot;&gt;full CFBP list&lt;/a&gt; and request your reports to check for inaccuracies as they
recommend.&lt;/p&gt;
&lt;h2&gt;Incorrect Information&lt;/h2&gt;
&lt;p&gt;If one of these places has incorrect information, you should file a dispute.
If they refuse, or don&#39;t respond in 45 days, you should &lt;a href=&quot;https://www.consumerfinance.gov/complaint/&quot;&gt;submit a complaint to the CFPB&lt;/a&gt;.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>Backup Solution Comparison</title>
        <link href="https://technicallycompetent.com/blog/backup-comparison/"/>
        <updated>2026-01-07T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/backup-comparison/</id>
        <content type="html">&lt;p&gt;I would really like backups on so many things&lt;/p&gt;
&lt;p&gt;Comparison Criteria:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;incremental backups&lt;/li&gt;
&lt;li&gt;encrypted&lt;/li&gt;
&lt;li&gt;show versions of a file&lt;/li&gt;
&lt;li&gt;get a version of a file&lt;/li&gt;
&lt;li&gt;prune backups reducing over time, not just older than&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Comparison&lt;/h2&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;&lt;a href=&quot;https://duplicity.gitlab.io/docs.html&quot;&gt;Duplicity&lt;/a&gt;&lt;/th&gt;
&lt;th&gt;&lt;a href=&quot;https://borgbackup.readthedocs.io/en/stable/&quot;&gt;borg&lt;/a&gt;&lt;/th&gt;
&lt;th&gt;&lt;a href=&quot;https://github.com/gilbertchen/duplicacy&quot;&gt;Duplicacy&lt;/a&gt;&lt;/th&gt;
&lt;th&gt;&lt;a href=&quot;https://rdiff-backup.net/&quot;&gt;rdiff-backup&lt;/a&gt;&lt;/th&gt;
&lt;th&gt;&lt;a href=&quot;https://github.com/rclone/rclone&quot;&gt;rclone&lt;/a&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;started&lt;/td&gt;
&lt;td&gt;2002&lt;/td&gt;
&lt;td&gt;2015&lt;/td&gt;
&lt;td&gt;2016&lt;/td&gt;
&lt;td&gt;2001&lt;/td&gt;
&lt;td&gt;2014&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;license&lt;/td&gt;
&lt;td&gt;gpl&lt;/td&gt;
&lt;td&gt;bsd&lt;/td&gt;
&lt;td&gt;free for persnal use&lt;/td&gt;
&lt;td&gt;gpl&lt;/td&gt;
&lt;td&gt;MIT&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;encryption&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;td&gt;no&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;incremental&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;td&gt;no?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;show file versions&lt;/td&gt;
&lt;td&gt;reasonable commands&lt;/td&gt;
&lt;td&gt;fuse mount maybe sometimes&lt;/td&gt;
&lt;td&gt;git like, but bad in other ways (see notes)&lt;/td&gt;
&lt;td&gt;reasonable commands&lt;/td&gt;
&lt;td&gt;n/a&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;backend&lt;/td&gt;
&lt;td&gt;any&lt;/td&gt;
&lt;td&gt;borg&lt;/td&gt;
&lt;td&gt;any&lt;/td&gt;
&lt;td&gt;sftp/rsync&lt;/td&gt;
&lt;td&gt;anything&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;prune mode&lt;/td&gt;
&lt;td&gt;age, count&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Backup_rotation_scheme#Grandfather-father-son&quot;&gt;GFS&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;GFS&lt;/td&gt;
&lt;td&gt;age, count&lt;/td&gt;
&lt;td&gt;n/a&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;website vibes&lt;/td&gt;
&lt;td&gt;mature software&lt;/td&gt;
&lt;td&gt;new but alright&lt;/td&gt;
&lt;td&gt;trying to sell you something&lt;/td&gt;
&lt;td&gt;mature software&lt;/td&gt;
&lt;td&gt;mature software&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;abandonment vibes&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;one commit in 2025, many ignored PRs and issues&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;debian packaging&lt;/td&gt;
&lt;td&gt;3.0.4 vs 3.0.6.3&lt;/td&gt;
&lt;td&gt;1.4.0 vs 1.4.3&lt;/td&gt;
&lt;td&gt;github release binary&lt;/td&gt;
&lt;td&gt;2.2.6 vs 2.2.6&lt;/td&gt;
&lt;td&gt;1.60.1 vs 1.72.1&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;&lt;a href=&quot;https://restic.net/&quot;&gt;restic&lt;/a&gt;&lt;/th&gt;
&lt;th&gt;&lt;a href=&quot;https://github.com/bup/bup&quot;&gt;bup&lt;/a&gt;&lt;/th&gt;
&lt;th&gt;&lt;a href=&quot;https://docs.duplicati.com/&quot;&gt;duplicati&lt;/a&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;started&lt;/td&gt;
&lt;td&gt;2019&lt;/td&gt;
&lt;td&gt;2010&lt;/td&gt;
&lt;td&gt;2008&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;license&lt;/td&gt;
&lt;td&gt;BSD-2&lt;/td&gt;
&lt;td&gt;LGPL v2&lt;/td&gt;
&lt;td&gt;MIT ish paid&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;encryption&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;no&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;incremental&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;show file versions&lt;/td&gt;
&lt;td&gt;only compare snapshots&lt;/td&gt;
&lt;td&gt;maybe &lt;code&gt;bup ls&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;backend&lt;/td&gt;
&lt;td&gt;sftp / rclone / cloud&lt;/td&gt;
&lt;td&gt;ssh + remote &lt;code&gt;bup&lt;/code&gt;?&lt;/td&gt;
&lt;td&gt;any&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;prune mode&lt;/td&gt;
&lt;td&gt;GFS, age&lt;/td&gt;
&lt;td&gt;age&lt;/td&gt;
&lt;td&gt;GFS, age, count&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;website vibes&lt;/td&gt;
&lt;td&gt;readthedocs&lt;/td&gt;
&lt;td&gt;mature&lt;/td&gt;
&lt;td&gt;sales pitch fuckery&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;abandonment vibes&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;debian packaging&lt;/td&gt;
&lt;td&gt;0.18.0 vs 0.18.1&lt;/td&gt;
&lt;td&gt;0.33.7 vs 0.33.7&lt;/td&gt;
&lt;td&gt;download deb&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Options:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://duplicity.gitlab.io/docs.html&quot;&gt;Duplicity&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;stores original tarball and then differential tarballs&lt;/li&gt;
&lt;li&gt;&lt;code&gt;duplicity collection-status --file-changed &#39;filename&#39; &#39;remote-url&#39;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;reddit says it&#39;s slow, and based on the tar approach, that makes sense to me, and they talk about the downsides here: &lt;a href=&quot;https://duplicity.us/new_format.html&quot;&gt;https://duplicity.us/new_format.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://borgbackup.readthedocs.io/en/stable/&quot;&gt;borg&lt;/a&gt; née Attic&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/gilbertchen/duplicacy&quot;&gt;Duplicacy&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;research project&lt;/li&gt;
&lt;li&gt;looks like it has good cli interface for showing file history (history, diff, cat, list, etc)
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;duplicacy history $file&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Uses single dash with long arguments(&lt;code&gt;-storage &amp;lt;storage name&amp;gt;&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;duplicacy prune -keep 7:30      # Keep 1 snapshot every 7 days for snapshots older than 30 days&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;they have a nice if out of date &lt;a href=&quot;https://github.com/gilbertchen/duplicacy#comparison-with-other-backup-tools&quot;&gt;comparison of some backup solutions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Has really good revision &amp;amp; diff tools&lt;/li&gt;
&lt;li&gt;returns 0 even on failure, author suggests grepping the logs, but the error/warning logs are not consistant&lt;/li&gt;
&lt;li&gt;uses single dash for long options&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://rdiff-backup.net/&quot;&gt;rdiff-backup&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;mirrors the directory to $remoteBackupDir, and stores tracking data in $remoteBackupDir/rdiff-backup-data (&lt;code&gt;rdiff-backup-data/increments/file.2003-03-05T12:21:41-07:00.diff.gz&lt;/code&gt;, &lt;code&gt;rdiff-backup-data/session_statistics*&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;in the middle of a cli syntax migration, old cli has been removed but is still in docs as of 2025-12-19&lt;/li&gt;
&lt;li&gt;showing file history
&lt;ul&gt;
&lt;li&gt;files changed in last 5 days: &lt;code&gt;rdiff-backup list files --changed-since 5D $backupSpecifier/subdir&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;available versions of file: &lt;code&gt;rdiff-backup list increments $backupSpecifier/file&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;restore file file backed up from &lt;code&gt;$whatever/file&lt;/code&gt; to &lt;code&gt;/tmp/file&lt;/code&gt;
&lt;code&gt;rdiff-backup restore --at 10D $backupSpecifier/file /tmp/file&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://restic.net/&quot;&gt;restic&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;have to enter password every command?&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/bup/bup&quot;&gt;bup&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;must have &lt;code&gt;bup&lt;/code&gt; on remote server&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.duplicati.com/&quot;&gt;duplicati&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;CLI exclusively refers to backups by remote URL
&lt;ul&gt;
&lt;li&gt;Including credentials??&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Secrets handling is somewhere between &amp;quot;obtuse&amp;quot; and &amp;quot;actual garbage&amp;quot;&lt;/li&gt;
&lt;li&gt;GUI and CLI only kinda link maybe? or not at all?
&lt;ul&gt;
&lt;li&gt;CLI can&#39;t refer to backups with no encryption password???&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Exploring backups in the GUI is just not a thing&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Other&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://0xacab.org/liberate/backupninja&quot;&gt;backupninja&lt;/a&gt; is a tool to manage running backups aroiund borg or duplicity or whatever on a schedule including databases and stuff&lt;/li&gt;
&lt;/ul&gt;
</content>
    </entry>
    
    <entry>
        <title>Firefox Scrollbar configs</title>
        <link href="https://technicallycompetent.com/blog/firefox-scrollbars/"/>
        <updated>2025-12-05T17:22:07Z</updated>
        <id>https://technicallycompetent.com/blog/firefox-scrollbars/</id>
        <content type="html">&lt;p&gt;I don&#39;t like stupid tiny scrollbars.&lt;/p&gt;
&lt;p&gt;As of firefox 145.0.2, this is what I know.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://searchfox.org/firefox-release/source/modules/libpref/init/StaticPrefList.yaml&quot;&gt;documentation in comments&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;about:config&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# prevent websites from making scrollbars smaller
layout.css.scrollbar-width-thin.disabled = true

# set the scrollbar width
widget.non-native-theme.scrollbar.size.override = 30

# set scrollbar style
# 0. Default Platform scrollbar style
# 1. MacOS style
# 2. GTK scrollbars
# 3. Android style
# 4. Windows 10 style
# 5. Windows 11 style
# using 2 cause because of gtk config stuff
widget.non-native-theme.scrollbar.style = 2

# don&#39;t do scrollbars as overlays over content
# https://docs.gtk.org/gtk3/property.ScrolledWindow.overlay-scrolling.html
widget.gtk.overlay-scrollbars.enabled = false

# use square ends instead of round on GTK style scrollbars
widget.non-native-theme.gtk.scrollbar.round-thumb = false
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you want buttons, maybe look at &lt;a href=&quot;https://support.mozilla.org/en-US/questions/1420887&quot;&gt;this support forum thread&lt;/a&gt;, but I didn&#39;t try it&lt;/p&gt;
&lt;p&gt;Sources:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://techav.net/post/801587738081165312/what-documentation-exists-for-these-controls-is&quot;&gt;techav on tumblr&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://michael.kjorling.se/blog/2025/firefox-larger-scrollbars/&quot;&gt;Michael Kjörling&#39;s blog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
    </entry>
    
    <entry>
        <title>Converting google account to gmail account calendaring weirdness</title>
        <link href="https://technicallycompetent.com/blog/google2gmail/"/>
        <updated>2025-10-03T14:19:00Z</updated>
        <id>https://technicallycompetent.com/blog/google2gmail/</id>
        <content type="html">&lt;p&gt;I do email/calendar with a gmail account and a domain with a registrar that
does wild card forwarding and gmail sending aliases.
I don&#39;t think I can escape google because of the network effect on calendaring.&lt;/p&gt;
&lt;p&gt;For reasons, I needed to change what gmail account was behind everything, so I
tried creating a non-gmail google account with an email at my domain.&lt;/p&gt;
&lt;p&gt;I ran into calendaring issues when people not in the google ecosystem invited
me to things, because my old gmail account would receive the calendar event,
and would try to put it on the old gmail account calendar, not my domain email
google account calendar.&lt;/p&gt;
&lt;p&gt;So I converted the google account to a gmail account.&lt;/p&gt;
&lt;p&gt;The calendar page stopped loading, saying&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Uncaught (in promise) Error: Mismatch between primary calendar $gmailUser@gmail.com and user email $domainEmail.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Waiting half an hour fixed it.&lt;/p&gt;
&lt;p&gt;I had to enable &amp;quot;Allow responding to invitations forwarded through alternative
email addresses&amp;quot; because the primary account email had changed.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>Gmail with domain alias emails with DKIM/SPF/DMARC</title>
        <link href="https://technicallycompetent.com/blog/gmailAliasDMARC/"/>
        <updated>2025-10-03T14:19:00Z</updated>
        <id>https://technicallycompetent.com/blog/gmailAliasDMARC/</id>
        <content type="html">&lt;p&gt;For years, I have been handling email with a gmail account, having my dns
registrar forward all email to my domain to that account, and then adding
sending aliases to the gmail account to send mail.&lt;/p&gt;
&lt;p&gt;A few years ago gmail stopped doing the verification by just sending an email
to the email you wanted to send from and started requiring SMTP, but I could
just use an app password and smtp back to that gmail account and it seemed to be
working fine.&lt;/p&gt;
&lt;p&gt;Somewhere between 2025-09-12 and 2025-09-23 yahoo started rejecting the emails
because of SPF/DKIM failures.
Looking back, I had seen some warnings about this when I emailed my work
outlook email, or looking at google&#39;s original message view.&lt;/p&gt;
&lt;p&gt;It turns out I had SPF misalignment because &lt;code&gt;Return-Path: $gmailUser@gmail.com&lt;/code&gt;
and &lt;code&gt;From: $domainEmail&lt;/code&gt; didn&#39;t match.&lt;/p&gt;
&lt;p&gt;Google will mark this as SPF pass but DMARC fail, and in my brief testing it
will usually deliver but sometimes get marked as spam?&lt;/p&gt;
&lt;p&gt;The only way forward is to have someone else handle sending email properly.&lt;/p&gt;
&lt;p&gt;I ended up choosing &lt;a href=&quot;https://www.smtp2go.com/&quot;&gt;SMTP2GO&lt;/a&gt; because 1,000
emails/month on their free plain is fine for me.&lt;/p&gt;
&lt;p&gt;Steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;create account&lt;/li&gt;
&lt;li&gt;do the verified senders domain verification setup&lt;/li&gt;
&lt;li&gt;add smtp user&lt;/li&gt;
&lt;li&gt;in gmail add a sending alias with the smtp user&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;p&gt;Update 2026-02-17: I ended up moving to a paid google workspace because calendars kept working poorly with that setup.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>2025 openevse kit experience</title>
        <link href="https://technicallycompetent.com/blog/openevse-2025/"/>
        <updated>2025-07-05T18:32:06Z</updated>
        <id>https://technicallycompetent.com/blog/openevse-2025/</id>
        <content type="html">&lt;p&gt;I bought the [Advanced Series 48A Level 2 - SAE J1772 (Kit Bundle)](&lt;a href=&quot;https://store.openevse.com/collections/all-products/products/advanced-bundle&quot;&gt;https://store.openevse.com/collections/all-products/products/advanced-bundle&lt;/a&gt;] 2025-04-02.
I got it may 6, opened a support ticket may 7, and still haven&#39;t gotten a response as of 2025-07-05.&lt;/p&gt;
&lt;p&gt;what I got:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;OpenEVSE WiFi TFT LCD v1.0.1
&lt;ul&gt;
&lt;li&gt;it was glued to the enclosure, but it came broken off already&lt;/li&gt;
&lt;li&gt;the hardware doesn&#39;t appear to be released at all?&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;OpenEVSE V6.5_6L
&lt;ul&gt;
&lt;li&gt;Github only has &lt;a href=&quot;https://github.com/OpenEVSE/OpenEVSE_PLUS/tree/master/OpenEVSE_PLUS_v6.5.1&quot;&gt;6.5.1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;but it looks basically identical except the silk version isn&#39;t reversed&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;enclosure
&lt;ul&gt;
&lt;li&gt;looks like &lt;a href=&quot;https://github.com/OpenEVSE/Enclosures/blob/master/Polycase_ML58/openevse_enclosure_2024_Clear_3_5_LCD.pdf&quot;&gt;2024 clear 3.5 LCD&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;wish it had dimensions for the cable gland holes&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;mounting plate
&lt;ul&gt;
&lt;li&gt;it is &lt;em&gt;not&lt;/em&gt; the &lt;a href=&quot;https://github.com/OpenEVSE/Enclosures/blob/master/Polycase_ML58/Plate_11_22_2024.stl&quot;&gt;mounting plate in the same commit as the enclousre&lt;/a&gt;, there are some extra unused cutouts&lt;/li&gt;
&lt;li&gt;I lost the picture I took sorry&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
</content>
    </entry>
    
    <entry>
        <title>jailbreaking a kindle paperwhite 2 in 2025</title>
        <link href="https://technicallycompetent.com/blog/kindle-pw2-2025/"/>
        <updated>2025-02-27T03:40:09Z</updated>
        <id>https://technicallycompetent.com/blog/kindle-pw2-2025/</id>
        <content type="html">&lt;p&gt;The other day my kindle went into a bad state, and had to be factory reset.&lt;/p&gt;
&lt;p&gt;I got it working again, so here are the notes I took along the way.&lt;/p&gt;
&lt;h2&gt;What I have&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Kindle Paperwhite 2 / PW2 / Kindle Paperwhite 6th Gen&lt;/li&gt;
&lt;li&gt;&lt;code&gt;system/version.txt&lt;/code&gt;: &lt;code&gt;Kindle 5.4.0 (206145 050)&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;literature review&lt;/h2&gt;
&lt;h3&gt;jailbreaks:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://www.mobileread.com/forums/showthread.php?t=320564&quot;&gt;NiLuJe&#39;s Jailbreaks thread&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;updated 2023&lt;/li&gt;
&lt;li&gt;WatchThis &amp;lt;= to 5.14.2.&lt;/li&gt;
&lt;li&gt;archived instructions for KindleBreak 5.10.3 to 5.13.3&lt;/li&gt;
&lt;li&gt;archived instructions for Factory JB PW2: 5.4.3.2&lt;/li&gt;
&lt;li&gt;
&lt;blockquote&gt;
&lt;p&gt;of updates, remember that everything is basically evil since FW 5.12.x, so the only sure fire way not to get screwed is to &lt;em&gt;permanently&lt;/em&gt; stay in Airplane mode.
On older FW versions, there are non-intrusive ways to prevent OTA updates, c.f., the mentions about that in the final section of this document.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://www.mobileread.com/forums/showthread.php?t=225030&quot;&gt;NiLuJe&#39;s Snapshots thread&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;updated 2025&lt;/li&gt;
&lt;li&gt;not a specific jailbreak, but list&lt;/li&gt;
&lt;li&gt;K5 Factory JB &amp;gt;= 5.11&lt;/li&gt;
&lt;li&gt;K5 JailBreak (5.0.x - 5.4.4.2)&lt;/li&gt;
&lt;li&gt;KindleBreak (5.10.3 to 5.13.3)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://www.mobileread.com/forums/showthread.php?t=346037&quot;&gt;WatchThis&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&amp;lt;= 5.14.2, 0 day broken by 5.14.3&lt;/li&gt;
&lt;li&gt;calls out PW2 5.12.2.2 directly&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://kindlemodding.org/jailbreaking/kindle-models.html&quot;&gt;WinterBreak&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;released 2025&lt;/li&gt;
&lt;li&gt;
&lt;blockquote&gt;
&lt;p&gt;or particularly old devices (&amp;lt;PW3) simply have links to the latest firmwares at the time of writing.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;requires registered kindle&lt;/li&gt;
&lt;li&gt;
&lt;blockquote&gt;
&lt;p&gt;Disabling OTA Updates on firmware versions &amp;lt;=5.10.x is much easier&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/notmarek/LanguageBreak&quot;&gt;LanguageBreak&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;around 5.16.2&lt;/li&gt;
&lt;li&gt;doesn&#39;t mention pw2&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://www.mobileread.com/forums/showthread.php?t=227532&quot;&gt;yossarian17 root shell&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;reported to work 5.3.9&lt;/li&gt;
&lt;li&gt;I think this is used by NiLuJe&#39;s K5 JailBreak?&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;stock kindle firmwares&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://www.amazon.com/gp/help/customer/display.html?nodeId=200203720&quot;&gt;list of firmware versions from amazon&lt;/a&gt;
That doesn&#39;t work in the internet archive anymore, so I &lt;a href=&quot;/pages/amazon-kindle-source-code-notices&quot;&gt;made a backup&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;factory firmware
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.mediafire.com/file/d4177kuq2r7qb74/update_PW2_5.4.3.2_initial.bin&quot;&gt;update_PW2_5.4.3.2_initial.bin&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://wiki.mobileread.com/wiki/5_x_Jailbreak&quot;&gt;backup links are on this wiki page&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;updates
&lt;ul&gt;
&lt;li&gt;5.8.2.1 &amp;gt;= version: &lt;code&gt;https://s3.amazonaws.com/firmwaredownloads/update_kindle_paperwhite_v2_$VERSION.bin&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;5.6.1 &amp;lt;= version &amp;lt;= 5.8.2: &lt;code&gt;https://s3.amazonaws.com/G7G_FirmwareUpdates_WebDownloads/update_kindle_paperwhite_v2_$VERSION.bin&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;the plan:&lt;/h2&gt;
&lt;p&gt;Try rooting 5.4.0 with K5 JailBreak&lt;/p&gt;
&lt;p&gt;if that fails, update to 5.10.3 and try KindleBreak&lt;/p&gt;
&lt;h2&gt;results&lt;/h2&gt;
&lt;p&gt;K5 jailbreak worked fine on 5.4.0, so I&#39;m not updating for now&lt;/p&gt;
&lt;p&gt;On boot after reset the kindle wants to be registered, I got around this by
copying my &lt;code&gt;system/acw/*&lt;/code&gt; from the old kindle usb fs, and by deleting the
welcome document&lt;/p&gt;
&lt;p&gt;I&#39;m not convinced copying the acw helped any in hindsight, but that&#39;s what I
did, and I&#39;m not undoing all this to check if it was necessary&lt;/p&gt;
&lt;p&gt;mods (mostly from &lt;a href=&quot;https://www.mobileread.com/forums/showthread.php?t=225030&quot;&gt;NiLuJe&#39;s Snapshots thread&lt;/a&gt;)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;kindle-jailbreak-1.16.N-r19426.tar.xz&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kindle-rp-20180530.N-r18920.tar.xz&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kual-batterystatus-1.1.N-r18977.tar.xz&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kual-gawk-1.5.N-r18977.tar.xz&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kual-helper-0.5.N-r18980.tar.xz&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kual-kual-plus-0.2.N-r13380.tar.xz&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kual-mrinstaller-1.7.N-r19303.tar.xz&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;KUAL-v2.7.35-g2d06358-20250103.tar.xz&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.mobileread.com/forums/showthread.php?t=186305&quot;&gt;&lt;code&gt;CollectionsManager_2.8.1.zip&lt;/code&gt;&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;I tried the 2017 versions from ADambi linked on the wiki linked from that
post, but they gave an error message&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;KUAL has a &amp;quot;don&#39;t ota&amp;quot; button so I did that not the instructions from
WinterBreak, pretty sure it&#39;s the same thing but automatic.&lt;/p&gt;
&lt;p&gt;I&#39;m pretty sure I&#39;m never connecting this to wifi ever again so it shouldn&#39;t
matter, but better safe than sorry.&lt;/p&gt;
&lt;p&gt;Now I can read my book :)&lt;/p&gt;
&lt;p&gt;===
UPDATE 2025-05-30
some &lt;a href=&quot;https://www.mobileread.com/forums/showpost.php?p=4510449&amp;amp;postcount=2&quot;&gt;certs expired&lt;/a&gt; and things wouldn&#39;t launch anymore&lt;/p&gt;
&lt;p&gt;keysotre and update from &lt;a href=&quot;https://www.mobileread.com/forums/showpost.php?p=4506164&amp;amp;postcount=1295&quot;&gt;https://www.mobileread.com/forums/showpost.php?p=4506164&amp;amp;postcount=1295&lt;/a&gt;
update mkk/developer.keystore
put k5 .bin in root, run update, not sure this was required
no dice
install jailbreak again, do keystore stuff again, no dice
install mkk
give up?&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>How to python documentation</title>
        <link href="https://technicallycompetent.com/blog/pydoc/"/>
        <updated>2025-01-03T18:49:24Z</updated>
        <id>https://technicallycompetent.com/blog/pydoc/</id>
        <content type="html">&lt;p&gt;One of the things that&#39;s frustrated me about python is searching
&amp;quot;python iterable&amp;quot; rarely brings up the actual python documentation&lt;/p&gt;
&lt;p&gt;So this is how to actually find stuff&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;python documentation: &lt;a href=&quot;https://docs.python.org&quot;&gt;https://docs.python.org&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;glossary has good high level descriptions, search works&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;python -m pydoc thing&lt;/code&gt; or &lt;code&gt;help(&amp;quot;thing&amp;quot;)&lt;/code&gt; in the repl get docstrings for something&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://sphinx.rip&quot;&gt;https://sphinx.rip&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;https://sphinx.rip/py/$package[.$Class[.$method]]&lt;/code&gt; shortcuts to python documentation if you know the exact thing&lt;/li&gt;
&lt;li&gt;&lt;code&gt;https://sphinx.rip/py/typing.$type&lt;/code&gt; most types are probably linked in typing package&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
</content>
    </entry>
    
    <entry>
        <title>Youtube with yt-dlp &amp; Widevine DRM decoding</title>
        <link href="https://technicallycompetent.com/blog/youtube-widevine-drm/"/>
        <updated>2025-01-03T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/youtube-widevine-drm/</id>
        <content type="html">&lt;p&gt;First we must ask ourselves, what is Widevine?&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;DRM solution acquired by google in 2010&lt;/li&gt;
&lt;li&gt;Three levels, L1, L2, L3
&lt;ul&gt;
&lt;li&gt;L1 (in android) is done inside the Trusted Execution Environment (TEE), so hardware dependant
&lt;ul&gt;
&lt;li&gt;and is often required for HD decryption&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;L2 doesn&#39;t exist in android&lt;/li&gt;
&lt;li&gt;L3 is software based&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Terminology&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;License Request: DRM fuckery talks to license server to get content keys
&lt;ul&gt;
&lt;li&gt;ex license server: youtube.com/youtubei/v1/player/get_drm_license&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;DASH: &lt;a href=&quot;https://standards.iso.org/ittf/PubliclyAvailableStandards/c083314_ISO_IEC%2023009-1_2022(en).zip&quot;&gt;Dynamic adaptive streaming over HTTP&lt;/a&gt;
I think this is basically the spec for an MPD manifest, which most streaming sites using widevine use?
&lt;ul&gt;
&lt;li&gt;PSSH: Protection System Specific Header
&lt;ul&gt;
&lt;li&gt;part of a license request&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;MPD: Media Presentation Description
&lt;ul&gt;
&lt;li&gt;I think this is an xml manifest that says what the content URLs are, supposed to define pssh, and maybe license servers&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;CDM&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Open Quetions&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;the L1/L3 device keys are genrated by the Root of Trust 128 AES device key, where does that come from (especially in an emulator?)&lt;/li&gt;
&lt;li&gt;Can we get the device key and generate the L1/L3 keys ourselves?&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Prior Art&lt;/h2&gt;
&lt;p&gt;I did the &amp;quot;make it kinda work&amp;quot; half before the &amp;quot;learn how it&#39;s supposed to work&amp;quot; half and I must say, cargo cult script kiddie shit sucks.
Did work though.&lt;/p&gt;
&lt;h3&gt;Research&lt;/h3&gt;
&lt;p&gt;The explinations above are me butchering these&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/2204.09298&quot;&gt;Exploring Widevine for Fun and Profit from Gwendal Patat, Mohamed Sabt, and Pierre-Alain Fouque&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/2308.05416&quot;&gt;Your DRM Can Watch You Too: Exploring the Privacy Implications of Browsers (mis)Implementations of Widevine EME from  Gwendal Patat, Mohamed Sabt, and Pierre-Alain Fouque&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Application&lt;/h3&gt;
&lt;p&gt;I&#39;m mostly summarizing these after a fair amount of trial and an unfair amount of error&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.ismailzai.com/blog/picking-the-widevine-locks&quot;&gt;Mo Ismailzai has a blog post that&#39;s close to what I did&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://forum.videohelp.com/threads/408031-Dumping-Your-own-L3-CDM-with-Android-Studio&quot;&gt;cedric8528 on VideoHelp has a post&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://forum.videohelp.com/threads/404219-How-To-Dump-L3-CDM-From-Android-Device-s-%28ONLY-Talk-About-Dumping-L3-CDMS%29/page6?s=da067ba2bab6ce841c77ae58772f9029#post2646150&quot;&gt;[ss]vegeta on VideoHelp had helpful tips for using the dumper&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://forum.videohelp.com/threads/408556-How-to-decrypt-YouTube-Movies-TV-files/page2#post2687354&quot;&gt;stabbedbybrick on VideoHelp showed how to get youtube keys&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Actually doing it&lt;/h2&gt;
&lt;h3&gt;Get L3 DDM&lt;/h3&gt;
&lt;h4&gt;Tools&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;android emulator running Oreo x86 Android 8.0 (Google APIs)
&lt;ul&gt;
&lt;li&gt;10/Q didn&#39;t work, and without google APIs won&#39;t have chrome so we won&#39;t have widevine support
I think the internet said Google Play vs Google APIs won&#39;t work but I don&#39;t remember why.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/frida/frida/releases/&quot;&gt;https://github.com/frida/frida/releases/&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;show more, find frida-server-whatever&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/Diazole/dumper&quot;&gt;https://github.com/Diazole/dumper&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;steps&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;run emulator
&lt;ul&gt;
&lt;li&gt;install via studio, or maybe something like&lt;pre&gt;&lt;code&gt;sdkmanager &amp;quot;platform-tools&amp;quot; &amp;quot;platforms;android-26&amp;quot;
sdkmanager &amp;quot;system-images;android-26;google_apis;x86&amp;quot;
sdkmanager --licenses
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;emulator -avd Medium_Phone_API_26 -wipe-data -netdelay none -netspeed full&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;push frida-server to /sdcard, move to &lt;code&gt;/data/local/tmp&lt;/code&gt; &amp;amp; chmod +x&lt;/li&gt;
&lt;li&gt;run frida-server as root&lt;/li&gt;
&lt;li&gt;find libwvhidl.so, copy to somewhere readable and pull it&lt;/li&gt;
&lt;li&gt;Look at it with &lt;code&gt;strings&lt;/code&gt;, the functions names you want are between
&lt;code&gt;_lcc43&lt;/code&gt; and &lt;code&gt;_ZN6wvoec333OEMCrypto_Level3AndroidFileSystem4ReadEPKcPvj&lt;/code&gt;(Second occourance of OEMCrypto_Level3 in the file)&lt;/li&gt;
&lt;li&gt;put those function names in dumper/Helpers/scripts.sh KNOWN_DYNAMIC_FUNCTION_NAMES&lt;/li&gt;
&lt;li&gt;run dumper, this will listen in on those functions for drm functions and log keys
&lt;ul&gt;
&lt;li&gt;I had a &lt;em&gt;lot&lt;/em&gt; of issues with this I think it just started working once I went old enough? Don&#39;t really remmeber&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Open DRM in a chrome tab in the phone
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;adb shell am start -n com.android.chrome/com.google.android.apps.chrome.Main -d &amp;quot;https://bitmovin.com/demos/drm&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;You will have to click accept a few times or whatever&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Hope dumper writes &lt;code&gt;key_dumps/Android&#92; Emulator&#92; */private_keys/*/*/client_id.bin&lt;/code&gt; and &lt;code&gt;private_key.pem&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These steps are fairly well documented in the first two prior art posts.&lt;/p&gt;
&lt;h3&gt;Something something youtube&lt;/h3&gt;
&lt;p&gt;Knowing anything about widevine or DASH would &lt;em&gt;really&lt;/em&gt; have helped here.&lt;/p&gt;
&lt;h4&gt;Tools&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/medvm/widevine_keys&quot;&gt;https://github.com/medvm/widevine_keys&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://forum.videohelp.com/threads/408556-How-to-decrypt-YouTube-Movies-TV-files/page2#post2687354&quot;&gt;https://forum.videohelp.com/threads/408556-How-to-decrypt-YouTube-Movies-TV-files/page2#post2687354&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;copy it into a script in widivine_keys directory&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/axiomatic-systems/Bento4&quot;&gt;https://github.com/axiomatic-systems/Bento4&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;Steps&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;cp dumper/key_dumps/*/private_keys/*/*/client_id.bin widevine_keys/cdm/devices/device_client_id_blob&lt;/code&gt;
&lt;code&gt;cp dumper/key_dumps/*/private_keys/*/*/private_key.pem widevine_keys/cdm/devices/device_private_key&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;open youtube video in browser, find keyserver request in network
&lt;ul&gt;
&lt;li&gt;youtube keyserver: &lt;a href=&quot;https://www.youtube.com/youtubei/v1/player/get_drm_license&quot;&gt;https://www.youtube.com/youtubei/v1/player/get_drm_license&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;copy request, put into widivine_keys/headers.py
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/copy-as-python-requests/&quot;&gt;https://addons.mozilla.org/en-US/firefox/addon/copy-as-python-requests/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://curlconverter.com/&quot;&gt;https://curlconverter.com/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Put keyserver url in stabbedbybrick&#39;s script&lt;/li&gt;
&lt;li&gt;run stabbedbybrick&#39;s script, get keys output&lt;/li&gt;
&lt;li&gt;&lt;code&gt;yt-dlp --allow-unplayable-formats https://www.youtube.com/watch?v=CYV9LmANWOQ&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;./mp4decrypt &amp;lt;--key whatever&amp;gt;... encrypted.mp4 decrypted.mp4&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ffmpeg -i decrypted_video.mp4 -i decrypted_audio.m4a -vcodec copy -acodec copy decrypted_bundle.mp4&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;NEXT STEPS: Making this not suck to do&lt;/h4&gt;
&lt;h5&gt;Expectations&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;yt-dlp interface that handles this stupid stuff with no manual steps&lt;/li&gt;
&lt;/ul&gt;
</content>
    </entry>
    
    <entry>
        <title>Temperature controlled peltier box</title>
        <link href="https://technicallycompetent.com/blog/temp-box/"/>
        <updated>2024-10-01T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/temp-box/</id>
        <content type="html">&lt;p&gt;I have a drug that needs to be &amp;quot;room temperature&amp;quot;, or 20-25C, but the rooms in
my house are more like 15-30C, and I sometimes go outside for a few weeks.&lt;/p&gt;
&lt;p&gt;So, peltier box that can heat and cool as required.&lt;/p&gt;
&lt;p&gt;Parts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;amazon special STC-1000 thermostat with heat/cool relay outputs&lt;/li&gt;
&lt;li&gt;constant current driver&lt;/li&gt;
&lt;li&gt;peltier pads&lt;/li&gt;
&lt;li&gt;h bridge relay I found&lt;/li&gt;
&lt;li&gt;a pair of diodes, the paper said 1N4002&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/temp-box/schematic.jpg&quot; alt=&quot;Electrical schematic&quot; title=&quot;such schematic&quot;&gt;&lt;/p&gt;
&lt;p&gt;Looks like I can fit all the stuff inside the STC-1000 enclosure, lots of space
&lt;img src=&quot;/assets/pages/temp-box/start-top.jpg&quot; alt=&quot;starting controller top&quot;&gt;
&lt;img src=&quot;/assets/pages/temp-box/start-bottom.jpg&quot; alt=&quot;starting controller bottom&quot;&gt;&lt;/p&gt;
&lt;p&gt;The not populated stuff is almost certainly because one of the versions
supports 240VAC not 12VDC, but I have a fair bit less components than the three
&lt;a href=&quot;https://youtu.be/T4umSkJjXwY?si=-hwj4bqc9eLnjrpS&quot;&gt;Big Clive has&lt;/a&gt;...&lt;/p&gt;
&lt;p&gt;Seems to work though, so I made everything fit&lt;/p&gt;
&lt;p&gt;It did require sanding down the constant current/constant voltage driver a mm or
so&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/temp-box/final-top.jpg&quot; alt=&quot;final controller tip&quot;&gt;
I reused the heat/cool relay screw terminals for my fan output by just cutting
the relay traces and drilling more holes in the board to fit my wires
&lt;img src=&quot;/assets/pages/temp-box/final-bottom.jpg&quot; alt=&quot;final controller bottom&quot;&gt;&lt;/p&gt;
&lt;p&gt;Next steps: make a box and see how badly it keeps temperature&lt;/p&gt;
&lt;p&gt;Would maybe be nice to have a button to enable the display, for future battery
reasons, but if I actually want to care about low power the extra relays and
STC-1000 is the wrong approach anyway&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>Benchmarking shell pipe stuff</title>
        <link href="https://technicallycompetent.com/blog/benchmarking-shell/"/>
        <updated>2024-09-25T00:18:07Z</updated>
        <id>https://technicallycompetent.com/blog/benchmarking-shell/</id>
        <content type="html">&lt;p&gt;I came across the &lt;a href=&quot;https://unix.stackexchange.com/a/394723&quot;&gt;following snippet&lt;/a&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;apt-get --just-print upgrade | grep -i security | awk &#39;{print $2}&#39; | awk &#39;!seen[$0]++&#39;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;a minute of thinking aobut it, it&#39;s the same as&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;apt-get --just-print upgrade | grep -i security | awk &#39;{print $2}&#39; | sort | uniq
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;so why not write it that way?&lt;/p&gt;
&lt;p&gt;feels like a performance thing, but why not make it all a single awk call?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;awk &#39;/security/ &amp;amp;&amp;amp; !seen[$2]++ {print $2}&#39;&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;benchmarking&lt;/h2&gt;
&lt;p&gt;So I played with &lt;a href=&quot;https://github.com/sharkdp/hyperfine&quot;&gt;hyperfine&lt;/a&gt; to try to
get some intuition for actual speeds&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;apt-get --just-print upgrade &amp;gt; /tmp/data
for i in $(seq 1 500); do cat /tmp/data &amp;gt;&amp;gt; /tmp/biggerdata; done

hyperfine &#92;
    &amp;quot;cat /tmp/biggerdata | grep -i security | awk &#39;{print &#92;$2}&#39; | awk &#39;!seen[&#92;$0]++&#39;&amp;quot; &#92;
    &amp;quot;cat /tmp/biggerdata | grep -i security | awk &#39;!seen[&#92;$2]++ {print &#92;$2}&#39;&amp;quot; &#92;
    &amp;quot;cat /tmp/biggerdata | grep -i security | awk &#39;{print &#92;$2}&#39; | sort | uniq&amp;quot; &#92;
    &amp;quot;cat /tmp/biggerdata | grep -i security | cut -d&#39; &#39; -f2 | sort | uniq&amp;quot; &#92;
    &amp;quot;cat /tmp/biggerdata | awk &#39;/security/i &amp;amp;&amp;amp; !seen[&#92;$2]++ {print &#92;$2}&#39;&amp;quot; &#92;
    &amp;quot;cat /tmp/biggerdata | grep -i security | awk &#39;!seen[&#92;$2]++ {print &#92;$2}&#39;&amp;quot; &#92;
    &amp;quot;cat /tmp/biggerdata | grep -i security | cut -d&#39; &#39; -f2 | awk &#39;!seen[&#92;$0]++&#39;&amp;quot; &#92;
    &amp;quot;cat /tmp/biggerdata | awk &#39;/security/i&#39; | awk &#39;!seen[&#92;$2]++ {print &#92;$2}&#39;&amp;quot; &#92;
    &amp;quot;cat /tmp/biggerdata | awk &#39;/security/i &amp;amp;&amp;amp; !seen[&#92;$2]++ {print &#92;$2}&#39;&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;                                  &#39;cat /tmp/biggerdata | grep -i security | awk &#39;{print $2}&#39; | awk &#39;!seen[$0]++&#39;&#39; ran
    1.00 ± 0.04 times faster than &#39;cat /tmp/biggerdata | grep -i security | cut -d&#39; &#39; -f2 | awk &#39;!seen[$0]++&#39;&#39;
    1.01 ± 0.05 times faster than &#39;cat /tmp/biggerdata | grep -i security | awk &#39;!seen[$2]++ {print $2}&#39;&#39;
    2.67 ± 0.13 times faster than &#39;cat /tmp/biggerdata | awk &#39;/security/i&#39; | awk &#39;{print $2}&#39; | awk &#39;!seen[$0]++&#39;&#39;
    4.08 ± 0.14 times faster than &#39;cat /tmp/biggerdata | awk &#39;/security/i &amp;amp;&amp;amp; !seen[$2]++ {print $2}&#39;&#39;
    5.39 ± 0.17 times faster than &#39;cat /tmp/biggerdata | grep -i security | awk &#39;{print $2}&#39; | sort | uniq&#39;
    5.44 ± 0.20 times faster than &#39;cat /tmp/biggerdata | grep -i security | cut -d&#39; &#39; -f2 | sort | uniq&#39;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;the original thing with one grep and two awk is always the fastest?
what?&lt;/p&gt;
&lt;h2&gt;conclusions&lt;/h2&gt;
&lt;p&gt;each of these claims is verified by head to head comparison with hyperfine&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;cut -d&#39; &#39; -f2&lt;/code&gt; is basically the same as &lt;code&gt;awk &#39;{print $2}&#39;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;awk &#39;!seen[$0]++&#39;&lt;/code&gt; is way faster than &lt;code&gt;sort | uniq&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;grep -i security&lt;/code&gt; is way faster than &lt;code&gt;awk &#39;/security/i&#39;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;awk &#39;{print $2}&#39; | awk &#39;!seen[$0]++&#39;&amp;quot;&lt;/code&gt; is a little faster than &lt;code&gt;awk &#39;!seen[$2]++ {print $2}&#39;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;awk &#39;/security/i&#39; | awk &#39;!seen[$2]++ {print $2}&#39;&lt;/code&gt; runs 1.59 ± 0.07 faster than &lt;code&gt;awk &#39;/security/i &amp;amp;&amp;amp; !seen[$2]++ {print $2}&#39;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So I guess more invocations of awk is faster than more complex awk scripts?
I guess awk is slow, but less slow than &lt;code&gt;sort | uniq&lt;/code&gt;?&lt;/p&gt;
&lt;h2&gt;other scripting languages&lt;/h2&gt;
&lt;h3&gt;perl&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;perl -ne &#39;@a = split &amp;quot; &amp;quot;; print &amp;quot;$a[1]&#92;n&amp;quot; if /security/i &amp;amp;&amp;amp; !$seen{$a[1]}++&#39;
&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;7.95 ± 0.29 times slower than the fastest grep+awk+awk&lt;/li&gt;
&lt;li&gt;1.96 ± 0.05 times slower than the entirely awk&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;python&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;python -c &amp;quot;import sys; print(&#39;&#92;n&#39;.join(set([package for line in sys.stdin if &#39;security&#39; in line.lower() and (package := line.split(&#39; &#39;)[1])])))&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;3.58 ± 0.14 times slower than the fastest grep+awk+awk&lt;/li&gt;
&lt;li&gt;1.14 ± 0.04 times &lt;em&gt;faster&lt;/em&gt; than the entirely awk&lt;/li&gt;
&lt;/ul&gt;
</content>
    </entry>
    
    <entry>
        <title>UWB Literature Review in 2024</title>
        <link href="https://technicallycompetent.com/blog/uwb-lit-review/"/>
        <updated>2024-08-22T15:27:17Z</updated>
        <id>https://technicallycompetent.com/blog/uwb-lit-review/</id>
        <content type="html">&lt;p&gt;Trying to get a sense of the state of UWB in 2024&lt;/p&gt;
&lt;h2&gt;use case I&#39;m focused on&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;cheap UWB nodes we need the location and sensor data from&lt;/li&gt;
&lt;li&gt;expensive mobile gateway UWB nodes with GNSS and LTE that need to report the
locations of all nodes&lt;/li&gt;
&lt;li&gt;Nodes will report status towards gateway&lt;/li&gt;
&lt;li&gt;nice to have: ability for phones to be the gateway nodes&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Literature Review&lt;/h2&gt;
&lt;h3&gt;Literature Review Review&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://ieeexplore.ieee.org/document/9810941&quot;&gt;An Overview of UWB Standards and Organizations (IEEE 802.15.4, FiRa, Apple): Interoperability Aspects and Future Research Directions&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;Great overview of standards gropus and OSI model stuff
&lt;ul&gt;
&lt;li&gt;Required reading for background I&#39;m not providing here&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;standards changes since then
&lt;ul&gt;
&lt;li&gt;fira 2 came out 2023, not really sure what changed&lt;/li&gt;
&lt;li&gt;omlox 2 2023, didn&#39;t look into this&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/2103.13488&quot;&gt;Applications of UWB Networks and Positioning to Autonomous Robots and Industrial Systems&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;focused on robots, but a lot of the same mesh localization needs&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.pozyx.io/newsroom/the-state-of-uwb&quot;&gt;The state of uwb in 2024 (pozyx blog post)&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;some notes on recent standards changes&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.researchgate.net/profile/Muna-Alakhras/publication/362752679_RPL_routing_protocol_over_IoT_A_comprehensive_survey_recent_advances_insights_bibliometric_analysis_recommendations_and_future_directions/links/64d93ed3ad846e28828d2ed0/RPL-routing-protocol-over-IoT-A-comprehensive-survey-recent-advances-insights-bibliometric-analysis-recommendations-and-future-directions.pdf&quot;&gt;RPL Routing Protocol over IoT: A Comprehensive Survey, Recent Advances, Insights, Bibliometric Analysis, Recommendations, and Future Directions&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;blockquote&gt;
&lt;p&gt;RPL builds and maintains a Destination-Oriented Directed Acyclic Graph (DODAG) topology that originates from a designated RPL root node&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;This could be useful if all nodes repeating to everyone cause congestion&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Relevant Standards&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://standards.ieee.org/ieee/802.15.4/7029/&quot;&gt;IEEE 802.15.4-2020&lt;/a&gt; and
&lt;a href=&quot;https://standards.ieee.org/ieee/802.15.4z/10230/&quot;&gt;IEEE 802.15.4z-2020&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;define PHY and MAC for many things, UWB included&lt;/li&gt;
&lt;li&gt;FIRA also has specs for PHY/MAC, but they&#39;re apparently the same?&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;FiRa specs that might be relevant
&lt;ul&gt;
&lt;li&gt;FiRa® UWB Command Interface (UCI) Technical Specification v2.0.0
&lt;ul&gt;
&lt;li&gt;communication protocol between the UWB Subsystem (UWBS) and the Host&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;FiRa® Common Service &amp;amp; Management Layer (CSML) Technical Specification
v1.0.0
&lt;ul&gt;
&lt;li&gt;FiRa® UWB host framework and application programming interfaces between
other host components, a secure component, and FiRa-enabled applications&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;FiRa® Secure UWB Service (SUS) API Technical Specification v1.0.0
&lt;ul&gt;
&lt;li&gt;external reference interfaces between a secure component and a UWBS and
the internal interface between a service applet and the SUS applet&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;FiRa® Bluetooth® Low Energy Out-of-Band (OOB) Channel Technical
Specification v.1.0.0&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.apple.com/nearby-interaction/specification/&quot;&gt;Apple Nearby Interaction Accessory Protocol Specification&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;implement BLE gatt service, phone connects, some data exchange via that, phone initiates ranging&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://datatracker.ietf.org/doc/html/rfc6550&quot;&gt;RFC 6550: RPL: IPv6 Routing Protocol for Low-Power and Lossy Networks&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Cool Papers&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www2.cs.uh.edu/~gnawali/papers/uwbsrac-dcoss2019.pdf&quot;&gt;SRAC: Simultaneous Ranging and Communication in UWB Networks&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;very relevant, mesh &amp;amp; localization&lt;/li&gt;
&lt;li&gt;integrated into RIOT OS, an RTOS which only has drivers for dw1000&lt;/li&gt;
&lt;li&gt;RPL&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/2004.06762&quot;&gt;Autocalibration of a Mobile UWB Localization System for Ad-Hoc Multi-Robot Deployments in GNSS-Denied Environments&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;very relevant, moving anchors!&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://grosswindhager.com/pubs/grosswindhager2019snaploc.pdf&quot;&gt;SnapLoc: An Ultra-Fast UWB-Based Indoor Localization System for an Unlimited Number of Tags&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;anchor broadcasts and &lt;em&gt;all&lt;/em&gt; nodes in range respond so it can get multiple
responses faster&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.researchgate.net/profile/Antonio-Jimenez-11/publication/310499120_Comparing_Decawave_and_Bespoon_UWB_location_systems_Indooroutdoor_performance_analysis/links/5c136aca4585157ac1c0c397/Comparing-Decawave-and-Bespoon-UWB-location-systems-Indoor-outdoor-performance-analysis.pdf&quot;&gt;Comparing Decawave and Bespoon UWB location systems: indoor/outdoor performance analysis&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;antenna matters&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.researchgate.net/publication/341618862_Location-Aware_Point-to-Point_RPL_in_Indoor_IR-UWB_Networks?_tp=eyJjb250ZXh0Ijp7ImZpcnN0UGFnZSI6Il9kaXJlY3QiLCJwYWdlIjoiX2RpcmVjdCJ9fQ&quot;&gt;Location-Aware Point-to-Point RPL in Indoor IR-UWB Networks&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;proposed location aware P2P-RPL algorithm, better than spec P2P-RPL or ER-RPL for performance and overhead&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://mdpi-res.com/d_attachment/electronics/electronics-11-00625/article_deploy/electronics-11-00625.pdf&quot;&gt;3D Void Handling Geographic P2P-RPL for Indoor Multi-Hop IR-UWB Networks&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;proposed location aware P2P-RPL algorithm, better than spec P2P-RPL or ER-RPL for performance and overhead&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/2203.03893&quot;&gt;Towards Large-Scale Relative Localization in Multi-Robot Systems with Dynamic UWB Role Allocation&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;dynamic role allocation would be useuful to us cause we need constant ranging&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://ieeexplore.ieee.org/document/8727766&quot;&gt;Anchor self-localization algorithm based on UWB ranging and inertial measurements&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/2005.10648&quot;&gt;Accurate position tracking with a single UWB anchor&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;single known anchor, mobile rover with imu&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Definitions and resources&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;HRP vs LRP: high rate pulse low rate pulse, we only care about high
&lt;ul&gt;
&lt;li&gt;lower frequency better range, but lower frequencies don&#39;t have regulatory acceptance&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.firaconsortium.org/sites/default/files/2023-07/fira-uwb-availability-chart.svg&quot;&gt;uwb spectrum legality across the world&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;this is why FIRA says use specific channels&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
</content>
    </entry>
    
    <entry>
        <title>UWB Qorvo DW3XXX family notes</title>
        <link href="https://technicallycompetent.com/blog/uwb-dw3xxx/"/>
        <updated>2024-08-22T15:27:17Z</updated>
        <id>https://technicallycompetent.com/blog/uwb-dw3xxx/</id>
        <content type="html">&lt;p&gt;SEE ALSO: &lt;a href=&quot;/blog/uwb-lit-review&quot;&gt;UWB Literature Review&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;TL;DR: use &lt;a href=&quot;https://github.com/br101/zephyr-dw3000-decadriver&quot;&gt;br101/zephyr-dw3000-decadriver&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Qorvo/Decawave&lt;/h2&gt;
&lt;p&gt;Decawave was bought by qorvo in 2020 and moved from open source to binary
drivers early in the life of the DWM3XXX family&lt;/p&gt;
&lt;p&gt;The DW1000 family was well recieved by many, but the more recent DWM3XXX
family&#39;s binary driver has frustated many&lt;/p&gt;
&lt;p&gt;These notes are focused on the DW3XXX family&lt;/p&gt;
&lt;h3&gt;docs from qorvo&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;tranciever numbering
&lt;ul&gt;
&lt;li&gt;DW3110, DW3120, DW3210, DW3220
&lt;ul&gt;
&lt;li&gt;1|2: 1 is WLCSP, 2 is QFN&lt;/li&gt;
&lt;li&gt;1|2: number of antenna&lt;/li&gt;
&lt;li&gt;0&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;QM33110W &amp;amp; QM33120W transceivers
&lt;ul&gt;
&lt;li&gt;QM33120W has 2 antenna&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.qorvo.com/products/p/DWM3000&quot;&gt;DWM3000&lt;/a&gt;: DW3110 &amp;amp; antennas &amp;amp;
support
&lt;ul&gt;
&lt;li&gt;schematic &lt;a href=&quot;https://www.qorvo.com/products/d/da008507&quot;&gt;https://www.qorvo.com/products/d/da008507&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;datasheet &lt;a href=&quot;https://www.qorvo.com/products/d/da008142&quot;&gt;https://www.qorvo.com/products/d/da008142&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;DWM3000EVB arduino shield with DWM3000
&lt;ul&gt;
&lt;li&gt;schematic in DW3xxx_XR6.0C_24Feb2022&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.qorvo.com/products/p/DWM3001C&quot;&gt;DWM3001C&lt;/a&gt;: nRF52833 &amp;amp; DW3110 &amp;amp;
antennas &amp;amp; accelerometer &amp;amp; misc
&lt;ul&gt;
&lt;li&gt;FAMILY USER MANUAL: &lt;a href=&quot;https://www.qorvo.com/products/d/da008154&quot;&gt;https://www.qorvo.com/products/d/da008154&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;has spi protocol docs&lt;/li&gt;
&lt;li&gt;register files have IDs, &amp;quot;sub-registers&amp;quot; have offsets ($register:$offset)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;schematics: &lt;a href=&quot;https://www.qorvo.com/products/d/da008300&quot;&gt;https://www.qorvo.com/products/d/da008300&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.qorvo.com/products/p/DWM3001CDK&quot;&gt;DWM3001CDK&lt;/a&gt;: DWM3001C &amp;amp; misc
&lt;ul&gt;
&lt;li&gt;QUICK START GUIDE: &lt;a href=&quot;https://www.qorvo.com/products/d/da008427&quot;&gt;https://www.qorvo.com/products/d/da008427&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Quick start guide 2022 may with schematic: &lt;a href=&quot;https://web.archive.org/web/20230929062728/https://www.qorvo.com/products/d/da008427&quot;&gt;https://web.archive.org/web/20230929062728/https://www.qorvo.com/products/d/da008427&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;QM33120WDK1: nRF52840 &amp;amp; QM33 whatever, does both for AoA vs nonAoA&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Libs from qorvo/decawave&lt;/h3&gt;
&lt;h4&gt;zips from qorvo&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.qorvo.com/products/d/da008604&quot;&gt;DWM3001CDK DK Software, Sources, Tools and Developer Guide -&amp;gt; &lt;code&gt;DWM3001CDK DK Software, Sources, Tools and Developer Guide/DWM3001CDK DK/&lt;/code&gt;&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;dwm3001cdk documents page&lt;/li&gt;
&lt;li&gt;hereafter referred to as &lt;code&gt;DWM3001CDK DK&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;./DWM3001CDK DK/DWM3001CDK_SDK/Doc/DWM3001CDK_SDK_Release_Notes_0.1.1.pdf&lt;/code&gt; says this release contains &lt;code&gt;DWM3001CDK_SDK/Sources/DWM3001CDK-FreeRTOS_DW3_QM33_SDK_0_1_1.zip&lt;/code&gt; but actually contains &lt;code&gt;DWM3001CDK_SDK/Sources/DWM3001CDK-DW3_QM33_SDK-FreeRTOS_0_1_1.zip&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;has freertos segger project for the DWM3001CDK, or nRF52833&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.qorvo.com/products/d/da008582&quot;&gt;QM33 DK Software, Sources, Tools and Developer Guide -&amp;gt; &lt;code&gt;QM33120WDK1/&lt;/code&gt;&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;dwm3001cdk evaulation tools page&lt;/li&gt;
&lt;li&gt;hereafter referred to as &lt;code&gt;QM33120WDK1&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;has freertos segger project for the nRF52840&lt;/li&gt;
&lt;li&gt;basically identical to DWM3001CDK DK but for the nRF52840 not the nRF52833 inside the DWM3001C&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.qorvo.com/products/d/da007992&quot;&gt;DWM3000 API Software and API Guide -&amp;gt; &lt;code&gt;DW3xxx_XR6.0C_24Feb2022/&lt;/code&gt;&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;DWM3001C documents page&lt;/li&gt;
&lt;li&gt;hereafter referred to as &lt;code&gt;DW3xxx_XR6.0C_24Feb2022&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;developer guides&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;./QM33120WDK1/DW3_QM33_SDK/Doc/DW3QM33_SDK_Developer_Guide_0.1.1.pdf&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;./DWM3001CDK DK/DWM3001CDK_SDK/Doc/DWM3001CDK_SDK_Developer_Guide_0.1.1.pdf&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;DW3XXX API&lt;/h4&gt;
&lt;p&gt;the lowest level code to interface with board over spi&lt;/p&gt;
&lt;h5&gt;DW3000 C0 Device Driver Version 04.00.00&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;actual opensource driver&lt;/li&gt;
&lt;li&gt;was in &lt;code&gt;DW3000_API_C0_rev4p0.zip&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;versions can be found
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/br101/zephyr-dw3000-decadriver/tree/opensource&quot;&gt;br101/zephyr-dw3000-decadriver opensource branch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/foldedtoad/dwm3000&quot;&gt;foldedtoad/dwm3000 (zephyr lib)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;reportedly, the URL to &lt;code&gt;DW3xxx_XR6.0C_24Feb2022/&lt;/code&gt; &lt;em&gt;used&lt;/em&gt; to point to this&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;DW3xxx Driver version 06.00.07&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;binary driver&lt;/li&gt;
&lt;li&gt;&lt;code&gt;DW3xxx_XR6.0C_24Feb2022/&lt;/code&gt; contains &lt;code&gt;DW3XXX_API_rev9p3.zip&lt;/code&gt;: Package v9.3 / Driver v06.00.07  (19th Nov 2021)
&lt;ul&gt;
&lt;li&gt;has a changelog with releases&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;XR6.0C was released 2022-02-23 or 2022-02-24 depending on where you look
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;release_note.md&lt;/code&gt; claims it has &amp;quot;DW3XXX API (09.03.00) and Simple Examples package v6.0&amp;quot;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;contains binaries for m33/m4 (nRF53X/everything else according to CMakeLists.tx from br101), HFP/SFP&lt;/li&gt;
&lt;li&gt;&lt;code&gt;./DW3xxx_XR6.0C_24Feb2022/Release_XR6.0C/Software/DW3XXX_API/Docs/DW3XXX_Software_API_Guide_2p2.pdf&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;DW3XXX Device Driver Version 06.00.14&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;binary driver&lt;/li&gt;
&lt;li&gt;found in
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;DWM3001CDK DK&lt;/code&gt; ... &lt;code&gt;DWM3001CDK-DW3_QM33_SDK-FreeRTOS_0_1_1.zip&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;QM33120WDK1&lt;/code&gt;       &lt;code&gt;nRF52840DK-DW3_QM33_SDK-FreeRTOS_DW3_QM33_SDK_0_1_1.zip&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;no changelog/readme, but does have driver api guide pdf&lt;/li&gt;
&lt;li&gt;binaries for m4, HFP/SFP&lt;/li&gt;
&lt;li&gt;&lt;code&gt;./QM33120WDK1/DW3_QM33_SDK/Doc/&lt;/code&gt; and &lt;code&gt;./DWM3001CDK DK/DWM3001CDK_SDK/Doc/&lt;/code&gt; have &lt;code&gt;DW3xxx_Driver_API_Guide_6.0.14.pdf&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;UWB stack&lt;/h4&gt;
&lt;p&gt;UWB Stack has UWB MAC APIs and UCI APIs&lt;/p&gt;
&lt;p&gt;has some references to FIRA stuff&lt;/p&gt;
&lt;p&gt;I think UWB MAC is referring to MAC layer, UCI is a spec for MCU -&amp;gt; UWB tranciever comms(FiRa® UWB Command Interface (UCI) Technical Specification v2.0.0 looks like a nice spec but I can&#39;t have it right now)&lt;/p&gt;
&lt;p&gt;no bluetooth discovery stuff&lt;/p&gt;
&lt;p&gt;&lt;code&gt;./QM33120WDK1/DW3_QM33_SDK/Doc/&lt;/code&gt; and &lt;code&gt;./DWM3001CDK DK/DWM3001CDK_SDK/Doc/&lt;/code&gt; have &lt;code&gt;UWB-Stack-R11.9.2.pdf&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;It seems better to consider this a part of the DW3_QM33_SDK&lt;/p&gt;
&lt;h5&gt;UWB Stack R11.9.2 October 2022&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;found in both &lt;code&gt;DWM3001CDK DK&lt;/code&gt; and &lt;code&gt;QM33120WDK1&lt;/code&gt;, next to DW3XXX Device Driver Version 06.00.14&lt;/li&gt;
&lt;li&gt;binary lib with headers&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;DW3_QM33_SDK&lt;/h4&gt;
&lt;p&gt;in both DWM3001CDK DK and QM33120WDK1, and contains UWB Stack and the DW3XXX API
FreeRTOS segger thingy&lt;/p&gt;
&lt;p&gt;can actually do uwb ranging&lt;/p&gt;
&lt;h5&gt;keywords&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;MCPS: MAC Common Part Sublayer&lt;/li&gt;
&lt;li&gt;UWBS: UWB Subsystem, the conceptual gropu for MAC&amp;amp;PHY layer&lt;/li&gt;
&lt;li&gt;UWB Service: thin inside fira framework that talks to UWBS&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;existing software stuff&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;DW1000 based
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.qorvo.com/products/d/da007973&quot;&gt;decawave dwm1001 gateway system&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;networked uwb stuff with static anchors and gateway uplinks&lt;/li&gt;
&lt;li&gt;rpi based&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;RIOT OS&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;DW3xxx based
&lt;ul&gt;
&lt;li&gt;qorvo DW3xxx Driver API, PHY layer
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/br101/zephyr-dw3000-decadriver&quot;&gt;zephyr library&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://gist.github.com/egnor/455d510e11c22deafdec14b09da5bf54&quot;&gt;reverse engineered notes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;downloads from qorvo below&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;qorvo UWB-Stack: MAC layer and some fira stuff&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
</content>
    </entry>
    
    <entry>
        <title>Resizing luks encryped lvm</title>
        <link href="https://technicallycompetent.com/blog/resize-luks-lvm/"/>
        <updated>2024-07-17T04:43:27Z</updated>
        <id>https://technicallycompetent.com/blog/resize-luks-lvm/</id>
        <content type="html">&lt;p&gt;debian installer picks insane defaults like 1GiB swap or 500ish MiB /boot&lt;/p&gt;
&lt;p&gt;some definitions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Physical Volume (PV): This can be created on a whole physical disk (think /dev/sda) or a Linux partition.&lt;/li&gt;
&lt;li&gt;Volume Group (VG): This is made up of at least one or more physical volumes.&lt;/li&gt;
&lt;li&gt;Logical Volume (LV): This is sometimes referred to as the partition, it sits within a volume group and has a file system written to it.&lt;/li&gt;
&lt;li&gt;File System: A file system such as ext4 will be on the logical volume.&lt;/li&gt;
&lt;li&gt;Physical Extent (PE): unit shown by vgdisplay, kinda block size todo research&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code&gt;cryptsetup luksOpen /dev/nvme0n1p3 foo
lvreduce -r --size -${whatever}GiB /dev/mapper/azura--vg-root
vgchange -a n
cryptsetup luksClose foo
gparted /dev/nvme0n1
#now gparted can shrink luks with pv, but can&#39;t fuck with lvs
cryptsetup luksOpen /dev/nvme0n1p3 foo
vgdisplay
#extents are the number shown by vgdisplay, before the GiB number
lvextend --extents +$something /dev/mapper/azura--vg-swap_1
sudo mkswap /dev/mapper/azura--vg-swap_1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;i wrote this in vim from a phone
maybe i should have enabled mouse&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>roku without internet</title>
        <link href="https://technicallycompetent.com/blog/roku/"/>
        <updated>2024-07-09T15:50:29Z</updated>
        <id>https://technicallycompetent.com/blog/roku/</id>
        <content type="html">&lt;p&gt;I want a jellyfin display client
Trying a roku, but it is unhappy without internet, it complains and also the
clock is wrong&lt;/p&gt;
&lt;p&gt;I want to have clock without internet&lt;/p&gt;
&lt;h2&gt;literature review&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;roku is running a local api on port 8060
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.roku.com/docs/developer-program/dev-tools/external-control-api.md&quot;&gt;https://developer.roku.com/docs/developer-program/dev-tools/external-control-api.md&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://sdkdocs-archive.roku.com/External-Control-API_1611563.html&quot;&gt;https://sdkdocs-archive.roku.com/External-Control-API_1611563.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://remoku.tv/&quot;&gt;http://remoku.tv/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://exploitee.rs/index.php/Roku&quot;&gt;https://exploitee.rs/index.php/Roku&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;neat list of secret pages&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;some firmware analysis
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.reddit.com/r/netsec/comments/3eu4iv/a_little_roku_with_my_morning_coffee_a_firmware/&quot;&gt;https://www.reddit.com/r/netsec/comments/3eu4iv/a_little_roku_with_my_morning_coffee_a_firmware/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://firmware.roku.com/&quot;&gt;http://firmware.roku.com/&lt;/a&gt;&amp;lt;VERSION_ID&amp;gt; , eg &lt;a href=&quot;http://firmware.roku.com/04D.55E04174A&quot;&gt;http://firmware.roku.com/04D.55E04174A&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;RokuControl-Conducting MITM Attacks on Roku - 2022 Coles et all
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://ieeexplore.ieee.org/document/9946502&quot;&gt;https://ieeexplore.ieee.org/document/9946502&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;They discovered the api on port 8060 &lt;em&gt;documented by the manufacturer&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;what a find&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;notes from Eric Cooper 2008
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.cs.cmu.edu/~ecc/roku-nfp.html&quot;&gt;https://www.cs.cmu.edu/~ecc/roku-nfp.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;if it can&#39;t https it tries http&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;wireshark capture from boot to has time&lt;/h2&gt;
&lt;p&gt;Started capture, booted device, stopped capture once it had time&lt;/p&gt;
&lt;p&gt;No ntp, it&#39;s basically all tls&lt;/p&gt;
&lt;p&gt;DNS requests:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;api2.sr.roku.com&lt;/li&gt;
&lt;li&gt;api.roku.com (twice)&lt;/li&gt;
&lt;li&gt;api.rokutime.com&lt;/li&gt;
&lt;li&gt;api.rpay.roku.com&lt;/li&gt;
&lt;li&gt;austin.sb.roku.com (twice)&lt;/li&gt;
&lt;li&gt;bailey.logs.roku.com&lt;/li&gt;
&lt;li&gt;cloudservices.roku.com&lt;/li&gt;
&lt;li&gt;configsvc.cs.roku.com&lt;/li&gt;
&lt;li&gt;display.ravm.tv (twice)&lt;/li&gt;
&lt;li&gt;hints.voice.roku.com&lt;/li&gt;
&lt;li&gt;images.sr.roku.com&lt;/li&gt;
&lt;li&gt;ls.cti.roku.com&lt;/li&gt;
&lt;li&gt;navigation.sr.roku.com&lt;/li&gt;
&lt;li&gt;scribe.logs.roku.com&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;api.rokutime.com sounds promising:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;A api.rokutime.com CNAME api-weights.us-east-1.rokutime.com CNAME api.us-east-2.rokutime.com CNAME rokumesh-2-device.us-east-2.msc.roku.com A 3.20.27.28 A 3.128.227.227 A 18.217.208.75
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We actually talk to all three of them, woooo&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Anyway, it&#39;s all tls, so I gave up for now.
It&#39;s basically working fine if you ignore the clock.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>Automagic ssh authentication for multiple github accounts</title>
        <link href="https://technicallycompetent.com/blog/gitkeys/"/>
        <updated>2024-06-11T17:33:24Z</updated>
        <id>https://technicallycompetent.com/blog/gitkeys/</id>
        <content type="html">&lt;p&gt;At $work we have multiple github organizations, some of which are associated
with my personal github account, and one of which is an enterprise thing that
can&#39;t share accounts.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;~/.ssh/config&lt;/code&gt;: setup different Host entries with different keys for each
github account&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Host github.com
    IdentityFile ~/.ssh/github_ed25519
Host github.com-$enterprise
    Hostname github.com
    IdentityFile ~/.ssh/github_$enterprise_ed25519
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;~/.gitconfig&lt;/code&gt;: The big thing is to rewrite remote URLs to match the different
Host entries in your &lt;code&gt;~/.ssh/config&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[url &amp;quot;git@github.com-$enterprise:$enterpriseOrg/&amp;quot;]
    insteadOf = git@github.com:$enterpriseOrg/
    insteadOf = https://github.com/$enterpriseOrg/
    insteadOf = ssh://git@github.com/$enterpriseOrg/

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will also handle if you clone via https&lt;/p&gt;
&lt;p&gt;The last one ist caused by pip stuff, I &lt;em&gt;think&lt;/em&gt; it&#39;s safe?&lt;/p&gt;
&lt;h3&gt;per-directory git configuration&lt;/h3&gt;
&lt;p&gt;One neat feature git has is the ability to include a different config based on
what directory it&#39;s in, so you can get different config based on where a repo is
located on your computer&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[includeIf &amp;quot;gitdir:~/work/&amp;quot;]
    path = ~/work/.gitconfig
&lt;/code&gt;&lt;/pre&gt;
</content>
    </entry>
    
    <entry>
        <title>Notes on using API Gateway Lambda Authorizers</title>
        <link href="https://technicallycompetent.com/blog/aws-cdk-apigateway-lambda-authorizer/"/>
        <updated>2024-05-23T17:48:17Z</updated>
        <id>https://technicallycompetent.com/blog/aws-cdk-apigateway-lambda-authorizer/</id>
        <content type="html">&lt;p&gt;TL;DR: api gateway authorizers can&#39;t support two authentictaion schemes at once, so $work can&#39;t use them&lt;/p&gt;
&lt;h2&gt;apigateway vs apigatewayv2&lt;/h2&gt;
&lt;p&gt;No idea what the difference is&lt;/p&gt;
&lt;h2&gt;http api vs rest api&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;http api (with apigatewayv2) supports authorizerPayloadFormatVersion 2.0 which has the simple format which is much nicer&lt;/li&gt;
&lt;li&gt;rest api supports modifying the responses so you can put more debugging into error messages&lt;/li&gt;
&lt;li&gt;SpecRestApi is the easy way to create an api from an openapi, it&#39;s apigateway and rest api&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;setup&lt;/h2&gt;
&lt;h3&gt;rest api apigateway&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;        const api = new apigateway.SpecRestApi( this, `api`, {
            apiDefinition: apigateway.AssetApiDefinition.fromInline(openapiConfig),
            failOnWarnings: true,
        });
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;http api apigatewayv2&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;        const api = new apigatewayv2.CfnApi(this, &#39;MyApi&#39;, {
            body: openapiConfig,
            failOnWarnings: true,
        });
        const stage = new apigatewayv2.CfnStage(this, &#39;MyCfnStage&#39;, {
            apiId: api.ref,
            stageName: &#39;$default&#39;,
            autoDeploy: true,
        });
        stage.addDependency(api);
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Authorizer permissions&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;        authLambda.addPermission(&amp;quot;PermitAPIGInvocation&amp;quot;, {
            principal: new cdk.aws_iam.ServicePrincipal(
                &amp;quot;apigateway.amazonaws.com&amp;quot;,
            ),
            // for a normal execute lambda, set sourceArn to arnForExecuteAPI(&amp;quot;*&amp;quot;)
            // it&#39;s the same as below if if resourceName ended up as `*/*/*`
            // auth lambdas are speical though
            sourceArn: this.apiGateway.stack.formatArn({
                service: &amp;quot;execute-api&amp;quot;,
                resource: this.apiGateway.restApiId,
                arnFormat: cdk.ArnFormat.SLASH_RESOURCE_NAME,
                resourceName: `authorizers/*`,
            }),
        });
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;openapi config&lt;/h3&gt;
&lt;h4&gt;setting up auth&lt;/h4&gt;
&lt;p&gt;A lambda can only have one authorizer lambda
An authorizer lambda can only AND inputs, it can&#39;t OR so if you want two types of authentication you can&#39;t really use authentication lambdas&lt;/p&gt;
&lt;p&gt;Also, api gateway doesn&#39;t believe in basic auth, you have to lie in your openapi config and say it&#39;s an api key&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    &amp;quot;components&amp;quot;: {
        &amp;quot;securitySchemes&amp;quot;: {
            &amp;quot;BasicAuth&amp;quot;: {
                &amp;quot;type&amp;quot;: &amp;quot;apiKey&amp;quot;,
                &amp;quot;in&amp;quot;: &amp;quot;header&amp;quot;,
                &amp;quot;name&amp;quot;: &amp;quot;authorization&amp;quot;,
                &amp;quot;description&amp;quot;: &amp;quot;http basic auth, but aws doesn&#39;t support basic so this says apiKey&amp;quot;
            },
&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;for http api, the docs are wrong about header capitalization
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html&quot;&gt;https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$request.header.Authorization&lt;/code&gt; needs to be &lt;code&gt;$request.header.authorization&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;for rest api, it&#39;s &lt;code&gt;method.request.whatever&lt;/code&gt; instead of &lt;code&gt;$request.whatever&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code&gt;            openapiConfig.components.securitySchemes
                .BasicAuth[&amp;quot;x-amazon-apigateway-authtype&amp;quot;] = &amp;quot;basic&amp;quot;;
            openapiConfig.components.securitySchemes
                .BasicAuth[&amp;quot;x-amazon-apigateway-authorizer&amp;quot;] = {
                    &amp;quot;type&amp;quot;: &amp;quot;request&amp;quot;,
                    &amp;quot;identitySource&amp;quot;: &amp;quot;method.request.header.authorization&amp;quot;,
                    &amp;quot;authorizerUri&amp;quot;:
                        `arn:aws:apigateway:${props.env.region}:lambda:path/2015-03-31/functions/${authLambda.functionArn}/invocations`,
                    &amp;quot;authorizerResultTtlInSeconds&amp;quot;: 0,
                };
&lt;/code&gt;&lt;/pre&gt;
&lt;h4&gt;WWW-Authenticate header&lt;/h4&gt;
&lt;p&gt;The responseTemplates is optional, I think it will tell you an error type in a response header, but it&#39;s easier to read if it&#39;s in the response&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;        openapiConfig[&amp;quot;x-amazon-apigateway-gateway-responses&amp;quot;] = {
            &amp;quot;ACCESS_DENIED&amp;quot;: {
                &amp;quot;statusCode&amp;quot;: 403,
                &amp;quot;responseParameters&amp;quot;: {
                    &amp;quot;gatewayresponse.header.WWW-Authenticate&amp;quot;:
                        `&#39;Basic realm=&amp;quot;${props.dnsCertStuff.domainString}&amp;quot;&#39;`,
                },
                &amp;quot;responseTemplates&amp;quot;: {
                    &amp;quot;application/json&amp;quot;:
                        &amp;quot;{&#92;&amp;quot;message&#92;&amp;quot;:$context.error.messageString, &#92;&amp;quot;flavour&#92;&amp;quot;: &#92;&amp;quot;access denied&#92;&amp;quot;}&amp;quot;,
                },
            },
            &amp;quot;INVALID_API_KEY&amp;quot;: {
                &amp;quot;statusCode&amp;quot;: 403,
                &amp;quot;responseParameters&amp;quot;: {
                    &amp;quot;gatewayresponse.header.WWW-Authenticate&amp;quot;:
                        `&#39;Basic realm=&amp;quot;${props.dnsCertStuff.domainString}&amp;quot;&#39;`,
                },
                &amp;quot;responseTemplates&amp;quot;: {
                    &amp;quot;application/json&amp;quot;:
                        &amp;quot;{&#92;&amp;quot;message&#92;&amp;quot;:$context.error.messageString, &#92;&amp;quot;flavour&#92;&amp;quot;: &#92;&amp;quot;invalid api key&#92;&amp;quot;}&amp;quot;,
                },
            },
            &amp;quot;UNAUTHORIZED&amp;quot;: {
                &amp;quot;statusCode&amp;quot;: 401,
                &amp;quot;responseParameters&amp;quot;: {
                    &amp;quot;gatewayresponse.header.WWW-Authenticate&amp;quot;:
                        `&#39;Basic realm=&amp;quot;${props.dnsCertStuff.domainString}&amp;quot;&#39;`,
                },
                &amp;quot;responseTemplates&amp;quot;: {
                    &amp;quot;application/json&amp;quot;:
                        &amp;quot;{&#92;&amp;quot;message&#92;&amp;quot;:$context.error.messageString, &#92;&amp;quot;flavour&#92;&amp;quot;: &#92;&amp;quot;unauthorized&#92;&amp;quot;}&amp;quot;,
                },
            },
        };
&lt;/code&gt;&lt;/pre&gt;
</content>
    </entry>
    
    <entry>
        <title>Notes on extracting SVG from SWF</title>
        <link href="https://technicallycompetent.com/blog/swf2svg/"/>
        <updated>2024-04-12T16:23:35Z</updated>
        <id>https://technicallycompetent.com/blog/swf2svg/</id>
        <content type="html">&lt;p&gt;I Found a flash thing with a vector I wanted, how to do this in 2024 was a little annoying to work out.&lt;/p&gt;
&lt;h2&gt;Tools required:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.swftools.org/&quot;&gt;swftools&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;tools for extracting stuff from SWFs&lt;/li&gt;
&lt;li&gt;building: download repo, make changes, build&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/maltaisn/swf-convert&quot;&gt;swf-convert&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;convert extracted assets to svg&lt;/li&gt;
&lt;li&gt;just download the jar&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;building swftools&lt;/h3&gt;
&lt;p&gt;Gotta fix a warning about comparing a pointer to a number:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;925c925
&amp;lt;     if(pos1=0)
---
&amp;gt;     if(pos1 != NULL)
927c927
&amp;lt;     else if(pos2&amp;gt;=0)
---
&amp;gt;     else if(pos2 != NULL)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Because of the way they build each lib separate then link, tell linker to ignore multiple defines, it&#39;s &lt;em&gt;probably&lt;/em&gt; fine (worked for me!)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;LDFLAGS=&amp;quot;-z muldefs&amp;quot; CFLAGS=-ggdb ./configure
make
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;extracting&lt;/h2&gt;
&lt;h3&gt;find interesting paths&lt;/h3&gt;
&lt;p&gt;swfextract gives a list of paths, manually edit it and&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;for i in $paths; do ../swftools-0.9.2/src/swfextract ../whatever.swf -i &amp;quot;$i&amp;quot; -o &amp;quot;$i.swf&amp;quot; &amp;amp;&amp;amp; ../swftools-0.9.2/src/swfrender &amp;quot;$i.swf&amp;quot; -o &amp;quot;$i.png&amp;quot;; done
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Look at the output pngs to find which IDs we want.&lt;/p&gt;
&lt;h3&gt;turn paths into svg&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;java -jar ../swf-convert.jar svg $id.swf
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;outputs &lt;code&gt;$id.svg&lt;/code&gt;&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>Frsky communications intro</title>
        <link href="https://technicallycompetent.com/blog/frsky-communication-intro/"/>
        <updated>2023-05-11T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/frsky-communication-intro/</id>
        <content type="html">&lt;p&gt;Adventures in connecting an RC transmitter to an arduino.&lt;/p&gt;
&lt;h2&gt;Tables of Overview&lt;/h2&gt;
&lt;h3&gt;Communication Protocols between receiver and MCU&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;SBUS
&lt;ul&gt;
&lt;li&gt;
&lt;blockquote&gt;
&lt;p&gt;SBUS is a bus protocol for receivers to send commands to servos.
Unlike PWM, SBUS uses a bus architecture where a single serial line can be
connected with up to 16 servos with each receiving a unique command.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;inverted UART, 100000 8E2 (fast mode 200000 baud)&lt;/li&gt;
&lt;li&gt;SBUS IN lets you have a backup receiver&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;SmartPort / S.Port
&lt;ul&gt;
&lt;li&gt;telemetry&lt;/li&gt;
&lt;li&gt;inverted UART, 57600 8N1, bidirectional on a single wire&lt;/li&gt;
&lt;li&gt;receiver polls sensors, sensors respond when poked&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;F.Port / FPort
&lt;ul&gt;
&lt;li&gt;Combined control/telemetry&lt;/li&gt;
&lt;li&gt;&amp;quot;slightly faster than SBUS&amp;quot;&lt;/li&gt;
&lt;li&gt;Not inverted&lt;/li&gt;
&lt;li&gt;No documentation&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;F.Port V2
&lt;ul&gt;
&lt;li&gt;Came with the ACCESS stuff&lt;/li&gt;
&lt;li&gt;No documentation&lt;/li&gt;
&lt;li&gt;Not sure if it&#39;s compatible with V1, there is none documentation&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Firmware/communication stuff between transmitter and receiver&lt;/h3&gt;
&lt;p&gt;Firmware on the receiver and transmitter for talking to each other&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;ACCST 1.x / ACCST D8(not sure about this name, I feel like 2.x can do 8 channels? Saw it on a forum though)
&lt;ul&gt;
&lt;li&gt;SBUS for 8 or 16 channels&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;ACCST 2.x / ACCST D16
&lt;ul&gt;
&lt;li&gt;small fix for some bug, but completely incompatible&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;ACCESS
&lt;ul&gt;
&lt;li&gt;New thing people seem to like it better&lt;/li&gt;
&lt;li&gt;A lot of transmitters that do ACCESS also do ACCST 2.x&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Hardware I have&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;frsky R-XSR reciever&lt;/li&gt;
&lt;li&gt;frsky taranis x9d-plus running opentx
&lt;ul&gt;
&lt;li&gt;Onboard transmitter can only do ACCST 1.x&lt;/li&gt;
&lt;li&gt;There is the external radio bay that could do more but eh.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Literature Search for Software Libraries&lt;/h3&gt;
&lt;h4&gt;SBUS&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/bolderflight/sbus&quot;&gt;bolderflight/sbus&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/TheDIYGuy999/SBUS&quot;&gt;TheDIYGuy999/SBUS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ernstc.dk/arduino/sbus.html&quot;&gt;Sbus converter using Arduino&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;SmartPort&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/jcheger/arduino-frskysp&quot;&gt;jcheger/arduino-frskysp&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;handles teensey or 328P via &lt;code&gt;#ifdef&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/zendes/SPort&quot;&gt;zendes/SPort&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/DanNixon/FrSky_SPORT_Arduino&quot;&gt;DanNixon/FrSky_SPORT_Arduino&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/openXsensor/openXsensor&quot;&gt;openXsensor/openXsensor&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;multi-protocol, not just S.Port&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/sgofferj/arduino-frsky&quot;&gt;sgofferj/arduino-frsky&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;for reading telemetry,&lt;/li&gt;
&lt;li&gt;It &lt;em&gt;doesn&#39;t&lt;/em&gt; try to handle serial for you! So much nicer!&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;In the end I went with&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;SPort: &lt;a href=&quot;https://github.com/jcheger/arduino-frskysp&quot;&gt;jcheger/arduino-frskysp&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;SBUS: &lt;a href=&quot;https://github.com/bolderflight/sbus&quot;&gt;bolderflight/sbus&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The SPort library wanted to use &lt;code&gt;SoftwareSerial&lt;/code&gt; and just talk and receive on
the same pin, which didn&#39;t work too good on the esp32 so I forked it to use
&lt;code&gt;HardwareSerial&lt;/code&gt; and to swap which pins are which at the right times.&lt;/p&gt;
&lt;p&gt;I had to put a 1ms delay before sending a packet, because &lt;code&gt;HardwareSerial&lt;/code&gt;
doesn&#39;t like talking right after a call to &lt;code&gt;setPins&lt;/code&gt;.
I don&#39;t love that, and would like to see it go away or at least get reduced.&lt;/p&gt;
&lt;h2&gt;In the end, basic kinda working example&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/mtfurlan/arduino-sbus-test&quot;&gt;mtfurlan/arduino-sbus-test&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/frsky-communication-intro/working.gif&quot; alt=&quot;gif demonstrating a switch showing up in the telemetry and the controller controlling LEDs&quot;&gt;&lt;/p&gt;
&lt;p&gt;I don&#39;t know how to use the frsky transmitter to &lt;em&gt;view&lt;/em&gt; telemetry yet, but you
can see that in the telemetry config menu it works.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>USB PD multi-voltage trigger</title>
        <link href="https://technicallycompetent.com/blog/usb-pd-multi-voltage-trigger/"/>
        <updated>2022-08-16T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/usb-pd-multi-voltage-trigger/</id>
        <content type="html">&lt;p&gt;I needed USB PD to barrel jack with multiple voltages.&lt;/p&gt;
&lt;p&gt;This project was started when &lt;a href=&quot;https://www.youtube.com/user/DeviantOllam&quot;&gt;Deviant Ollam&lt;/a&gt; posted a video about using a USB PD trigger to barrel adapter with a barrel adapter kit instead of sorting through a bin of power bricks.
The issue was that USB PD trigger only output 19V, which not all devices will tolerate.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/usb-pd-multi-voltage-trigger/final.jpg&quot; alt=&quot;Final&quot;&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;So I found this &lt;a href=&quot;https://www.ebay.com/itm/185396073306&quot;&gt;USB PD trigger module with solder jumpers for voltage&lt;/a&gt; and made a shitty enclosure for it.
&lt;img src=&quot;/assets/pages/usb-pd-multi-voltage-trigger/listing.jpg&quot; alt=&quot;closeup of trigger module&amp;quot; style=&amp;quot;max-width:400px;width:100%&quot;&gt;
You short the three pads to make different voltages.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Voltage│Short pad
        A│B│C
     20│0│0│0
     15│1│0│0
     12│0│1│0
      9│1│1│0
      5│0│1│1
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Prototype&lt;/h2&gt;
&lt;p&gt;Just threw it together, it worked fine:
&lt;img src=&quot;/assets/pages/usb-pd-multi-voltage-trigger/prototype.jpg&quot; alt=&quot;prototype&quot;&gt;&lt;/p&gt;
&lt;h2&gt;Enclosure&lt;/h2&gt;
&lt;p&gt;I got a friend to model something close to good enough in fusion 360, and then I edited in blender to adjust for tolerances.
&lt;img src=&quot;/assets/pages/usb-pd-multi-voltage-trigger/dimensions.jpg&quot; alt=&quot;parts dimensions&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/images/usb-pd-multi-voltage-trigger/usbPDShell-short.stl&quot;&gt;My final STL&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Assembly&lt;/h2&gt;
&lt;p&gt;The hardest part was soldering the tiny wires to the pads without shorting anything.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;put 30AWG wires on the trigger module&lt;/li&gt;
&lt;li&gt;glue the wires down (by the end I had found that superglue worked the best because hot glue left too much of a bump)&lt;/li&gt;
&lt;li&gt;put the dip switch and voltmeter and trigger module in the enclosure&lt;/li&gt;
&lt;li&gt;trim wires to length to reach the DIP switch&lt;/li&gt;
&lt;li&gt;strip wires&lt;/li&gt;
&lt;li&gt;solder wires
&lt;img src=&quot;/assets/pages/usb-pd-multi-voltage-trigger/wiringA.jpg&quot; alt=&quot;wiring trigger to DIP switches&quot;&gt;&lt;/li&gt;
&lt;li&gt;put in wires for voltmeter
&lt;img src=&quot;/assets/pages/usb-pd-multi-voltage-trigger/wiringB.jpg&quot; alt=&quot;wire in voltmeter&quot;&gt;&lt;/li&gt;
&lt;li&gt;Tune voltmeter so it&#39;s a bit above instead of a bit below (showing 8.9V for 9V is more annoying than showing 9.1V)&lt;/li&gt;
&lt;li&gt;Pot dip switch in epoxy or superglue or hot glue&lt;/li&gt;
&lt;li&gt;put in output wires (14AWG speaker wire was just what I had lying around)
&lt;img src=&quot;/assets/pages/usb-pd-multi-voltage-trigger/wiringC.jpg&quot; alt=&quot;all wired in&quot;&gt;&lt;/li&gt;
&lt;li&gt;glue in display and dip swith with something fast curing (my first one had epoxy leak out the front and look bad)&lt;/li&gt;
&lt;li&gt;pot the back with epoxy
&lt;img src=&quot;/assets/pages/usb-pd-multi-voltage-trigger/final_back.jpg&quot; alt=&quot;potted back&quot;&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;Next Steps&lt;/h2&gt;
&lt;p&gt;I did monday evening when I was leaving tuesday afternoon for defcon, so it could be a lot better&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;label switches with voltage table&lt;/li&gt;
&lt;li&gt;better enclosure
&lt;ul&gt;
&lt;li&gt;less glue, actual back&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;A more permanent barrel jack (the non-screw ones I had couldn&#39;t fit the 14AWG)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If anyone wants to help improve this I&#39;m happy to update this post with better stuff and credit you.&lt;/p&gt;
&lt;h2&gt;Parts&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.ebay.com/itm/185396073306&quot;&gt;USB PD trigger module with solder jumpers for voltage&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://smile.amazon.com/dp/B07Q2RQYPJ&quot;&gt;random voltmeter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://smile.amazon.com/gp/product/B07CB8Z6ZP/&quot;&gt;random dip switches I had lying around&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;30AWG wire&lt;/li&gt;
&lt;li&gt;Bigger output wire (I had 14AWG speaker wire)&lt;/li&gt;
&lt;/ul&gt;
</content>
    </entry>
    
    <entry>
        <title>Jenkins Automatic Backup &amp; Testing</title>
        <link href="https://technicallycompetent.com/blog/jenkins-automatic-backup-testing/"/>
        <updated>2022-07-11T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/jenkins-automatic-backup-testing/</id>
        <content type="html">&lt;p&gt;Backing up jenkins seems like it should be a solved problem and yet.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://www.jenkins.io/doc/book/system-administration/backing-up/&quot;&gt;Jenkins User Handbook -&amp;gt; System Administration -&amp;gt; Backing-up/Restoring Jenkins&lt;/a&gt;  has a nice overview of everything you need to back up jenkins.&lt;/p&gt;
&lt;p&gt;I would have assumed I could just find a script or install a plugin, but none of them did the critical thing of &lt;em&gt;testing the backup&lt;/em&gt;, and a lot of them just included the master.key which the jenkins handbook specifically says don&#39;t keep in the backups.&lt;/p&gt;
&lt;p&gt;So I had to write my own.&lt;/p&gt;
&lt;p&gt;Current issues:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Testing the backup consists of starting it and then checking for a 200 from the login page, so not very thorough&lt;/li&gt;
&lt;li&gt;Running the jenkins under test on the host controller causes issues
&lt;ul&gt;
&lt;li&gt;The controller reaches out to talk to some build nodes now, but I don&#39;t like it doing that when under test&lt;/li&gt;
&lt;li&gt;I can change the http port, but not the build agent connection port or the SSH CLI port, so those just throw errors&lt;/li&gt;
&lt;li&gt;Running in docker could solve a lot of this, but the controller doesn&#39;t have docker and I don&#39;t want to copy the master.key off the controller&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;It would be cool to watch the boot logs to figure out when it&#39;s ready instead of just hardcoding a time but that&#39;s hard.&lt;/li&gt;
&lt;li&gt;Lots of hardcoding &lt;em&gt;everywhere&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It boils down to &lt;code&gt;backup.sh&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sh&quot;&gt;tar --force-local -czpf &amp;quot;$tarball&amp;quot; &#92;
    -C &amp;quot;$(dirname &amp;quot;$jenkinsHome&amp;quot;)&amp;quot; &amp;quot;$(basename &amp;quot;$jenkinsHome&amp;quot;)&amp;quot; &#92;
        --exclude=&amp;quot;jobs&amp;quot; &#92;
        --exclude=&amp;quot;.*&amp;quot; &#92;
        --exclude=&amp;quot;*cache&amp;quot; &#92;
        --exclude=&amp;quot;workspace&amp;quot; &#92;
        --exclude=&amp;quot;secrets/master.key&amp;quot; &#92;
    -C &amp;quot;$(dirname &amp;quot;$jenkinsWar&amp;quot;)&amp;quot; &amp;quot;$(basename &amp;quot;$jenkinsWar&amp;quot;)&amp;quot; &#92;
    -C &amp;quot;$DIR&amp;quot; README.md
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and &lt;code&gt;test.sh&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sh&quot;&gt;tar xf &amp;quot;$jenkinsTarball&amp;quot;
cp &amp;quot;$jenkinsMasterKey&amp;quot; jenkins/secrets/master.key

# run jenkins in background
JENKINS_HOME=&amp;quot;$(pwd)/jenkins&amp;quot; timeout &amp;quot;$((jenkinsStartupDelay+5))&amp;quot; java -jar &amp;quot;$(pwd)/jenkins.war&amp;quot; --httpPort=9999 &amp;amp;

# TODO: instead of sleep watch output and look for &amp;quot;Jenkins is fully up and running&amp;quot;
sleep $jenkinsStartupDelay

if [[ &amp;quot;$(curl -s -w &amp;quot;%{http_code}&amp;quot; http://localhost:9999/login -o /dev/null)&amp;quot; != &amp;quot;200&amp;quot; ]]; then
    echo &amp;quot;jenkins didn&#39;t come online&amp;quot;
    exit 1
fi
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;jenkinsStartupDelay&lt;/code&gt; is just a time that jenkins will probably start up in, so we run jenkins with timeout of jenkinsStartupDelay + 5 in the background, sleep for jenkinsStartupDelay seconds, then check if it&#39;s online&lt;/p&gt;
&lt;p&gt;This is all called from a jenkins pipeline to run the backup and test on the controller, stash the tarball, unstash it on a build node with a backup hard drive, and then copy it to the backup dir and remove old backups.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Unrelated fun fact: If you have colon in a filename in tar, tar will think it&#39;s some kind of remote thing without &lt;code&gt;--force-local&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;       --force-local
              Archive file is local even if it has a colon.
&lt;/code&gt;&lt;/pre&gt;
</content>
    </entry>
    
    <entry>
        <title>Kinesis Advantage USBC mod &amp; QMK notes</title>
        <link href="https://technicallycompetent.com/blog/kinesis-advantage-usbc-qmk-notes/"/>
        <updated>2022-07-07T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/kinesis-advantage-usbc-qmk-notes/</id>
        <content type="html">&lt;p&gt;I have three kinesis advantage now, this is what I&#39;ve done.&lt;/p&gt;
&lt;p&gt;First off notes on the keyboards:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Kinesis Advantage Pro (daily driver)&lt;/li&gt;
&lt;li&gt;Kinesis Advantage (spare from when I worked in an office every day)&lt;/li&gt;
&lt;li&gt;Kinesis Advantage 2 with a &lt;a href=&quot;https://github.com/kinx-project/kint&quot;&gt;kinT keyboard controller&lt;/a&gt; with a Teensy++ 2.0 running QMK (new one I just got from someone who apparently didn&#39;t need it anymore)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I don&#39;t really understand the difference between the first two, though I don&#39;t
really use many features besides the basic key remapping.
I do like the nicer F keys on the Advantage 2.&lt;/p&gt;
&lt;p&gt;Also, I really want to thank Kinesis support for selling me the exact screws I needed because I am dumb and lost a few somewhere.
It&#39;s really appreciated that they will do that kind of support.&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;Hardware Modifications&lt;/h2&gt;
&lt;p&gt;A few years ago I started replacing the permanently attached cables with USBC ports, I finally did it to a second keyboard and am writing everything I know down.&lt;/p&gt;
&lt;p&gt;Final outside:
&lt;img src=&quot;/assets/pages/kinesis-advantage-notes/final_outside.jpg&quot; alt=&quot;final outside&quot;&gt;&lt;/p&gt;
&lt;p&gt;Original:
&lt;img src=&quot;/assets/pages/kinesis-advantage-notes/orig_outside.jpg&quot; alt=&quot;original outside cable mess&quot;&gt;
&lt;img src=&quot;/assets/pages/kinesis-advantage-notes/orig_inside.jpg&quot; alt=&quot;original inside&quot;&gt;
I cut down a USBC panel mount bracket to fit and adapted it to the thing.&lt;/p&gt;
&lt;p&gt;Thanks to &lt;a href=&quot;https://electronics.stackexchange.com/a/559183/181040&quot;&gt;Mihail H. on electronics.stackexchange&lt;/a&gt; for pointing out it&#39;s JST PH.
&lt;img src=&quot;/assets/pages/kinesis-advantage-notes/cables.jpg&quot; alt=&quot;usbc cables &amp;amp; final inside&quot;&gt;
One of the panel mount USBC things I bought had separate wires for the two D+/D- pairs, so I initially had a USBC connector that only worked one way, very cursed.
The other two just had a single set of D+/D- which is much easier.&lt;/p&gt;
&lt;p&gt;Onwards to the pinout of the foot pedal connector:
&lt;img src=&quot;/assets/pages/kinesis-advantage-notes/connector.jpg&quot; alt=&quot;final outside&quot;&gt;
Cable pinout of JST XH&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;6P4C pin 4 (green)&lt;/li&gt;
&lt;li&gt;6P4C pin 2 (black)&lt;/li&gt;
&lt;li&gt;USB 5V&lt;/li&gt;
&lt;li&gt;USB D+&lt;/li&gt;
&lt;li&gt;USB D-&lt;/li&gt;
&lt;li&gt;USB GND / 6P4C pin 3 (red)&lt;/li&gt;
&lt;li&gt;6P4C pin 5 (yellow)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;It&#39;s weird that 3(red) is connected to USB ground when both &lt;a href=&quot;https://gist.github.com/kolontsov/c5150fb253cf61c9c6865d12be4d02c8&quot;&gt;kilontsov&lt;/a&gt; and &lt;a href=&quot;http://www.kw.igs.net/~schoedel/kinesis/&quot;&gt;Kevin P Schoedel&lt;/a&gt; say 4 (green) is common.&lt;/p&gt;
&lt;p&gt;I don&#39;t use foot pedals right now so I&#39;m ignoring this not making sense.&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;QMK Notes&lt;/h2&gt;
&lt;p&gt;The default QMK config in the &lt;a href=&quot;https://config.qmk.fm/#/kinesis/kint2pp/LAYOUT&quot;&gt;QMK configurator&lt;/a&gt; didn&#39;t do the keypad layout and did the insert key wrong.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/images/kinesis-advantage-notes/kinesis_kint2pp_layout_mine.json&quot;&gt;I fixed it&lt;/a&gt;.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>Android Headphone Buttons</title>
        <link href="https://technicallycompetent.com/blog/android-headphone-buttons/"/>
        <updated>2022-03-03T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/android-headphone-buttons/</id>
        <content type="html">&lt;p&gt;I wanted a skip backwards button for audiobooks in the car so I used the android headphone button standard.&lt;/p&gt;
&lt;p&gt;Android &lt;a href=&quot;https://source.android.com/devices/accessories/headset/plug-headset-spec&quot;&gt;3.5mm headset accessory spec&lt;/a&gt;
says that you can have 4 buttons by putting different resistances between mic and ground.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Function A(0Ω)
&lt;ul&gt;
&lt;li&gt;short: play/pause&lt;/li&gt;
&lt;li&gt;double: next&lt;/li&gt;
&lt;li&gt;long: trigger assist&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Function B(240Ω): vol up&lt;/li&gt;
&lt;li&gt;Function C(470Ω): vol down&lt;/li&gt;
&lt;li&gt;Function D(135Ω): &amp;quot;reserved&amp;quot;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You supposed to do some fancy math with the mic resistance, but as I don&#39;t intend to have a mic on this I skipped it&lt;/p&gt;
&lt;p&gt;The hard part was getting function D to do anything.
I can&#39;t get any of the key press debugging apps I tried to register it.
It definitely does things by default, like make tasker save, or close the pulldown menu.
No idea what the phone thinks it is though.&lt;/p&gt;
&lt;p&gt;I did eventually get &lt;a href=&quot;https://play.google.com/store/apps/details?id=com.joaomgcd.automediabuttons&amp;amp;hl=en_US&amp;amp;gl=US&quot;&gt;AutoMediaButtons&lt;/a&gt;
from the &lt;a href=&quot;https://joaoapps.com/&quot;&gt;tasker AutoApps family&lt;/a&gt; to register it as a &amp;quot;pressy&amp;quot; button.&lt;/p&gt;
&lt;p&gt;&amp;quot;Pressy&amp;quot; appears to be some product that is a headphone jack and just has a
single button.
It&#39;s weird that I can&#39;t make tasker recognize it in any normal
fashion, but at least now I can have it tell my media player to skip back a
bit.
When the question of how to make a pressy button trigger tasker is asked
the responses are to use a custom app to detect it and then call tasker, which
is super dumb.&lt;/p&gt;
&lt;p&gt;Ignore the fact that I ended up with rewind on the right, I&#39;m not resoldering it.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/android-headphone-buttons/schematic.png&quot; alt=&quot;schematic&quot;&gt;
&lt;img src=&quot;/assets/pages/android-headphone-buttons/actual.jpg&quot; alt=&quot;final result&quot;&gt;&lt;/p&gt;
&lt;p&gt;I haven&#39;t used this in the car yet but it seems to be working on the bench.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>Repartitioning a Cryptsetup&amp;LVM Encrypted Laptop</title>
        <link href="https://technicallycompetent.com/blog/repartitioning-cryptsetup-lvm-laptop/"/>
        <updated>2022-02-10T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/repartitioning-cryptsetup-lvm-laptop/</id>
        <content type="html">&lt;p&gt;I just wanted to add a hard drive for more boot, home, and swap.
Four days later it eventually worked.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;The debian installer left me a swap and a root in the same LVM VG in a luks parittion.&lt;/p&gt;
&lt;p&gt;(recreated vaguely initial state)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;NAME                  MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                     8:0    0 223.6G  0 disk
|-sda1                  8:3    0   200M  0 part  /boot
|-sda2                  8:2    0     1K  0 part
`-sda5                  8:5    0 219.6G  0 part
  `-sda5_crypt        254:0    0 219.6G  0 crypt
    `-merida--vg-root 254:1    0 219.6G  0 lvm   /
    `-merida--vg-swap ???:?    0     4G  0 lvm   [SWAP]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;end result, close enough to what was intended&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;NAME                  MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                     8:0    0 223.6G  0 disk
|-sda2                  8:2    0     1K  0 part
|-sda3                  8:3    0   3.7G  0 part  /boot
`-sda5                  8:5    0 219.6G  0 part
  `-sda5_crypt        254:0    0 219.6G  0 crypt
    `-merida--vg-root 254:1    0 219.6G  0 lvm   /
sdb                     8:16   0 953.9G  0 disk
|-sdb1                  8:17   0 937.9G  0 part
| `-crypthome         254:3    0 937.9G  0 crypt /home
`-sdb2                  8:18   0    16G  0 part
  `-cryptswap         254:2    0    16G  0 crypt [SWAP]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On my first attempt I created a single luks device out of sdb, made a LVM PV, VG, and two LVs for home and swap.
Worked fine, everything was cool.
Then I tried to make it unlock the swap early enough to recover from hibernation.
Some people claim you can just setup a keyfile in already unlocked memory like&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;crypthome UUID=b9824fe9-e46a-428a-b043-8488a9ec10eb /etc/luks-keys/home_swap.luks luks
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I couldn&#39;t make it work.&lt;/p&gt;
&lt;p&gt;So I found
&lt;a href=&quot;https://cryptsetup-team.pages.debian.net/cryptsetup/README.initramfs.html#the-decrypt_derived-keyscript&quot;&gt;passdev&lt;/a&gt;
to use one encrypted device as the password to another somehow, but that was bad for data you cared about, so I needed to split up my luks on the new drive.&lt;/p&gt;
&lt;p&gt;After deleting everything on the new drive, repartitioning, and setting up seperate luks things, I learned about
&lt;a href=&quot;https://cryptsetup-team.pages.debian.net/cryptsetup/README.keyctl.html&quot;&gt;decrypt_keyctl&lt;/a&gt;
which just seems better.&lt;/p&gt;
&lt;p&gt;Then finally I just had to muddle through not being able to move sda2 which is an extended partition containing sda5 to move my free space from what used to be swap inside the original debian LVM VG to be next to the boot partition, so I got to duplicate my boot partition and delete the old one instead of just expanding it.
It lead to some exciting boots but eventually worked.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;In the end, my &lt;code&gt;/etc/crypttab&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sda5_crypt UUID=b95ef56c-d73f-47f6-8653-587910112519  not_a_real_keyfile   luks,discard,keyscript=decrypt_keyctl
cryptswap UUID=b63caace-f211-452d-a4fe-5d27412f4d6b   not_a_real_keyfile   luks,discard,keyscript=decrypt_keyctl
crypthome UUID=b9824fe9-e46a-428a-b043-8488a9ec10eb   not_a_real_keyfile   luks,discard,keyscript=decrypt_keyctl
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;/etc/initramfs-tools/conf.d/resume&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;RESUME=/dev/mapper/cryptswap
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Reminder to run &lt;code&gt;update-initramfs -u -k all&lt;/code&gt; a few extra times, and maybe &lt;code&gt;update-grub $device&lt;/code&gt; too.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>Marlin on the Ultimaker 2</title>
        <link href="https://technicallycompetent.com/blog/um2-marlin/"/>
        <updated>2022-01-08T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/um2-marlin/</id>
        <content type="html">&lt;p&gt;$work has an ultimaker 2, I wanted to upgrade it and this would be vastly simpler with control over the firmware.&lt;/p&gt;
&lt;h2&gt;Ultimaker firmware&lt;/h2&gt;
&lt;p&gt;The stock ultimaker firmware situation is very confusing.&lt;/p&gt;
&lt;p&gt;Ultimaker have three github repos for three types of printer according to
&lt;a href=&quot;https://github.com/Ultimaker/Ultimaker2Marlin/issues/135#issuecomment-384258724&quot;&gt;Ultimaker employee ckielstra&lt;/a&gt;,
and they may have more by now, they&#39;ve released more printers.&lt;/p&gt;
&lt;p&gt;My printer had 2.6 firmware on it, and I never figured out which branch was for the UM2 let alone that version.
I just gave up and am hoping that if I ever want stock firmware for some reason cura will just hand me something useful.&lt;/p&gt;
&lt;h2&gt;Marlin&lt;/h2&gt;
&lt;p&gt;Running 2.0.9.3 for now because it&#39;s the most recent tag.&lt;/p&gt;
&lt;p&gt;It&#39;s built with pio which is super convinent.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;pio run -e mega2560ext
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;firmware is now at &lt;code&gt;.pio/build/mega2560ext/firmware.hex&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;Starting Config&lt;/h3&gt;
&lt;p&gt;Someone was nice enough to
&lt;a href=&quot;https://github.com/MarlinFirmware/Configurations/tree/import-2.0.x/config/examples/Ultimaker/Ultimaker%202&quot;&gt;share a UM2 config for Marlin&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Flashing&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://community.ultimaker.com/topic/17871-solved-cant-update-firmware-on-um2-i-think-ive-checked-all-the-obvious-stuff/#elControls_178123_menu&quot;&gt;Ultimaker forum user amedee&lt;/a&gt;
gives us correct avrdude flashing arguments:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;avrdude -C /etc/avrdude.conf -v -p atmega2560 -c wiring -P &amp;quot;/dev/ttyACM0&amp;quot; -b 115200 -D -U &amp;quot;flash:w:firmware.hex:i&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or octopi firmware updater plugin, the AVR programmer type is &amp;quot;wiring&amp;quot;.&lt;/p&gt;
&lt;h2&gt;Running&lt;/h2&gt;
&lt;p&gt;Out of the gate the menu works, it moves.
Doesn&#39;t reach temp though, just &lt;a href=&quot;https://cdn.discordapp.com/attachments/400424470327721985/929252930052317204/unknown.png&quot;&gt;https://cdn.discordapp.com/attachments/400424470327721985/929252930052317204/unknown.png&lt;/a&gt;
Looks like a PID issue but I don&#39;t want to learn PID tuning tonight.&lt;/p&gt;
&lt;p&gt;Octoprint recommends
&lt;code&gt;HOST_ACTION_COMMANDS&lt;/code&gt; so I enabled &lt;code&gt;HOST_PAUSE_M76&lt;/code&gt; and &lt;code&gt;HOST_PROMPT_SUPPORT&lt;/code&gt;.
It means the printer can tell octoprint to pause.&lt;/p&gt;
&lt;h2&gt;PID tuning&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://marlinfw.org/docs/gcode/M303.html&quot;&gt;https://marlinfw.org/docs/gcode/M303.html&lt;/a&gt;&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>homeassistant-tablets</title>
        <link href="https://technicallycompetent.com/blog/homeassistant-tablets/"/>
        <updated>2022-01-08T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/homeassistant-tablets/</id>
        <content type="html">&lt;p&gt;Hackday tablet
Vulkan Electronics | Excursion XC
Model No: VT1008X4
FCC ID: 2AFA3V106&lt;/p&gt;
&lt;p&gt;battery connector notes: &lt;a href=&quot;https://groups.google.com/g/hackadaytablets/c/97yV7rLxKw8/m/8nUgaZL6AgAJ&quot;&gt;https://groups.google.com/g/hackadaytablets/c/97yV7rLxKw8/m/8nUgaZL6AgAJ&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;A careful examination will reveal that the &amp;quot;sense&amp;quot; wire goes nowhere on almost all of the tablets.
I have seen a handful of boards where the boards appear to be more fully populated down by the battery connector.
They more populated ones appear to actually make use of the &amp;quot;sense&amp;quot; wire.
I also have some tablets that had batteries soldered on (now cut off) they just used two wires connected.&lt;/p&gt;
&lt;p&gt;I have not had any issues charging batteries. The third wire is appears to be a temperature  sense and
is not used on most of the tablets I have seen. I would suggest that you do your own investigation well.
I my be wrong.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;HackADayTablets&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;p&gt;On a side note the sense wire appears to go to a thermistor that has a 12k resistance at 65 degrees f while other side is connected to the black/negative wire.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;william.a...@gmail.com&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Video powering from bench supply:
&lt;a href=&quot;https://www.youtube.com/watch?v=B15UcgVrals&quot;&gt;https://www.youtube.com/watch?v=B15UcgVrals&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Video removing battery connector:
&lt;a href=&quot;https://www.youtube.com/watch?v=Rd5Z62_dRlUo&quot;&gt;https://www.youtube.com/watch?v=Rd5Z62_dRlUo&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Notes on powering it:
&lt;a href=&quot;https://11569134993819730327.googlegroups.com/attach/3736e2b645ba/Vulcan%20tablet%20notes%2011-29-21.pdf?part=0.1&amp;amp;view=1&amp;amp;vt=ANaJVrFVZqxqziVzWlNjqpiSq_Kbbb1eNW6DbGSBCQXI_g0z7JvOs3Cpcp8cF_2pnCQPXVqhvaI1OuFRj8E-IQFkwEtRB_O_af2l8eqlcZfZGHQSHTg4Vpo&quot;&gt;https://11569134993819730327.googlegroups.com/attach/3736e2b645ba/Vulcan tablet notes 11-29-21.pdf?part=0.1&amp;amp;view=1&amp;amp;vt=ANaJVrFVZqxqziVzWlNjqpiSq_Kbbb1eNW6DbGSBCQXI_g0z7JvOs3Cpcp8cF_2pnCQPXVqhvaI1OuFRj8E-IQFkwEtRB_O_af2l8eqlcZfZGHQSHTg4Vpo&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Powerup summary:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;connect 5V to battery connector area&lt;/li&gt;
&lt;li&gt;Wait till it stops drawing power (21s)&lt;/li&gt;
&lt;li&gt;Press power button 2 seconds&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;layout&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
                        power, volume u/d
                            v  v  v
                           ┌─────────────────────┐
                           │       camera        │
                           │                     │
                   reset--&amp;gt;│                logo │
usb and other connectors--&amp;gt;│                     │
                           │                     │
                           └─────────────────────┘
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;passwords&lt;/h2&gt;
&lt;p&gt;some tablets come with oem install mode, others are in setup mode.
bios: empty
oem install mode: oem/oem&lt;/p&gt;
&lt;h2&gt;bios&lt;/h2&gt;
&lt;p&gt;disable pxeboot
disable numpad&lt;/p&gt;
&lt;p&gt;What is&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Android-IA&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;UEFI: Built-in EFI Shell&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Running software&lt;/h2&gt;
&lt;p&gt;It boots mint, thanks Mike.
I ended up wanting debian though&lt;/p&gt;
&lt;p&gt;&lt;code&gt;apt install vim tmux git redshift-gtk network-manager-gnome ntp&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;display&lt;/h3&gt;
&lt;h4&gt;screen rotation&lt;/h4&gt;
&lt;p&gt;&lt;a href=&quot;https://wiki.ubuntu.com/X/InputCoordinateTransformation&quot;&gt;https://wiki.ubuntu.com/X/InputCoordinateTransformation&lt;/a&gt;
inverted (cables downards, logo up)
&lt;code&gt;~/.xsessionrc&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;xrandr -o inverted
xinput set-prop pointer:&#39;Goodix Capacitive TouchScreen&#39; &#39;Coordinate Transformation Matrix&#39; -1 0 1 0 -1 1 0 0 1
&lt;/code&gt;&lt;/pre&gt;
&lt;h4&gt;Power dimming&lt;/h4&gt;
&lt;p&gt;&lt;code&gt;~/.xsessionrc&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# turn off default screensaver
xset s off
# turn off default standby, hibernate, ... after n minutes
xset -dpms
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;autostart&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;.config/lxsession/LXDE/autostart&lt;/code&gt;
runs ~/startup.sh&lt;/p&gt;
&lt;h4&gt;Kiosk&lt;/h4&gt;
&lt;pre&gt;&lt;code&gt;firefox --kiosk http://whatever
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Reshift&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;~/.config/redshift.conf&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[redshift]
location-provider=manual

[manual]
lat=whatever
lon=whatever
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Run redshift, enable at boot from status icon&lt;/p&gt;
&lt;h3&gt;Logo button&lt;/h3&gt;
&lt;p&gt;The logo button is bound to &lt;code&gt;Super_L&lt;/code&gt; I found it helpful to be sure that&#39;s bound to something to tab out of the kiosk browser.&lt;/p&gt;
&lt;h3&gt;DateTime &amp;amp; RTC&lt;/h3&gt;
&lt;p&gt;Some tables always come up with the wrong date, I assume the rtc is on the battery that isn&#39;t installed.
&lt;code&gt;ntp.conf&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# add this to the top, it means don&#39;t panic on large offsets
tinker panic 0
server 192.168.x.x iburst
# edit this, it will let us listen to a single server
tos minclock 1 minsane 1
# if you can&#39;t talk to internet, comment out the pools
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Disable services&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;ModemManager&lt;/li&gt;
&lt;li&gt;cups&lt;/li&gt;
&lt;li&gt;cups-browserd&lt;/li&gt;
&lt;/ul&gt;
</content>
    </entry>
    
    <entry>
        <title>Physical Power and Relay Buttons for Octoprint</title>
        <link href="https://technicallycompetent.com/blog/octoprint-physical-buttons/"/>
        <updated>2021-12-25T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/octoprint-physical-buttons/</id>
        <content type="html">&lt;p&gt;I run octoprint on a pi.
I have octoprint controlling a relay for the printer, and I wanted a physical
button on the printer to make octoprint toggle it.&lt;/p&gt;
&lt;p&gt;Turns out a pi can also have a functional power button to turn it on and off these days too.&lt;/p&gt;
&lt;p&gt;For the power button, you can use GPIO3 as a
&lt;a href=&quot;https://raspberrypi.stackexchange.com/a/77918&quot;&gt;shutdown button&lt;/a&gt;,
and also to &lt;a href=&quot;https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#WAKE_ON_GPIO&quot;&gt;turn it back on&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It&#39;s still powering the power rails and isn&#39;t fully off, but that&#39;s fine by me.&lt;/p&gt;
&lt;p&gt;So I added&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;a momentary switch that is read via octoprint deal with the power relay, also managed by octoprint.&lt;/li&gt;
&lt;li&gt;an RGB momentary switch to turn the pi on/off and show the state of the pi (turning on, running, shutting down)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;pi GPIO:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;gpio 3: toggle pi power via config.txt magics in the links above&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;gpio 17: blue power switch led (pi booting, and when the pi is off it&#39;s very dimly blue)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;gpio 27: green power switch led (pi running)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;gpio 22: red power switch led (pi turning off)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;gpio 4: printer power relay&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;This is after the switch on the UM2, I cut the trace on the bottom after SW1 and put the relay between SW1 and J14+&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;gpio 24: 3V3 from printer to sense if relay is on&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;ultimaker 2 control board TP37(3V3) TP39(GND)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;gpio 18: toggle relay button&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;octoprint physical button addon + curl + psu control addon&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;octoprint setup:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;PSU control plugin
&lt;ul&gt;
&lt;li&gt;control relay, sense relay&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;physical button addon
&lt;ul&gt;
&lt;li&gt;toggle relay with system task that runs
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;curl -s -H &amp;quot;Content-Type: application/json&amp;quot; -H &amp;quot;X-Api-Key: $apikey&amp;quot; -X POST -d &#39;{ &amp;quot;command&amp;quot;:&amp;quot;togglePSU&amp;quot; }&#39; http://localhost/api/plugin/psucontrol&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;I tried the python octoprint api but it was &lt;em&gt;super&lt;/em&gt; slow&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;config files&lt;/h2&gt;
&lt;p&gt;Turn the blue LED on at boot with config.txt and use systemd units to update the LED to running and poweroff&lt;/p&gt;
&lt;p&gt;&lt;code&gt;config.txt&lt;/code&gt; added to bottom:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;dtoverlay=gpio-shutdown
gpio=17=op,dh
gpio=27=op,dl
gpio=22=op,dl
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;/etc/systemd/system/led-startup.service&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[Unit]
Description=set LEDs to booted state
Wants=network-online.target
After=network-online.target

[Service]
Type=oneshot
ExecStart=/bin/bash -c &#39;[ ! -d /sys/class/gpio/gpio17 ] &amp;amp;&amp;amp; echo &amp;quot;17&amp;quot; &amp;gt; /sys/class/gpio/export; echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/gpio/gpio17/value&#39;
ExecStart=/bin/bash -c &#39;[ ! -d /sys/class/gpio/gpio27 ] &amp;amp;&amp;amp; echo &amp;quot;27&amp;quot; &amp;gt; /sys/class/gpio/export; echo &amp;quot;0&amp;quot; &amp;gt; /sys/class/gpio/gpio27/value&#39;
RemainAfterExit=true

[Install]
WantedBy=multi-user.target
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;/etc/systemd/system/led-shutdown.service&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[Unit]
Description=shutdown LED stuff
DefaultDependencies=no
Before=shutdown.target

[Service]
Type=oneshot
ExecStart=/bin/bash -c &#39;[ ! -d /sys/class/gpio/gpio27 ] &amp;amp;&amp;amp; echo &amp;quot;27&amp;quot; &amp;gt; /sys/class/gpio/export; echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/gpio/gpio27/value&#39;
ExecStart=/bin/bash -c &#39;[ ! -d /sys/class/gpio/gpio22 ] &amp;amp;&amp;amp; echo &amp;quot;22&amp;quot; &amp;gt; /sys/class/gpio/export; echo &amp;quot;0&amp;quot; &amp;gt; /sys/class/gpio/gpio22/value&#39;
TimeoutStartSec=0

[Install]
WantedBy=shutdown.target
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;pi4 pinout&lt;/h2&gt;
&lt;p&gt;I also made a diagram for the pi4:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;                             RPi 4
                             ┌───┐
                    +3V3   1 │○ ○│ 2   +5V
             (SDA) GPIO2   3 │○ ○│ 4   +5V
             (SCL) GPIO3   5 │○ ○│ 6   GND
                   GPIO4   7 │○ ○│ 8   GPIO14 (UART TXD)
                     GND   9 │○ ○│ 10  GPIO15 (UART RXD)
       (SPI1_CE1) GPIO17  11 │○ ○│ 12  GPIO18 (SPI1_CE0)    [PWM]
                  GPIO27  13 │○ ○│ 14  GND
                  GPIO22  15 │○ ○│ 16  GPIO23
                    +3V3  17 │○ ○│ 18  GPIO24
      (SPI0_MOSI) GPIO10  19 │○ ○│ 20  GND
      (SPI0_MISO) GPIO9   21 │○ ○│ 22  GPIO25
      (SPI0_SCLK) GPIO11  23 │○ ○│ 24  GPIO8  (SPI0_CE0)
                     GND  25 │○ ○│ 26  GPIO7  (SPI0_CE1)
   {Reserved EEPROM_SDA}  27 │○ ○│ 28  GPIO1  {Reserved EEPROM_SCL}
                  GPIO5   29 │○ ○│ 30  GND
                  GPIO6   31 │○ ○│ 32  GPIO12
[PWM]             GPIO13  33 │○ ○│ 34  GND
[PWM] (SPI1_MISO) GPIO19  35 │○ ○│ 36  GPIO16 (SPI1_CSO)
                  GPIO26  37 │○ ○│ 38  GPIO20 (SPI1_MOSI)
                     GND  39 │○ ○│ 40  GPIO21 (SPI1_SCLK)
                             └───┘
&lt;/code&gt;&lt;/pre&gt;
</content>
    </entry>
    
    <entry>
        <title>Exporting Amazon Data when order export doesn&#39;t work</title>
        <link href="https://technicallycompetent.com/blog/amazon-order-export/"/>
        <updated>2021-12-19T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/amazon-order-export/</id>
        <content type="html">&lt;p&gt;A friend needed amazon order data for tax reasons.
The order export didn&#39;t work.&lt;/p&gt;
&lt;p&gt;On each page of the order history I ran this&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;orderList = []; document.getElementsByClassName(&amp;quot;a-box-group a-spacing-base order js-order-card&amp;quot;).forEach((order) =&amp;gt; { orderList.push({ date: order.getElementsByClassName(&amp;quot;a-color-secondary value&amp;quot;)[0].innerText, price: order.getElementsByClassName(&amp;quot;a-color-secondary value&amp;quot;)[1].innerText, name: order.getElementsByClassName(&amp;quot;a-link-normal&amp;quot;)[3].innerText }); }); console.log(JSON.stringify(orderList));
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and copied the output to a file.&lt;/p&gt;
&lt;p&gt;I edited the file to be a single array, and got a csv with&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;jq -r &#39; map([.date, .price, .name] | join(&amp;quot;, &amp;quot;)) | join(&amp;quot;&#92;n&amp;quot;)&#39; amazon-2020.json  &amp;gt; amazon-2020.csv
&lt;/code&gt;&lt;/pre&gt;
</content>
    </entry>
    
    <entry>
        <title>Making afwall not fail captive portal check on android 11</title>
        <link href="https://technicallycompetent.com/blog/afwall-captive-portal-android-11/"/>
        <updated>2021-12-02T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/afwall-captive-portal-android-11/</id>
        <content type="html">&lt;p&gt;I use &lt;a href=&quot;https://github.com/ukanth/afwall&quot;&gt;afwall&lt;/a&gt; to prevent most things from having internet.&lt;/p&gt;
&lt;p&gt;I had a lot of trouble getting wifi to work with afwall enabled in android 11.&lt;/p&gt;
&lt;p&gt;I&#39;m running a samsung A52 5G chinese version with android 11.&lt;/p&gt;
&lt;p&gt;The issue is that the captive portal detection decides that there isn&#39;t internet, and that I should get fucked.&lt;/p&gt;
&lt;p&gt;There is a lot of stuff saying that the way to disable captive portal detection is&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;settings put global captive_portal_detection_enabled 0
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Those are all for older android, so I checked the
&lt;a href=&quot;https://android.googlesource.com/platform/frameworks/base/+/refs/heads/android11-mainline-release/core/java/android/provider/Settings.java#11003&quot;&gt;relevant part of the android 11 source&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;That says &lt;code&gt;captive_portal_detection_enabled&lt;/code&gt; is deprecated, use &lt;code&gt;captive_portal_mode_ignore&lt;/code&gt; instead.&lt;/p&gt;
&lt;p&gt;I tried each one individually, and both together&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ settings list global | grep captive
captive_portal_detection_enabled=0
captive_portal_mode_ignore=0
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;after a reboot, it still says no internet and &lt;code&gt;adb logcat | grep connectivity&lt;/code&gt; shows&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;12-02 14:25:14.146  2558 14335 D NetworkMonitor/602: PROBE_DNS connectivitycheck.gstatic.com 18ms OK 142.250.190.67
12-02 14:25:24.165  2558 14335 D NetworkMonitor/602: PROBE_HTTP http://connectivitycheck.gstatic.com/generate_204 Probe failed with exception java.net.SocketTimeoutException: failed to connect to connectivitycheck.gstatic.com/142.250.190.67 (port 80) from /192.168.1.136 (port 38978) after 100
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;App 2559 is &amp;quot;Setup Wizard&amp;quot; in afwall for me, and allowing that wifi means the
captive portal at least can figure out there is internet.&lt;/p&gt;
&lt;p&gt;I really don&#39;t like that I can&#39;t disable the connectivity check because I would
like my phone to allow me access to a network I told it to connect to regardless
of what it thinks about google being accessable.&lt;/p&gt;
&lt;p&gt;But whatever, at least it gives me internet now.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;UPDATE 2021-12-08: it didn&#39;t quite work all the time.
It&#39;s now working and this is now the list of things I think are relevant:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;1000 Filter Provider, bunch of other stuff&lt;/li&gt;
&lt;li&gt;10177 CaptivePortalLogin&lt;/li&gt;
&lt;li&gt;5023 NetworkDiagnostic&lt;/li&gt;
&lt;li&gt;10255 Setup Wizard (shows up in a search for 2559, but displays as 10255 now?)&lt;/li&gt;
&lt;/ul&gt;
</content>
    </entry>
    
    <entry>
        <title>Setting up email on a Unifi controller</title>
        <link href="https://technicallycompetent.com/blog/unifi-email-setup/"/>
        <updated>2021-11-18T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/unifi-email-setup/</id>
        <content type="html">&lt;p&gt;It&#39;s harder than expected&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;setup SMTP server in controller -&amp;gt; Mail Server, get a test email working and all that&lt;/li&gt;
&lt;li&gt;enable emails in the site settings&lt;/li&gt;
&lt;li&gt;enable emails in the admin user settings&lt;/li&gt;
&lt;li&gt;enable the new UI in User Interface&lt;/li&gt;
&lt;li&gt;find the alerts stuff (System Settings -&amp;gt; Alerts)&lt;/li&gt;
&lt;li&gt;enable alerts&lt;/li&gt;
&lt;li&gt;then enable the alerts you want&lt;/li&gt;
&lt;li&gt;disable the new UI to have a functional interface&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I think I&#39;m going to look more into the TP-Link Omada stuff.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>Notes on RTKLIB and uBlox C94-M8P</title>
        <link href="https://technicallycompetent.com/blog/rtk-notes/"/>
        <updated>2021-09-23T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/rtk-notes/</id>
        <content type="html">&lt;p&gt;Notes on how far I got trying to use RTKLIB and the uBlox C94-M8P.&lt;/p&gt;
&lt;p&gt;I got a realtime RTKNAVI solution that switched between fixed and floating.&lt;/p&gt;
&lt;p&gt;Most of this is based on blog/website posts from Tim Everett at &lt;a href=&quot;https://rtklibexplorer.wordpress.com/&quot;&gt;rtklibexplorer&lt;/a&gt;.
He has been maintaining a fork of RTKLIB&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;This is the demo5 version of the RTKLIB code customized for improved performance with low-cost single frequency and dual frequency receivers&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;General Configuration&lt;/h2&gt;
&lt;p&gt;To do RTK we need some messages from the ublox.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;RXM-SFRBX   0x02 0x13
RXM-RAWX    0x02 0x15
NAV-SVINFO  0x01 0x30
NAV-CLOCK   0x01 0x22
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Sources:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;OpenStreetMap Wiki page on &lt;a href=&quot;https://wiki.openstreetmap.org/wiki/U-blox_raw_format#U-BLOX-M8&quot;&gt;U-blox raw format&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;rtklibexplorer &lt;a href=&quot;https://rtklibexplorer.wordpress.com/2016/02/03/collecting-raw-gps-data-with-rtklib/&quot;&gt;Collecting raw Ublox data with RTKLIB&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Can either enable these in ucenter and save, or do it in the RTKLIB serial input config&lt;/p&gt;
&lt;p&gt;For RTKLIB serial input config, these are the startup commands&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;These are decimal, &lt;em&gt;NOT&lt;/em&gt; hex&lt;/li&gt;
&lt;li&gt;arguments to UBX-CFG-MSG are
&lt;ul&gt;
&lt;li&gt;class&lt;/li&gt;
&lt;li&gt;id&lt;/li&gt;
&lt;li&gt;port rates (1=once/solution, 2=once every other solution, etc)
&lt;ul&gt;
&lt;li&gt;i2c rate&lt;/li&gt;
&lt;li&gt;uart1 rate&lt;/li&gt;
&lt;li&gt;reserved rate&lt;/li&gt;
&lt;li&gt;usb rate&lt;/li&gt;
&lt;li&gt;spi rate&lt;/li&gt;
&lt;li&gt;reserved rate&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code&gt;!UBX CFG-MSG 2 19 0 0 0 1 0 0
!UBX CFG-MSG 2 21 0 0 0 1 0 0
!UBX CFG-MSG 1 34 0 0 0 1 0 0
!UBX CFG-MSG 1 48 0 0 0 1 0 0
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Realtime RTK solutions&lt;/h2&gt;
&lt;p&gt;RTKNAVI is the real time rtk thing.&lt;/p&gt;
&lt;p&gt;Setup the C94-M8P as serial rover input with above config&lt;/p&gt;
&lt;p&gt;Get CORS RTCM3 input&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Sign up for a CORS thing like &lt;a href=&quot;https://mdotcors.michigan.gov&quot;&gt;mdotcors.michigan.gov&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Setup NTRIP client
&lt;ul&gt;
&lt;li&gt;put in host/port (&lt;code&gt;148.149.0.87:10000&lt;/code&gt;), user/pass.&lt;/li&gt;
&lt;li&gt;press Get Mountp&lt;/li&gt;
&lt;li&gt;Select a mountpoint (&lt;code&gt;NETWORK_SOLUTION_RTCM3-GG&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;setup output file&lt;/li&gt;
&lt;li&gt;start it and check output file for errors&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Take guesses at what the config should be based on rtklibexplorer
&lt;a href=&quot;https://rtklibexplorer.wordpress.com/2018/11/27/updated-guide-to-the-rtklib-configuration-file/&quot;&gt;Updated guide to the RTKLIB configuration file&lt;/a&gt;
and
&lt;a href=&quot;https://rtklibexplorer.wordpress.com/2020/02/05/rtklib-tips-for-using-a-cors-station-as-base/&quot;&gt;RTKLIB: Tips for using a CORS station as base&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/rtk-notes/Setting1.png&quot; alt=&quot;settings page&quot;&gt;
&lt;img src=&quot;/assets/pages/rtk-notes/Setting2.png&quot; alt=&quot;settings page&quot;&gt;
&lt;img src=&quot;/assets/pages/rtk-notes/Positions.png&quot; alt=&quot;settings page&quot;&gt;&lt;/p&gt;
&lt;p&gt;Note that in positions you need to set the base station location or it will silently do nothing.&lt;/p&gt;
&lt;p&gt;Also somehow you have to tell the CORS NTRIP caster where you are so it can give
you the closest, but I can&#39;t figure out how to do that anymore.&lt;/p&gt;
&lt;p&gt;Anyway, this config did get me a solution that was sometimes fixed, usually floating.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>Android Bind Mounts</title>
        <link href="https://technicallycompetent.com/blog/android-bind-mounts/"/>
        <updated>2021-08-03T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/android-bind-mounts/</id>
        <content type="html">&lt;p&gt;I require symlinks in the user portion of my android storage.
Turns out it&#39;s a lot more complex than that.&lt;/p&gt;
&lt;p&gt;Current phone has internal storage only (also known as a mistake),
so this might be a bit simplified.&lt;/p&gt;
&lt;p&gt;Actual user storage files are on an ext4 partition at &lt;code&gt;/data/media/0&lt;/code&gt;
It&#39;s emulation mounted to other places, and eventually put at places like
&lt;code&gt;/storage/self&lt;/code&gt; and &lt;code&gt;/sdcard&lt;/code&gt; with a bunch of per-user/per-app sandboxing.
Actual explanation &lt;a href=&quot;https://android.stackexchange.com/a/205494/36709&quot;&gt;on stack overflow&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Symlinks in /data/media/0 work there, but in the sdcardfs bind mounts that are
pretending to be a fat filesystem, they just show up as files.&lt;/p&gt;
&lt;p&gt;Bind mounts work though.&lt;/p&gt;
&lt;p&gt;So to make one directory show up in another place, what I ended up with was&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;mount --bind /data/media/0/DCIM/Camera/office_lens/ /data/media/0/Pictures/Office&#92; Lens
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Turns out that only works in adb shell because that&#39;s in the global mount namespace.&lt;/p&gt;
&lt;p&gt;Luckily, reddit user
&lt;a href=&quot;https://www.reddit.com/r/tasker/comments/k3br7d/mount_command_doesnt_work_on_tasker_and_android/ge259fe&quot;&gt;agnostic-apollo mentions&lt;/a&gt;
that &lt;code&gt;su --mount-master&lt;/code&gt; will drop us into the global mount namespace as well.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;su --mount-master -c &amp;quot;mount --bind /data/media/0/DCIM/Camera/office_lens/ &#39;/data/media/0/Pictures/Office Lens&#39;&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To bind this on boot, I tried putting it in &lt;code&gt;/data/adb/service.d/bind-mounts.sh&lt;/code&gt;
&lt;a href=&quot;https://github.com/topjohnwu/Magisk/blob/master/docs/guides.md#boot-scripts&quot;&gt;according to magisk docs&lt;/a&gt;.
Unforunately, &lt;code&gt;/data/media/0&lt;/code&gt; doesn&#39;t seem to be mounted at the point that runs.&lt;/p&gt;
&lt;p&gt;The end solution was a tasker shell task, running as root.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>Android ADB Key Management</title>
        <link href="https://technicallycompetent.com/blog/android-adb-keys/"/>
        <updated>2021-08-02T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/android-adb-keys/</id>
        <content type="html">&lt;p&gt;Making a phone trust a jenkins docker container is annoying but doable.&lt;/p&gt;
&lt;p&gt;ADB uses keys to authorize specific computers to each phone, to prevent malicious computers from doing stuff when you just plug a phone in.&lt;/p&gt;
&lt;p&gt;At $work we run a jenkins build node that has a phone plugged in to run &lt;code&gt;./gradlew conectedCheck&lt;/code&gt; to run the instrumented tests that can&#39;t be done without a phone or an emulator.
We put the entire android studio install in a container, because I&#39;ve had problems that required deleting the entire android studio before, and I don&#39;t want to manage that on a build node.
Because a new container gets stood up for each build, and each container generates a new adb key, the phone will ask if you trust thhis new computer.&lt;/p&gt;
&lt;p&gt;ADB stores it&#39;s key at &lt;code&gt;$HOME/.android/adbkey(.pub)&lt;/code&gt;, and will generate the key if it don&#39;t exist.&lt;/p&gt;
&lt;p&gt;According to
&lt;a href=&quot;https://android.googlesource.com/platform/system/core/+/d5fcafaf41f8ec90986c813f75ec78402096af2d&quot;&gt;the commit that added adb keys&lt;/a&gt;
adb can be told to use specific keys with &lt;code&gt;ADB_KEYS_PATH&lt;/code&gt;, but that doesn&#39;t seem to work.&lt;/p&gt;
&lt;p&gt;What does work is putting the path to the private key in &lt;code&gt;ADB_VENDOR_KEYS&lt;/code&gt;.
The intent of &lt;code&gt;ADB_VENDOR_KEYS&lt;/code&gt; &lt;a href=&quot;https://source.android.com/setup/develop/new-device#ANDROID_VENDOR_KEYS&quot;&gt;differs slightly from our use&lt;/a&gt;, but it works.&lt;/p&gt;
&lt;h2&gt;Install a key to a phone&lt;/h2&gt;
&lt;h3&gt;Option number A: set $HOME weird and just use adb&lt;/h3&gt;
&lt;p&gt;This is the approach I&#39;ve used.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;adb kill-server
mkdir /tmp/adbhome
HOME=/tmp/adbhome adb devices
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;approve on phone, and your key is at /tmp/adbhome/.android/adbkey(.pub)&lt;/p&gt;
&lt;h3&gt;Option number B: write into &lt;code&gt;/data/misc/adb/adb_keys&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Untested by me, but reportedly works and matches the above commit message.&lt;/p&gt;
&lt;p&gt;Requires root.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;adb push $publicKey /data/misc/adb/adb_keys
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Jenkins&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Lockable resource (manage -&amp;gt; system configuration -&amp;gt; Lockable Resources Manager) for each phone, with label &amp;quot;android-device&amp;quot;&lt;/li&gt;
&lt;li&gt;Secret file named $resourceName-adbkey containing the adb private key.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;How I use it in a jenkinsfile
This doesn&#39;t do anything for making sure it uses the correct phone if there are multiple, or that if there are phones on multiple build nodes it gets the correct one.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;//android phones are lockable resources.
//each phone has an associated credential, that is an ADB key that it&#39;s accepted already
lock(resource: null, label: &#39;android-device&#39;, variable: &#39;LOCKED_RESOURCE&#39;, quantity: 1) {
    withCredentials([file(credentialsId: &amp;quot;${env.LOCKED_RESOURCE}-adbkey&amp;quot;, variable: &#39;ADBKEY&#39;)]) {
        sh &#39;&#39;&#39;
            export ADB_VENDOR_KEYS=&amp;quot;$ADBKEY&amp;quot;

            # start adb server with group plugdev
            # docker doesn&#39;t load groups from /etc/groups when using &#39;exec -u&#39;
            sg plugdev &amp;quot;adb start-server&amp;quot;

            if ! adb devices -l | grep &amp;quot;device usb&amp;quot; ; then
                # can&#39;t talk to device
                if adb devices | grep &amp;quot;unauthorized&amp;quot; ; then
                    echo &amp;quot;phone connected but build slave unauthorized&amp;quot;
                    return 1
                fi
                echo &amp;quot;no phone connected?&amp;quot;
                return 2
            fi

            # We have to uninstall all company packages to prevent
            # &amp;quot;Package signatures do not match the previously installed version&amp;quot;
            adb shell &#39;pm list packages -f&#39;  | grep $companyName | sed &#39;s/.*base.apk=//&#39; | xargs -I% adb uninstall % || true

            ./gradlew connectedCheck
            &#39;&#39;&#39;
        //tests archived below
    }
}

&lt;/code&gt;&lt;/pre&gt;
</content>
    </entry>
    
    <entry>
        <title>Pulseaudio Output to Arbitrary List of Sinks</title>
        <link href="https://technicallycompetent.com/blog/pulseaudio-combine-arbitrary-sinks/"/>
        <updated>2021-06-28T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/pulseaudio-combine-arbitrary-sinks/</id>
        <content type="html">&lt;p&gt;I have a headset that has two output devices, a stereo and a mono, with a fade pot to go between them.
This means I want voice programs to go to mono, and everything else to go to stereo.&lt;/p&gt;
&lt;p&gt;I also have some speakers, and I would like to output to them at the same time.&lt;/p&gt;
&lt;p&gt;The internet has a lot of suggestions, most of which boil down to
&amp;quot;use use paprefs to output to every sink at once and make a device description
wider than the entire monitor&amp;quot;&lt;/p&gt;
&lt;p&gt;By actually reading the docs, I figured out that the &lt;code&gt;module-combine-sink&lt;/code&gt; can take a list of sinks to output to as an argument.&lt;/p&gt;
&lt;p&gt;So what I have is&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;cp /etc/pulse/default.pa ~/.config/pulse&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;list sinks with &lt;code&gt;pactl list short sinks&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;pactl list short sinks | grep -v &amp;quot;SteelSeries.*mono&amp;quot; | awk &#39;{ print $2}&#39; | sed -z &#39;s/&#92;n/,/g;s/.$/&#92;n/&#39;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;try &lt;code&gt;pactl load-module module-combine-sink sink_name=combined slaves=$sink_list sink_properties=device.description=whatever&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Once that works, put it in &lt;code&gt;~/.config/pulse&lt;/code&gt;, restart pulseaudio.&lt;/li&gt;
&lt;/ol&gt;
&lt;pre&gt;&lt;code&gt;load-module module-combine-sink sink_name=combined slaves=alsa_output.pci-0000_01_00.1.hdmi-stereo-extra3,alsa_output.usb-SteelSeries_SteelSeries_Arctis_7-00.analog-stereo,alsa_output.pci-0000_00_1f.3.analog-stereo,alsa_output.pci-0000_00_1f.3.iec958-stereo sink_properties=device.description=combined-without-headphone-mono
set-default-sink combined
&lt;/code&gt;&lt;/pre&gt;
&lt;hr&gt;
&lt;p&gt;Make sure that if you have to do stuff like setup which HDMI output you use for stuff like a VR hat that that is done first.&lt;/p&gt;
&lt;p&gt;Get card Name and Active Profile from
&lt;code&gt;pactl list cards&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;set-card-profile alsa_card.pci-0000_01_00.1 output:hdmi-stereo-extra3
&lt;/code&gt;&lt;/pre&gt;
&lt;hr&gt;
&lt;p&gt;2023 update: Debian Bullseye moved from pulseaudio to pipewire.&lt;/p&gt;
&lt;p&gt;According to SE, the way to do combined sinks and such things is
&lt;a href=&quot;https://askubuntu.com/a/1417370&quot;&gt;still via pulseaudio&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Unfortunately, if I do the set-card-profile there it fails.&lt;/p&gt;
&lt;p&gt;So what I did was
&lt;code&gt;~/.config/pipewire/pipewire.conf.d/overrides.conf&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;context.exec = [
    { path = &amp;quot;bash&amp;quot; args = &amp;quot;~/.config/pipewire/pipewire.conf.d/overrides.sh&amp;quot; }
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and then in &lt;code&gt;~/.config/pipewire/pipewire.conf.d/overrides.sh&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!/bin/bash

# sleep 1 not long enough
sleep 3
pactl set-card-profile alsa_card.pci-0000_01_00.1 output:hdmi-stereo-extra3
pactl load-module module-combine-sink sink_name=combined slaves=&amp;quot;$(pactl list short sinks | grep -v &amp;quot;SteelSeries.*mono&amp;quot; | awk &#39;{ print $2}&#39; | sed -z &#39;s/&#92;n/,/g;s/.$/&#92;n/&#39;)&amp;quot; sink_properties=device.description=combined-without-headphone-mono
pactl set-default-sink combined
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I feel bad, but it does work, so meh.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>Treatlife RGBW Bulbs</title>
        <link href="https://technicallycompetent.com/blog/treatlife-rgbw-bulbs/"/>
        <updated>2021-03-14T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/treatlife-rgbw-bulbs/</id>
        <content type="html">&lt;p&gt;I replaced the tuya w8bp with an ESP-12E.&lt;/p&gt;
&lt;p&gt;Treatlife doesn&#39;t really believe in model numbers, this is the listing I got: &lt;a href=&quot;https://smile.amazon.com/gp/product/B083BRRZ4Y/&quot;&gt;https://smile.amazon.com/gp/product/B083BRRZ4Y/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It has a tuya module inside that I cannot put tasmota on.
I don&#39;t appreciate this.&lt;/p&gt;
&lt;p&gt;Prior Art: &lt;a href=&quot;https://www.digiblur.com/2021/02/treatlife-sl10-rgb-ccw-esp-transplant.html&quot;&gt;boilerboy165 on digiblur&lt;/a&gt; did this on a similar treatlife product, but it wasn&#39;t RGBW and I had to have some pullups/pulldowns on the ESP12E, so this writeup is quite similar.&lt;/p&gt;
&lt;h2&gt;Process&lt;/h2&gt;
&lt;h3&gt;Dissassembly&lt;/h3&gt;
&lt;p&gt;The disassembly is covered pretty well in the post I linked, and that post has pictures for this.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Run a flexible pry tool around the bulb base to seperate the bulb from the body.&lt;/li&gt;
&lt;li&gt;Pry the hot contact off the bottom and dislodge the wire.&lt;/li&gt;
&lt;li&gt;Pry the LED ring upwards, including the metalic thing it&#39;s attached to.&lt;/li&gt;
&lt;li&gt;Wiggle and pull on the board to remove it, the neutral wire may be affixed in pretty good, try pushing down on it to dislodge.
I did tear one out doing this.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;Remove tuya bullshit&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Hot air gun to remove the tuya module.&lt;/li&gt;
&lt;li&gt;Snip the little bridge&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/treatlife-rgbw-bulbs/treatlife-board-layout.jpg&quot; alt=&quot;pinout for treatlife thing&quot;&gt;&lt;/p&gt;
&lt;h3&gt;Put the ESP-12E in&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Program it with tasmota&lt;/li&gt;
&lt;li&gt;Solder GPIO to the RGBW pins with jumpers as necessary&lt;/li&gt;
&lt;li&gt;Connect enable to 3V3&lt;/li&gt;
&lt;li&gt;Pullups on GPIO0 and GPIO2&lt;/li&gt;
&lt;li&gt;Pulldown on GPIO15&lt;/li&gt;
&lt;/ol&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Treatlife Pin&lt;/th&gt;
&lt;th&gt;ESP pin&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;R&lt;/td&gt;
&lt;td&gt;GPIO13&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;G&lt;/td&gt;
&lt;td&gt;GPIO12&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;B&lt;/td&gt;
&lt;td&gt;GPIO16&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;W&lt;/td&gt;
&lt;td&gt;GPIO14&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;TODO: verify table&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/treatlife-rgbw-bulbs/finished-top.jpg&quot; alt=&quot;such wire management&quot;&gt;
&lt;img src=&quot;/assets/pages/treatlife-rgbw-bulbs/finished-bottom.jpg&quot; alt=&quot;not shorting, probably&quot;&gt;&lt;/p&gt;
&lt;h3&gt;Tasmota&lt;/h3&gt;
&lt;p&gt;The tasmota colour picker has issues and doesn&#39;t really like RGBW.
&lt;code&gt;SetOption105 1&lt;/code&gt; &lt;a href=&quot;https://tasmota.github.io/docs/Lights/#white-blend-mode&quot;&gt;claims to help with this&lt;/a&gt; but I remain unconvinced.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;template {&amp;quot;NAME&amp;quot;:&amp;quot;treatlife rgbw&amp;quot;,&amp;quot;GPIO&amp;quot;:[0,0,0,0,0,0,0,0,38,37,40,0,39],&amp;quot;FLAG&amp;quot;:0,&amp;quot;BASE&amp;quot;:18}
module 0
poweronstate 1
SetOption105 1
color FFFFFFFF
RGBWWTable 150,255,255,255,255
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If I use the HSV sliders it turns off the white channel entirely.
With this RGBTable it turns down red so at color FFFFFFFF the light looks better,
but if you mess with the hsv sliders in the UI it turns off white and the colour is wonky again.&lt;/p&gt;
&lt;p&gt;I will update this post with details once I have a functioning tasmota config.
Plan to test out esphome with these as well.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>Comparing GNSS Antennas</title>
        <link href="https://technicallycompetent.com/blog/compare-gnss-antenna/"/>
        <updated>2021-03-12T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/compare-gnss-antenna/</id>
        <content type="html">&lt;p&gt;Steps to compare GNSS antennas.&lt;/p&gt;
&lt;p&gt;Basing this off the idea of comparing SNR proposed by &lt;a href=&quot;http://www.digikey.no/Web%20Export/Supplier%20Content/tallysman-1526/pdf/tallysman-comparing-gnss-antenna-performance.pdf&quot;&gt;Tallysman GNSS&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Log NMEA strings including G.GSV and G.RMC&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use the RMC times to make the start and stop the same for each file&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use &lt;a href=&quot;https://github.com/wolfgangr/perl-nmea&quot;&gt;wolfgangr/perl-nmea&lt;/a&gt; to plot the
SNR for different satellites and log statistical data about them.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Higher is better.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;To give some idea of values to be expected, 54dB is amazing, 53dB is excellent, 52dB is  good and  49/50dB  is  “ho-hum”.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I didn&#39;t see anything above 46, but it&#39;s probably fine.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;It also outputs some plots of SNR for a visual representation of the statistics.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>kicad 5.1.5 scripting</title>
        <link href="https://technicallycompetent.com/blog/kicad-5.1.5-scripting/"/>
        <updated>2020-10-13T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/kicad-5.1.5-scripting/</id>
        <content type="html">&lt;p&gt;Notes on scripting in kicad 5.1.5, updated 2020-10-14&lt;/p&gt;
&lt;p&gt;As development towards 6 continues, whatever I can get out of the debian repos gets less up to date.
The &lt;a href=&quot;https://docs.kicad-pcb.org/doxygen-python/index.html&quot;&gt;official docs&lt;/a&gt; are too new for me. and aren&#39;t useful.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://mirrors.cqu.edu.cn/kicad/doxygen-python/index.html&quot;&gt;These folks&lt;/a&gt; have a mirror that is close to correct, at least it has the
&lt;a href=&quot;https://mirrors.cqu.edu.cn/kicad/doxygen-python/classpcbnew_1_1TEXTE__PCB.html&quot;&gt;pcbnew.TEXTE_PCB Class Reference&lt;/a&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import pcbnew

board = pcbnew.GetBoard()

# modify text size of text starting with &amp;quot;P&amp;quot;:
for drw in board.GetDrawings():
    if (drw.GetShownText().startswith(&amp;quot;P&amp;quot;)):
        drw.SetThickness(150000)

for m in board.GetModules():
    if m.GetValue() == &amp;quot;2K2&amp;quot;:
        m.Reference().SetVisible(True)
        m.Reference().SetTextHeight(500000)
        m.Reference().SetTextWidth(500000)
        m.Reference().SetThickness(70000)
&lt;/code&gt;&lt;/pre&gt;
</content>
    </entry>
    
    <entry>
        <title>Joysticks in Linux with joydev and evdev</title>
        <link href="https://technicallycompetent.com/blog/joysticks-linux-joydev-evdev/"/>
        <updated>2020-09-05T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/joysticks-linux-joydev-evdev/</id>
        <content type="html">&lt;p&gt;Linux has two joystick modules, &lt;code&gt;joydev&lt;/code&gt; and &lt;code&gt;evdev&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Most joystick calibration tooling is for joydev, but that&#39;s deprecated.&lt;/p&gt;
&lt;h2&gt;Problem Statement&lt;/h2&gt;
&lt;p&gt;I would like to use a joystick in linux, and it needs to be calibrated.&lt;/p&gt;
&lt;p&gt;Apparently this means learning things.&lt;/p&gt;
&lt;h2&gt;evdev vs joydev overview&lt;/h2&gt;
&lt;p&gt;Linux has joydev(depricated) and evdev(used but harder to calibrate).&lt;/p&gt;
&lt;p&gt;See also: &lt;a href=&quot;https://www.reddit.com/r/linux_gaming/comments/5xics8/a_big_problem_with_joysticks_in_linux_right_now/&quot;&gt;a reddit post&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;joydev&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;/dev/input/js0
/dev/input/by-id/usb-SAITEK_CYBORG_3D_USB-joystick@ ⇒ ../js0
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;https://manpages.debian.org/trixie/joystick/jscal.1.en.html&quot;&gt;jscal&lt;/a&gt; which has &amp;quot;type,precision,coefficients,...&amp;quot;
(&lt;a href=&quot;https://web.archive.org/web/20240917222059/https://blog.gimx.fr/joystick-calibration-in-gnulinux/&quot;&gt;coefficients explainer by gimx&lt;/a&gt;)&lt;/p&gt;
&lt;h3&gt;evdev&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;/dev/input/event25
/dev/input/by-id/usb-SAITEK_CYBORG_3D_USB-event-joystick@ ⇒ ../event25
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;https://manpages.debian.org/trixie/joystick/evdev-joystick.1.en.html&quot;&gt;evdev-joystick&lt;/a&gt;, which has parameters for min/max/deadzone/fuzz&lt;/p&gt;
&lt;p&gt;But fun fact, evdev-joystick basically just does:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;fd = open(evdev, O_RDONLY)
abs_features.minimum = minvalue;
abs_features.maximum = maxvalue;
abs_features.flat = deadzonevalue;
abs_features.fuzz = fuzzvalue;
ioctl(fd, EVIOCSABS(axisindex), &amp;amp;abs_features)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But flat doesn&#39;t seem to do anything.&lt;/p&gt;
&lt;p&gt;Looking at some history, there &lt;a href=&quot;https://github.com/torvalds/linux/commit/d31b2865a4e8a9dd02f39e56c8fadb824c5e187b#diff-8770676ecb512b3a3f206b989cb6068bb1700e17e6e163e766fd7f095f0aec9bL1115&quot;&gt;used to be a comment&lt;/a&gt; on the flat field that it&#39;s only used by joydev, so that&#39;s cool.
I gave up.&lt;/p&gt;
&lt;p&gt;A bunch of posts on the internet are confused about what fuzz does, but it&#39;s just some smoothing.
See &lt;a href=&quot;https://github.com/torvalds/linux/blob/v6.17/drivers/input/input.c#L70-L84&quot;&gt;drivers/input/input.c&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Calibrating&lt;/h2&gt;
&lt;h3&gt;Calibrating for the &amp;quot;joydev&amp;quot; system&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://manpages.debian.org/stable/joystick/jscal.1.en.html&quot;&gt;jscal&lt;/a&gt;: show and change joystick cal&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://manpages.debian.org/stable/joystick/jstest.1.en.html&quot;&gt;jstest&lt;/a&gt;: show input&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://manpages.debian.org/stable/jstest-gtk/jstest-gtk.1.en.html&quot;&gt;jstest-gtk&lt;/a&gt;: show input and change cal gui&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;What I ended up doing was the automated cal in &lt;code&gt;jstest-gtk&lt;/code&gt;, and then manually editing the values till the deadzones worked out.&lt;/p&gt;
&lt;p&gt;Export the cal with &lt;code&gt;jcal -p &amp;lt;device-name&amp;gt;&lt;/code&gt;, it&#39;ll print out the jscal command to set the settings to how they are.&lt;/p&gt;
&lt;p&gt;Debian&#39;s &lt;code&gt;joystick&lt;/code&gt; package does some stuff with &lt;code&gt;/lib/udev/rules.d/60-joystick.rules&lt;/code&gt; and &lt;code&gt;jscal-store&lt;/code&gt;/&lt;code&gt;jscal-restore&lt;/code&gt; to automatically apply calibrations for joydev via udev.&lt;/p&gt;
&lt;h3&gt;Calibrating for the &amp;quot;evdev&amp;quot; system&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://manpages.debian.org/stable/joystick/evdev-joystick.1.en.html&quot;&gt;evdev-joystick&lt;/a&gt;: show and change cal&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://manpages.debian.org/stable/evtest/evtest.1.en.html&quot;&gt;evtest&lt;/a&gt;: show input, very raw&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/shumatech/evjs&quot;&gt;shumatech/evjs&lt;/a&gt;: nice ncurses ui, wants you to save values to sqlite and use udev to apply the config&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/Virusmater/evdev-joystick-calibration&quot;&gt;Virusmater/evdev-joystick-calibration&lt;/a&gt; autocal script with some autoload functionality, I got frustrated and rewrote this but haven&#39;t pushed it&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I used &lt;code&gt;evjstest&lt;/code&gt; to get the calibration values, but I didn&#39;t want to call it&#39;s sqlite to apply config via udev, so&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ evdev-joystick -s /dev/input/by-id/usb-SAITEK_CYBORG_3D_USB-event-joystick | tail -n+2 | sed &#39;s/  Absolute axis 0x.. (&#92;([0-9]&#92;+&#92;)) (&#92;([^)]&#92;+&#92;)).*min: &#92;([-0-9]&#92;+&#92;), max: &#92;([-0-9]&#92;+&#92;), flatness: &#92;([-0-9]&#92;+&#92;).*, fuzz: &#92;([-0-9]&#92;+&#92;))/evdev-joystick -e $joystickDev -a &#92;1 -m &#92;3 -M &#92;4 -f &#92;6/&#39;
evdev-joystick -e $joystickDev -a 0 -m 34 -M 163 -d 0 -f 0
evdev-joystick -e $joystickDev -a 1 -m 36 -M 161 -d 0 -f 0
evdev-joystick -e $joystickDev -a 5 -m 18 -M 147 -d 0 -f 1
evdev-joystick -e $joystickDev -a 6 -m 17 -M 174 -d 0 -f 1
evdev-joystick -e $joystickDev -a 16 -m -1 -M 1 -d 0 -f 0
evdev-joystick -e $joystickDev -a 17 -m -1 -M 1 -d 0 -f 0
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And then:&lt;code&gt;/etc/udev/rules.d/85-saitek-cyborg-3d-joystick-jscal.rules&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;SUBSYSTEM==&amp;quot;input&amp;quot;, ATTRS{idVendor}==&amp;quot;06a3&amp;quot;, ATTRS{idProduct}==&amp;quot;0006&amp;quot;, ATTRS{product}==&amp;quot;CYBORG 3D USB&amp;quot;, ACTION==&amp;quot;add&amp;quot;, RUN+=&amp;quot; /bin/bash -c &#39;joystickDev=/dev/input/by-id/usb-SAITEK_CYBORG_3D_USB-event-joystick; evdev-joystick -e $joystickDev -a 0 -m 34 -M 163 -d 0 -f 0; evdev-joystick -e $joystickDev -a 1 -m 36 -M 161 -d 0 -f 0; evdev-joystick -e $joystickDev -a 5 -m 18 -M 147 -d 0 -f 1; evdev-joystick -e $joystickDev -a 6 -m 17 -M 174 -d 0 -f 1; evdev-joystick -e $joystickDev -a 16 -m -1 -M 1 -d 0 -f 0; evdev-joystick -e $joystickDev -a 17 -m -1 -M 1 -d 0 -f 0; &#39;&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Testing the inputs in programs&lt;/h2&gt;
&lt;h3&gt;Testing SDL&lt;/h3&gt;
&lt;p&gt;SDL is a cross-platform library a lot of games use.
I have no idea if the game I care about uses it, but I thought it did for a while.&lt;/p&gt;
&lt;p&gt;To test how input looks to sdl, &lt;a href=&quot;https://github.com/Grumbel/sdl-jstest&quot;&gt;Grumbel/sdl-jstest&lt;/a&gt; works well.
It is important to run &lt;code&gt;git submodule init&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;One thing a bunch of places on the internet recommend is putting &lt;code&gt;SDL_JOYSTICK_DEVICE=/dev/input/js0&lt;/code&gt; into your environment somehow.
This worked with SDL 1, but not SDL2, you can see that by trying it with &lt;code&gt;sdl-jtest&lt;/code&gt; and &lt;code&gt;sdl2-jtest&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;Testing whatever windows gets via proton&lt;/h3&gt;
&lt;p&gt;To test whatever the windows inside wine gets, this works:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;protontricks -c &amp;quot;wine control&amp;quot; $APPID
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or maybe&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;WINEPREFIX=$STEAMLIBRARY/steamapps/compatdata/$APPID/pfx $STEAMLIBRARY/steamapps/common/Proton&#92; 5.0/dist/bin/wine64 control
&lt;/code&gt;&lt;/pre&gt;
&lt;hr&gt;
&lt;p&gt;UPDATE 2025-10-09&lt;/p&gt;
&lt;p&gt;got annoyed about deadzones not working&lt;/p&gt;
&lt;p&gt;Rewrote some of this post with better learning because I found my own post while searching for background on linux joysticks, so clearly the SEO is good.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>Defcon 28 EvilMog&#39;s Mud Writeup</title>
        <link href="https://technicallycompetent.com/blog/dc28-mud/"/>
        <updated>2020-08-09T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/dc28-mud/</id>
        <content type="html">&lt;p&gt;This was my first defcon, and I chose to spend it playing the MUD from &lt;a href=&quot;https://mog.ninja/&quot;&gt;EvilMog&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Here is my writeup.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/dc28-mud/motd.png&quot; alt=&quot;Mud MOTD&quot;&gt;&lt;/p&gt;
&lt;p&gt;I ended up using Mudlet and tintin++ as my mud clients.&lt;/p&gt;
&lt;p&gt;Mudlet is a GUI based thing, and does everything with LUA.
tintin++ is a command line client that lets me run arbitrary things.&lt;/p&gt;
&lt;p&gt;The extent of prior experience with text adventures is playing some of the hitchikers guide, and a tiny bit of zork but never getting very far in either, so I spent quite a while on the newbie quest, figuring out how to kill things and such.&lt;/p&gt;
&lt;h2&gt;Mapping&lt;/h2&gt;
&lt;p&gt;EvilMog was nice enough to have packaged a modified version of &lt;a href=&quot;https://wiki.mudlet.org/w/IRE_mapping_script&quot;&gt;a mudlet mapping script&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/dc28-mud/sewer-1.png&quot; alt=&quot;Top Sewer Level&quot;&gt;&lt;/p&gt;
&lt;p&gt;You had to be careful to help it with areas, because not all steps are equal sizes (especially when using the city transport system) and if you don&#39;t split things up everything will be on top of itself.
But overall the mapping worked really well, and made this doable at all for me.
You could also double click on a point to just navigate there, which really helped with the 5 layers of sewer and labyrinth.&lt;/p&gt;
&lt;h2&gt;Crypto Mining Challenge&lt;/h2&gt;
&lt;p&gt;I think one of the things I spent the longest on was trying to solve the mining challenge.
When you type &lt;code&gt;crypto&lt;/code&gt;, it gives you a prompt like&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Solve: 37 * 607 / 127 - 916 * 213 / [blank] = -135
Represented in LPC as:
  total = (varA * varB / varC - varD * varE / varF);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and you must respond with &lt;code&gt;crypto 626&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;One of the flags was for solving this 1000 times, and it also gives you money and XP.&lt;/p&gt;
&lt;p&gt;I got all the fields split out by mudlet, and I just needed to process it.&lt;/p&gt;
&lt;h3&gt;Attempt A:&lt;/h3&gt;
&lt;p&gt;My first thought was just calling something like mathematica, but I didn&#39;t have it installed, and mudlet doesn&#39;t seem to let you exec stuff.
It does however, have &lt;code&gt;getHTTP&lt;/code&gt;, so I got the query working in wolfram alpha, looked up the API, and then found some API keys on pastebin.
Got it working with curl, life was good problem solved, right?&lt;/p&gt;
&lt;p&gt;No, &lt;code&gt;getHTTP&lt;/code&gt; is only in the next unreleased version of Mudlet, and after compiling that and trying it a bunch of the mapping scripts broke so I decided it wasn&#39;t worth it.&lt;/p&gt;
&lt;h3&gt;Attempt B:&lt;/h3&gt;
&lt;p&gt;At this point I spent a while trying to actually solve math in lua.&lt;/p&gt;
&lt;p&gt;I don&#39;t like lua it turns out.&lt;/p&gt;
&lt;p&gt;I was continuously saying &amp;quot;what do you mean $commonFunction isn&#39;t built in&amp;quot;, and then copying in a function like array length from the internet.&lt;/p&gt;
&lt;p&gt;I started out trying to find the blank, and then searching back and forward till I found plus or minus so I could just add everything past those to the other side, but string processing was going poorly in lua.&lt;/p&gt;
&lt;p&gt;A friend convinced me that converting it to RPN would make the problem easier, and I suspect that if I had ever done that before or lua was less terrible to work with this &lt;em&gt;might&lt;/em&gt; have worked.
As it was, it was late and I was tired by the time I started, and it was early and I was very tired by the time I gave up.
I had converted it to an RPN stack, and was trying to figure out how to only reduce operations I could reduce at the point I gave up.&lt;/p&gt;
&lt;p&gt;A different friend suggested turning the location of the blank and the priority of each operation into a state, and then doing a lookup table for the formula to apply to the variables, but I think it would have ended up at like 128 different options, and I didn&#39;t want to deal with that.&lt;/p&gt;
&lt;h3&gt;Attempt 3:&lt;/h3&gt;
&lt;p&gt;At this point I just gave up on mudlet, and used tintin++ because while it has less built in scripting, you can just run whatever you want.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!/bin/bash

# call this like &amp;quot;$0 &#39;37 * 607 / 127 - 916 * 213 / [blank] = -135&#39;&amp;quot;

#stuff to put in tintin++:
#alias {G} {#ticker {crypto} {crypto} {5}}
#alias {S} {#unticker crypto}
#action {^Solve: %1} {#script {res} {bash /tmp/crypto.sh &amp;quot;%1&amp;quot;}; #delay {1} {#show $res[1]; $res[1]}}

urlencode() {
  python -c &#39;import urllib, sys; print urllib.quote(sys.argv[1], sys.argv[2])&#39; &#92;
    &amp;quot;$1&amp;quot; &amp;quot;$urlencode_safe&amp;quot;
}

equation=$(echo &amp;quot;$1&amp;quot; | sed &#39;s/.blank./x/&#39;)
encoded=$(urlencode &amp;quot;$equation&amp;quot;)
apikey=&amp;quot;google: api.wolframalpha appid site:pastebin.com&amp;quot;
curl --silent &amp;quot;http://api.wolframalpha.com/v2/query?appid=$apikey&amp;amp;output=json&amp;amp;input=N[solve[$encoded%2C+x]]&amp;quot; --globoff | jq &#39;[.queryresult.pods[] | select(.title | contains(&amp;quot;Substitution&amp;quot;))] | .[-1] | .subpods[0].plaintext&#39; -r | sed s/&#39;^..//&#39; | awk &#39;{print int($1+0.5)}&#39; | sed &#39;s/^/crypto /&#39;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So I ran this overnight, and ended up with a lot of money and max level. This put me in a good place to try to solve the other things.&lt;/p&gt;
&lt;h2&gt;Quests&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;-----------------------------------------------------------------
| Active Quests                                                 |
-----------------------------------------------------------------
| Newbie       - North From Start
| Pottles      - Find Pottles in the Sewer
| Wizard       - Find the wizard potion in the dungeon deep below the sewer
| Sewer        - Find and slay the sewer monster
| Ticket       - Go to the advancement room and find the tokens
| Parrot       - Find the mean parrot in the sewer beneath the labyrinth
| Evil         - Find kendall and ask him about rats
| Woodland     - Kill all the creature types in woodland
-----------------------------------------------------------------
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A few of the quests were just find something and kill it or drink it, those happened in the course of other things.&lt;/p&gt;
&lt;p&gt;I did these all concurrently, just focusing on one for a while till I got super stuck.&lt;/p&gt;
&lt;h3&gt;Map Layout&lt;/h3&gt;
&lt;p&gt;I&#39;m only going to describe how it changed from the &lt;a href=&quot;https://labs.nettitude.com/blog/derbycon-2019-ctf-write-up/&quot;&gt;Nettitude Labs Derbycon 2019 writeup&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;At the start there is still the woodland to the north, and a small starting area.
Everything else is down, and it&#39;s a one way trip to the city.&lt;/p&gt;
&lt;p&gt;The sewers are accessed by going down in several places in the city, and the dungeons and labyrinths are beneath the sewers.
The grid style changed a few times, in the city and the sewers, it was XYZ with 0,0,0 being the center of the city.
The labyrinths and dungeons used letter and number mostly, but I didn&#39;t do too much navigation by references in them, so I didn&#39;t ever understand it well.&lt;/p&gt;
&lt;h4&gt;Teleportation&lt;/h4&gt;
&lt;p&gt;One useful tip: If you&#39;re not a fed, you can set your start room.
You can recall to your start room.
Start room format is stuff like&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;start_room=/domains/core/rooms/city/x40y-70z0.c&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;start_room=/domains/required/rooms/start.c&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;start_room=/domains/core/rooms/east/x300y-40z0.c&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Because it chagned based on area, I ended up turning on &lt;code&gt;save_on_quit&lt;/code&gt;, quitting and rejoining, disabling it, and then modifying it to the coordinates I wanted.&lt;/p&gt;
&lt;h3&gt;Sewer Quest&lt;/h3&gt;
&lt;p&gt;So to solve the sewer quest, first you must talk to Arnie.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Arnie says: The monster is in the steam generators but its blocked by a vent.&lt;/li&gt;
&lt;li&gt;Arnie says: The vent is blocked by steam.&lt;/li&gt;
&lt;li&gt;Arnie says: To disable the steam you need to find generator control.&lt;/li&gt;
&lt;li&gt;Arnie says: You need a secard to access generator control.&lt;/li&gt;
&lt;li&gt;Arnie says: You need a tracker to find the secard.&lt;/li&gt;
&lt;li&gt;Arnie says: To get the tracker you will have to pry it from my cold dead hands.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The tracker pointed to an empty space, so teleported in and got the card.&lt;/p&gt;
&lt;p&gt;After getting the card, I noticed that the hallway I exited into had the text &lt;code&gt;A large pipe juts out here to the west.&lt;/code&gt;
Having things that the mapper doesn&#39;t show as options means reading is important.
Or just adding highlights. Either way.&lt;/p&gt;
&lt;p&gt;Another cool thing about the IRE mapper is that you can set custom exits for rooms, so you can make it say &lt;code&gt;enter pipe&lt;/code&gt; to go to a room so it can do pathfinding through that.&lt;/p&gt;
&lt;p&gt;The next step of finding the generator control took forever, even with instructions that were a bit past hints from EvilMog.
Part of it was that I had mapped out some of the sewer into the wrong area, and I was trusting my map.&lt;/p&gt;
&lt;p&gt;So shockingly enough, below the hydro generators there is a weird basement, and a room that says &amp;quot;The western wall here looks a little bit artificial.&amp;quot;
Go through the wall, and magic, generator controls.
You use them to disable steam for 5 minutes.&lt;/p&gt;
&lt;p&gt;Searching my logs for &amp;quot;steam&amp;quot;, I found that Hydro Generator #5 has &amp;quot;An abnormal amount of steam appears to be rising from the floor.&amp;quot;
Go down from that, stab a baddie, receive flag.&lt;/p&gt;
&lt;h3&gt;Evil Quest&lt;/h3&gt;
&lt;p&gt;The first instructions is to &amp;quot;Find kendall and ask him about rats&amp;quot;
He tells us to go kill a rat queen in a bio lab in shay park.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/dc28-mud/bio-lab.png&quot; alt=&quot;Image from Nettitude Derbycon 2019 from EvilMog&quot;&gt;&lt;/p&gt;
&lt;p&gt;This was one of the places the Nettitude Labs writeup came in handy.
EvilMog shared a picture of a map, and they had it.&lt;/p&gt;
&lt;p&gt;After that, we have to&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;kill the queen rat&lt;/li&gt;
&lt;li&gt;talk to kendall&lt;/li&gt;
&lt;li&gt;talk to carson&lt;/li&gt;
&lt;li&gt;kill the Cyberslime&lt;/li&gt;
&lt;li&gt;talk to norman&lt;/li&gt;
&lt;li&gt;find norman&#39;s wallet&lt;/li&gt;
&lt;li&gt;break into a storage closet, &amp;quot;touch padd&amp;quot;&lt;/li&gt;
&lt;li&gt;access Grey&#39;s computer&lt;/li&gt;
&lt;li&gt;talk to Old Tom the miner&lt;/li&gt;
&lt;li&gt;touch padd&lt;/li&gt;
&lt;li&gt;talk to EvilMogs Agent&lt;/li&gt;
&lt;li&gt;stab johnson&lt;/li&gt;
&lt;li&gt;find the sandworm pits&lt;/li&gt;
&lt;li&gt;Decide if you support the church of wifi or prefer the sweet embrace of an airlock opening
&lt;ul&gt;
&lt;li&gt;You do this by typing &amp;quot;access $choice&amp;quot; at the touch padd, I spent way too long trying to figure out what the access code was or where to enter it.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Key Quest&lt;/h3&gt;
&lt;p&gt;This quest is to find eight buttons.
SweetJesus gave me the location of the first, and from that I could see the kinds of things to look for:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;EvilMog Park

This park just seems to go on and on, almost as if its cheap filler for some sort of demonic
quest thought up by overlord EvilMog. This area shows no originality and its probably just here to
mess with you. A shrub is somewhere in this chaos.

&amp;gt; look shrub
Underneath this shrub is a purple button.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I found seven of the eight buttons, the last one is &amp;quot;Key 1 - City&amp;quot;&lt;/p&gt;
&lt;h2&gt;CTF&lt;/h2&gt;
&lt;p&gt;So saturday afternoon I decided to try to figure out what to do with the flags I had been finding.
Turns out there is a leaderboard, and there are things like &amp;quot;find this specific snake in the sewer&amp;quot; that give points.
Also, you can get more points for doing everything again but as a fed (hardmode).&lt;/p&gt;
&lt;p&gt;I did this in spite of the Nettitude team doing the &lt;em&gt;exact same thing&lt;/em&gt; and talking about it in their writeup.
After this discovery I proceeded to have a surprise starfinder game I had agreed to a week ago, and lost quite a bit of time to that.&lt;/p&gt;
&lt;p&gt;I found most of the animals and finished most of the stuff sunday morning.
One annoying that that I&#39;m really glad EvilMog shared is&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[gossip] Evilmog: oh this is evil, the explore flags depend on the player who discovers that
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So I was wandering around with a low level fed, and any time I found something I would check the flag against my list, and if it was the hacker/human flag, I would have a high level character come kill it.
It took a while to get all the fed flags this way, because there was another hacker wandering around at the same time.&lt;/p&gt;
&lt;p&gt;The last flags I got were actually the intro quest, because I can&#39;t read signs and had to wait for someone to explain that you have to claim the quest to get the flag, not just get the &amp;quot;$person completed the quest&amp;quot; notification.
Feds can&#39;t use the start_room teleport trick, so I had to do the intro quest a fourth time sunday morning.&lt;/p&gt;
&lt;h2&gt;Things learned&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Make sure logging is enabled the entire time, to enable room text search&lt;/li&gt;
&lt;li&gt;Look at the actual place to submit flags at the start&lt;/li&gt;
&lt;li&gt;Commands are confusing and if I want to do this again I should probably play more muds&lt;/li&gt;
&lt;li&gt;Finding exits that require special commands is annoying&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Overall it was amazing fun, and a great first Defcon and first MUD thanks to &lt;a href=&quot;https://twitter.com/Evil_Mog&quot;&gt;EvilMog&lt;/a&gt;&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>HP 7475A Plotter over GPIB/HPIB/IEEE-488</title>
        <link href="https://technicallycompetent.com/blog/hp-7475A-plotter-gpib/"/>
        <updated>2020-06-22T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/hp-7475A-plotter-gpib/</id>
        <content type="html">&lt;p&gt;Just got an HP 7475A plotter working with a National Instruments PCI-GPIB 183617K-01.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://gist.github.com/mtfurlan/ae138eb730517ac946251124feaf9037&quot;&gt;Working code&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Plotter Manuals:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://ia803104.us.archive.org/23/items/HP7475AInterfacingandProgrammingManual/HP7475AInterfacingandProgrammingManual.pdf&quot;&gt;Interfacing and Programming Manual&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://pearl-hifi.com/06_Lit_Archive/15_Mfrs_Publications/20_HP_Agilent/HP_7475A_Plotter/HP_7475A_Op_Interconnect.pdf&quot;&gt;Operation &amp;amp; Interconnection Manual&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I used &lt;a href=&quot;https://linux-gpib.sourceforge.io/&quot;&gt;Linux GPIB&lt;/a&gt; to interface with the gpib card.
It is a kernel module and a userspace library.
The userspace library is natively C, but they provide bindings for other languages, like perl.&lt;/p&gt;
&lt;p&gt;Initially I had a bunch issues where it looked like it just forgot about the latter part of longer commands.
This was frustrating, because it worked fine if I copied each command into the interactive terminal example the Linux GPIB folks packaged.&lt;/p&gt;
&lt;p&gt;I figured maybe it was somehow a buffer issue, and went down a rabbit hole of trying to ask the plotter when it was done.
The thing that came closest to working is cool trick found via hackaday, &lt;a href=&quot;https://blog.dbalan.in/blog/2019/02/23/resurracting-an-hp-7440a-plotter/index.html&quot;&gt;asking the plotter where the pen is and it will not respond till it&#39;s done moving&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Turns out, my problem was actually that my script didn&#39;t have a long enough timeout, and
sending the next command caused the plotter to abort the current command to do the new one.&lt;/p&gt;
&lt;p&gt;A timeout of &lt;code&gt;10&lt;/code&gt; is 300ms, for 10 seconds the timeout should be &lt;code&gt;13&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;With a proper timeout set, it has accepted a 11183 character transfer without having issues.
Not sure how big the buffer is.&lt;/p&gt;
&lt;p&gt;Here are some of the failures, and the eventual success:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/hp-7475A-plotter-gpib/penrose-test.jpg&quot; alt=&quot;repeated penrose and a 100mm square&quot;&gt;&lt;/p&gt;
&lt;p&gt;The misalignment is because I kept picking up the paper and putting it back down, it seemed to act differently depending on where it started.&lt;/p&gt;
&lt;p&gt;Test 100mm square to demo basic HPGL instructions:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;IN;                             # initialize
SP1;                            # choose pen 1
PU0,4000;                       # move to 0,4000 without drawing
PD4000,4000,4000,0,0,0,0,4000;  # draw a square
SP0;                            # put away the pen
PU0,0;                          # move to 0,0
IN;                             # re-initialize, not sure why inkscape thinks this is necessary
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I&#39;m not sure if 1 unit being 0.025mm is a standard for all HPGL plotters, but I&#39;m glad the inkscape defaults, the interfacing manual, and (most importantly) the paper and ruler all agree.&lt;/p&gt;
&lt;p&gt;The biggest issue I have right now is that inkscape doesn&#39;t have great HPGL support, it only uses PD, which is for straight lines..
The plotter supports fancy curved lines, and fills, and other interesting things.&lt;/p&gt;
&lt;p&gt;Curves look okay though, so I don&#39;t think I care.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>logicdata desk controller v2</title>
        <link href="https://technicallycompetent.com/blog/logicdata-desk-v2/"/>
        <updated>2020-01-16T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/logicdata-desk-v2/</id>
        <content type="html">&lt;p&gt;At $work I have a motorized sit/stand desk.
I have to hold the up/down buttons to go to any height.
Clearly, this is far too difficult.
So I put together a &lt;a href=&quot;/hacking-logicdata-desk&quot;&gt;thing to read the height and use double presses to automatically go to high/low setpoints while keeping single button hold functionality intact&lt;/a&gt; a while back.&lt;/p&gt;
&lt;p&gt;A few weeks ago, someone emailed me about it and I got inspired to clean it up and redo some bits.&lt;/p&gt;
&lt;p&gt;Version 1 was just taking what &lt;a href=&quot;https://github.com/phord/RoboDesk&quot;&gt;Phil Hord had done&lt;/a&gt; and bodging it till it worked for my use case.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/logicdata-desk-v2/schematic-v1.png&quot; alt=&quot;schematic v1&quot;&gt;&lt;/p&gt;
&lt;p&gt;It does stuff like use the same pins to read the buttons and control the desk.&lt;/p&gt;
&lt;p&gt;It works, but it&#39;s hard to read and hard to understand.&lt;/p&gt;
&lt;p&gt;For the new version, I just put a switch in to either connect the buttons to the desk, or to fully MitM the buttons.&lt;/p&gt;
&lt;p&gt;I had tried to do some fancy logic with 74 series mux before it was pointed out that what I really wanted was a switch.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/logicdata-desk-v2/schematic-v2.png&quot; alt=&quot;schematic v2&quot;&gt;&lt;/p&gt;
&lt;p&gt;One issue I had when assembling this was the DIN-7 connector schematic didn&#39;t have a shell pin, which is ground.
You can see the note about that in the v1 schematic.&lt;/p&gt;
&lt;p&gt;So when I did basic layout, the connector footprints and symbols had different numbers of pins.
Somehow I didn&#39;t notice this till after I had soldered it wrong, but luckily I only had to move three pins cause I also read the schematic wrong, and these mistakes mostly cancelled.&lt;/p&gt;
&lt;p&gt;So I spent the time to fix the schematic symbols to have a shell pin, as you can see in the above schematic.
Doesn&#39;t look great, but I couldn&#39;t really think of a better way to do it.&lt;/p&gt;
&lt;p&gt;I&#39;ve been doing basic layout for protoboard stuff a while, and I find it really helpful even if I&#39;m never going to spin a PCB.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/logicdata-desk-v2/layout-v2.png&quot; alt=&quot;layout v2&quot;&gt;&lt;/p&gt;
&lt;p&gt;I did connectorize everything with JST XH.
I&#39;ve been getting better with crimpers and I&#39;m really liking how it makes so many things easier.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/logicdata-desk-v2/v2.jpg&quot; alt=&quot;closer picture of v2&quot;&gt;&lt;/p&gt;
&lt;p&gt;It&#39;s a little more crowded in v2.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/logicdata-desk-v2/both.jpg&quot; alt=&quot;picture of v1 and v2&quot;&gt;&lt;/p&gt;
&lt;p&gt;I also decreased the thickness of the enclosure, and centered things a little better.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.thingiverse.com/thing:1355018&quot;&gt;The Ultimate Parametric Box&lt;/a&gt; my enclosure is based on isn&#39;t the simplest thing to learn openscad on.
I definitely still have a lot to learn about how openscad does things, the coordinate system is still a bit weird to me, you translate stuff but work in the original coordinate space.&lt;/p&gt;
&lt;p&gt;Still, I can use it to make objects.
That&#39;s pretty cool.&lt;/p&gt;
&lt;p&gt;Overall, I&#39;m happy with where this project is now.
For the code, it&#39;s usually clear what it&#39;s trying to do, for the electronics, it&#39;s a bit more complex, but I really like having a switch that cuts out everything I added.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>zw3005 honeywell z-wave lightswitch teardown</title>
        <link href="https://technicallycompetent.com/blog/zw3005-teardown/"/>
        <updated>2019-09-17T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/zw3005-teardown/</id>
        <content type="html">&lt;p&gt;Some friends use the TP link kasa lightswitches.
I intended to buy one to evaluate, but got confused by someone else talking about what they use(z-wave) while I tried to order it.&lt;/p&gt;
&lt;p&gt;I don&#39;t use zwave, so I decided to see what would be involved with converting it to be ESP based.&lt;/p&gt;
&lt;p&gt;TL;DR: Maybe possible to convert, but way too much effort.&lt;/p&gt;
&lt;p&gt;I&#39;m just posting what I know because I couldn&#39;t find any pictures of the inside online.&lt;/p&gt;
&lt;p&gt;It has the &lt;a href=&quot;http://www.keil.com/dd/docs/datashts/sigmadesigns/sd3502_bro.pdf&quot;&gt;SD3502&lt;/a&gt; Z-Wave SoC as the brain, and uses a BTA24-600BW triac as the switch.&lt;/p&gt;
&lt;p&gt;After you take out all the obvious screws, you find this rivet.
&lt;img src=&quot;/assets/pages/zw3005/rivet.jpg&quot; alt=&quot;the rivet holding it together&quot;&gt;
I drilled it out
&lt;img src=&quot;/assets/pages/zw3005/no-rivet.jpg&quot; alt=&quot;no rivet&quot;&gt;&lt;/p&gt;
&lt;p&gt;Pry the clips in the square slots out to remove the PCB.&lt;/p&gt;
&lt;p&gt;Turns out the rivet was actually connecting the triac to the metal plate, so the metal plate was also a heatsink.
&lt;img src=&quot;/assets/pages/zw3005/board.jpg&quot; alt=&quot;good luck getting this back together David, sorry.&quot;&gt;
Also debug pins!&lt;/p&gt;
&lt;p&gt;It&#39;s a clever dual-layer set of boards.
&lt;img src=&quot;/assets/pages/zw3005/side.jpg&quot; alt=&quot;side view&quot;&gt;&lt;/p&gt;
&lt;p&gt;Overall, as it has the triac on the upper board, I&#39;m not going to even try to bodge an ESP in.&lt;/p&gt;
&lt;p&gt;I&#39;m going to try to hand this off to someone who uses these, but as the rivet heatsink is now missing, I doubt it will work.
So if anyone wants the thing, let me know and I&#39;ll try to get it to you.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>RTT with a nordic board on linux</title>
        <link href="https://technicallycompetent.com/blog/nordic-rtt-linux/"/>
        <updated>2019-06-07T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/nordic-rtt-linux/</id>
        <content type="html">&lt;p&gt;Segger RTT(Real Time Transfer) is an out of band debugging tool.
I specifically want to use it with Nordic&#39;s logger.&lt;/p&gt;
&lt;p&gt;If you search &amp;quot;rtt nordic linux&amp;quot;, you get
&lt;a href=&quot;https://devzone.nordicsemi.com/f/nordic-q-a/14512/how-to-use-rtt-viewer-or-similar-on-gnu-linux&quot;&gt;a forum post explaining how to do it&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Pity it doesn&#39;t work.&lt;/p&gt;
&lt;p&gt;The basic idea is you run &lt;code&gt;JLinkExe&lt;/code&gt;, have it connect to the microcontroller, and then run &lt;code&gt;JLinkRTTClient&lt;/code&gt;, which will connect to &lt;code&gt;JLinkExe&lt;/code&gt; and show you the output.&lt;/p&gt;
&lt;p&gt;In the end, the issue I was having is that the RTT Control Block address wasn&#39;t being automagically discovered.&lt;/p&gt;
&lt;p&gt;This &lt;a href=&quot;https://forum.segger.com/index.php/Thread/4754-SOLVED-RTT-on-MacOSX-TI-CodeComposerStudio-Tiva-LaunchPad/?postID=17642#post17642&quot;&gt; post from jWendell&lt;/a&gt; is what pointed me to the correct solution.&lt;/p&gt;
&lt;p&gt;Manual steps to make it work:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://devzone.nordicsemi.com/f/nordic-q-a/34060/rtt-control-block-location-for-segger-systemview&quot;&gt;Look up the RTT Control Block address&lt;/a&gt; in &lt;code&gt;_build/*.map&lt;/code&gt;, just grep for &lt;code&gt;_SEGGER_RTT&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;pre&gt;&lt;code&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;JLinkExe -if SWD -speed 4000 -device Cortex-M4 -autoconnect 1&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;* then type `exec SetRTTAddr 0xWHATEVER` into the `JLinkExe` prompt
* in a different terminal run `JLinkRTTClient`, receive the RTT output, rejoice, etc.


As that is an unacceptable number of steps[^1], lets script that.

If you look at the [JLink documentation](https://www.segger.com/downloads/jlink/UM08001) and search for `SetRTTAddr`, it talks about what it does and how to use it.
If you look below that, at SetRTTTelentPort, you will see the only place I&#39;ve found documentation for the command line options: Side comments in other sections.


As there is no way to set `SetRTTAddr` from the command line, we&#39;ll just pass a script file in with
[-CommanderScript](https://wiki.segger.com/J-Link_Commander#Batch_processing).

The address is in build artifacts, so we want to dynamically read it.

I tried using [process substitution](https://en.wikipedia.org/wiki/Process_substitution), but that didn&#39;t work out so I just used `mktemp`.


This is the first pass at hacking together something that works.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;#!/bin/bash
set -eo pipefail&lt;/p&gt;
&lt;p&gt;cd $(dirname &amp;quot;$0&amp;quot;)&lt;/p&gt;
&lt;p&gt;#TODO: If it was the user pressing ^c to kill JLinkRTTClient, maybe don&#39;t
#return an error?
function cleanup() {
rm -f $TMP
echo &#39;&#39;
#echo &#39;trap&#39;
# TODO: this finds two processes that are dead by the time kill gets them,
# but if I don&#39;t do it, JLinkExe stays around too long
kill $(jobs -p)
exit 42
}&lt;/p&gt;
&lt;p&gt;TMP=$(mktemp)
echo &amp;quot;tempfile is $TMP&amp;quot;&lt;/p&gt;
&lt;p&gt;trap &amp;quot;cleanup&amp;quot; SIGINT SIGTERM ERR&lt;/p&gt;
&lt;p&gt;echo -n &amp;quot;exec SetRTTAddr &amp;quot; &amp;gt; $TMP
grep &amp;quot; _SEGGER_RTT&amp;quot; _build/*.map | awk &#39;{print $1}&#39; &amp;gt;&amp;gt; $TMP&lt;/p&gt;
&lt;p&gt;JLinkExe -if SWD -speed 4000 -device Cortex-M4 -autoconnect 1 &lt;br&gt;
-CommanderScript $TMP &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 &amp;amp;&lt;/p&gt;
&lt;p&gt;JLinkRTTClient&lt;/p&gt;
&lt;p&gt;#probably can&#39;t get here, need to ctrl c out of JLinkRTTClient, which will
#return an erro, which will be caught by trap ERR
#but just in case
echo &amp;quot;somehow JLinkRTTClient didn&#39;t return an error on exit&amp;quot;
rm -f $TMP
exit 1;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
Reflashing the code while this is running seems to work fine.


If you have improvements, or want to know if I&#39;ve fixed anything since I posted it, email me.


[^1]: More than one
&lt;/code&gt;&lt;/pre&gt;
</content>
    </entry>
    
    <entry>
        <title>KiCad Art</title>
        <link href="https://technicallycompetent.com/blog/kicad-art/"/>
        <updated>2018-09-27T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/kicad-art/</id>
        <content type="html">&lt;p&gt;Putting logos on a kicad board isn&#39;t terribly hard, just slightly annoying.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/kicad-art/closeup.jpg&quot; alt=&quot;some boards with art&quot;&gt;&lt;/p&gt;
&lt;p&gt;Approach for copper/mask taken from &lt;a href=&quot;http://blog.komar.be/making-pcb-artwork-in-kicad/&quot;&gt;komar&#39;s techblog&lt;/a&gt;, but I couldn&#39;t get the tooling to work.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/zirafa/svg2mod&quot;&gt;svg2mod fork for python3 support&lt;/a&gt; turns an svg into a &lt;code&gt;.kicad_mod&lt;/code&gt; file.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;pip3 install git+https://github.com/zirafa/svg2mod&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Summary&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Vector image in inkscape.&lt;/li&gt;
&lt;li&gt;Make it a path, where the fill actually fills it&lt;/li&gt;
&lt;li&gt;Resize to the final size (with a few mm spacing)
&lt;ul&gt;
&lt;li&gt;Object -&amp;gt; Transform&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Name layer &lt;code&gt;Cu&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Duplicate layer, name &lt;code&gt;Mask&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Make mask slightly bigger
&lt;ul&gt;
&lt;li&gt;Path -&amp;gt; Outset works
&lt;ul&gt;
&lt;li&gt;Step size in Preferences -&amp;gt; Behaviour -&amp;gt; Steps -&amp;gt; Inset/Outset by&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Path -&amp;gt; Break Apart&lt;/li&gt;
&lt;li&gt;Edit -&amp;gt; Resize Page to Selection&lt;/li&gt;
&lt;li&gt;&lt;code&gt;svg2mod -i input.svg -o output-filename --name module-name -p 1&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/kicad-art/board-art.jpg&quot; alt=&quot;some boards with art&quot;&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;ul&gt;
&lt;li&gt;Update 2018-11-12: Add header image&lt;/li&gt;
&lt;li&gt;Update 2019-07-12: Redo instructions&lt;/li&gt;
&lt;li&gt;Update 2020-10-14: Add specifics&lt;/li&gt;
&lt;/ul&gt;
</content>
    </entry>
    
    <entry>
        <title>i3Detroit Automation: Snappy Title Pending</title>
        <link href="https://technicallycompetent.com/blog/i3detroit-automation-stack/"/>
        <updated>2018-09-27T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/i3detroit-automation-stack/</id>
        <content type="html">&lt;p&gt;Here at i3Detroit, we like learning things. Also we don&#39;t like doing extra work.
This usually balloons into a lot of extra work and (hopefully) less work later.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://xkcd.com/1319/&quot;&gt;&lt;img src=&quot;https://imgs.xkcd.com/comics/automation.png&quot; alt=&quot;&#39;Automating&#39; comes from the roots &#39;auto-&#39; meaning &#39;self-&#39;, and &#39;mating&#39;, meaning &#39;screwing&#39;.&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;i3Detroit Automation System Architecture&lt;/p&gt;
&lt;p&gt;We started looking into automation for a few reasons: simplifying the space shutdown procedure, and cost/complication of expanding.
Most of our existing lighting circuits are where they were when we started renting the building but some of them have been cumbersome to work with (&amp;quot;no, you can&#39;t plug that in there that outlet turns off when the lights do&amp;quot;).
When we expand to encompass even more space it gets increasingly difficult to run more and more light switches to control groups of outlets.
With networked relays on every light we can specify groupings in software rather than spending 4-5 hours bending conduit, planning a route in our increasingly crowded ceiling and walls, and pulling fairly expensive wire long distances.
Doing this in our current space gives proof that we do not need to spend a lot of time re-wiring any building we inhabit, just plug in the lights to whatever outlets are already up there and we can control them in whatever pattern is most convenient.&lt;/p&gt;
&lt;p&gt;Frequently people would complain because they come in and find the doors to have been unlocked all night, or the tank of argon has all leaked away, or maybe someone decided to try to heat our colander of a shop to 75F all night long in the middle of winter when no one was there.
The benefits of automating things is not just saving time on tasks that get done, but making sure all the tasks actually do get done.&lt;/p&gt;
&lt;p&gt;i3Detroit&#39;s status panel:
&lt;img src=&quot;https://www.i3detroit.org/wi/images/d/d5/IoT_map.jpg&quot; alt=&quot;i3 iot map&quot;&gt;&lt;/p&gt;
&lt;p&gt;Designing a system to be used by 160 people, most of whom have no idea/interest in what it is, how it works, or what new failures can occur is difficult.
In the home automation hobbyist community this usually correlates to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Wife_acceptance_factor&quot;&gt;&#39;Spousal Acceptance Factor&#39;&lt;/a&gt; but we have so many more people to please (or, at least pre-emptively render any potential complaints irrelevant/solved).
The biggest requirement we had going in was that everything has to work when the wifi and/or internet was down.
The lights not working because the internet being down is not acceptable (and makes it fairly hard to explain why this is better than it used to be).&lt;/p&gt;
&lt;p&gt;One of the bigger changs was all the lightswitches.
Previously The lights were mainly controlled in lines that run the entire length of the building, each running from either a lightswitch (less bad) or a breaker (more bad).
Now, the software controlled lights exactly mirrors this pattern, but now we have several lightswitches in different locations making it more convenient.
The old lightswitches have not been removed, only had plastic covers placed over them because when the network is down they can still be used to control the lights.&lt;/p&gt;
&lt;p&gt;Example of new button layout vs old lightswitch layout:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/i3detroit-automation-stack/switches.jpg&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;In this case, the green lightswitches controlled three rows of lights. The order is something like 2 3 1 or whatever, the point being it was just try random switches and hope you get the right one.
Now, they&#39;re labeled.&lt;/p&gt;
&lt;p&gt;All our lights without ground level buttons have their switches/breakers preserved and have been configured to turn on when they boot up.
This means that if there is no wifi at all, the relay gets power and then immediately turns the light on so it works seamlessly as if the relays were not there.
The lightswitches for the office area we replaced with sonoff touches, because they either only controlled one light or control built-in lights (behind drywall for example), and they do not turn on when power is restored.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/i3detroit-automation-stack/sonoff-touch.jpg&quot; alt=&quot;sonoff touch&quot;&gt;&lt;/p&gt;
&lt;p&gt;We don&#39;t love the touch interface with no actual button, but haven&#39;t changed it yet.
I have a plan though.&lt;/p&gt;
&lt;p&gt;Other considerations:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The S in IoT stands for Security.&lt;/li&gt;
&lt;li&gt;Privacy concerns or whatever&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We took a three tier approach to the control stack.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The original lightswitches(or breakers as the case may be) still work. If you bounce power, the lights turn on.&lt;/li&gt;
&lt;li&gt;Commands over MQTT, with the &lt;a href=&quot;https://mosquitto.org/&quot;&gt;mosquitto&lt;/a&gt; broker.&lt;/li&gt;
&lt;/ol&gt;
&lt;ul&gt;
&lt;li&gt;Things like three-way switches talk directly to eachother over MQTT&lt;/li&gt;
&lt;li&gt;If the MQTT broker is up, you can chant the archaic incantations into the broker to receive control over things.&lt;/li&gt;
&lt;/ul&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;&lt;a href=&quot;https://home-assistant.io&quot;&gt;Homeassistant&lt;/a&gt;, this does the high-level logic and automation magic.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;We also use &lt;a href=&quot;https://www.influxdata.com/time-series-platform/influxdb/&quot;&gt;InfluxDB&lt;/a&gt; as a time-series database to log everything, and &lt;a href=&quot;https://grafana.com/&quot;&gt;Grafana&lt;/a&gt; to display beautiful graphs.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/i3detroit-automation-stack/grafana.png&quot; alt=&quot;graph of fablab temperature in grafana&quot;&gt;&lt;/p&gt;
&lt;p&gt;We started with &lt;a href=&quot;http://www.openhab.org/&quot;&gt;openhab 2&lt;/a&gt;, but it was clunky and seems to have a few memory leaks.
Homeassistant appears to have a more centrally focused development, and has a better stock UI.
The limitations on what hardware is supported in Homeassistant is not much of a concern because implementing things is not terribly difficult should we need to.&lt;/p&gt;
&lt;p&gt;It also has the option of better scripting with AppDaemon, which we haven&#39;t played with too much yet.&lt;/p&gt;
&lt;p&gt;Every IoT device connects to a wifi network that is on a vlan that can not talk to the internet.
The only exception is the IoT VM named &lt;code&gt;mcclellan&lt;/code&gt; which can talk to this VLAN and can be remotely administered.
We also have plans to include outside data into either displays or automations such as weather projections or &lt;a href=&quot;https://spacedirectory.org/pages/docs.html&quot;&gt;https://spacedirectory.org/pages/docs.html&lt;/a&gt; / &lt;a href=&quot;http://spaceapi.net/&quot;&gt;http://spaceapi.net/&lt;/a&gt;.
Sequestering the IoT like this not only makes it easier to have a relatively sensible DHCP pool for normal users of our network, but also prevents accidental control of devices or programming of devices (the Arduino over-the-air programming caused problems when users try to find their device which is on same wifi as tens of IoT devices that can be programmed that way).&lt;/p&gt;
&lt;p&gt;Most of our devices are &lt;a href=&quot;https://www.itead.cc/&quot;&gt;iTead&lt;/a&gt; products, such as the 4.85USD &lt;a href=&quot;https://www.itead.cc/smart-home/sonoff-wifi-wireless-switch.html&quot;&gt;sonoff basic&lt;/a&gt; running the open source &lt;a href=&quot;https://github.com/arendst/Sonoff-Tasmota/wiki&quot;&gt;Tasmota&lt;/a&gt; firmware.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/i3detroit-automation-stack/sonoff-basic.jpg&quot; alt=&quot;sonoff basic&quot;&gt;&lt;/p&gt;
&lt;p&gt;We cannot beat that price.&lt;/p&gt;
&lt;p&gt;We also have a bunch of &lt;a href=&quot;https://github.com/i3detroit/custom-mqtt-programs&quot;&gt;custom&lt;/a&gt; programs:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Lightswitches&lt;/li&gt;
&lt;li&gt;Thermostats&lt;/li&gt;
&lt;li&gt;Temperature sensors&lt;/li&gt;
&lt;li&gt;Motion sensors&lt;/li&gt;
&lt;li&gt;LED displays&lt;/li&gt;
&lt;li&gt;Front door status panel&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/i3detroit-automation-stack/thermostat.jpg&quot; alt=&quot;custom thermostat v1&quot;&gt;&lt;/p&gt;
&lt;p&gt;All of the custom code tries to emulate tasmota in terms of the interface, for consistency reasons.&lt;/p&gt;
&lt;p&gt;Our MQTT command structure is something like: &lt;code&gt;%prefix%/i3/inside/%topic%/%command%&lt;/code&gt;
&lt;code&gt;%topic%&lt;/code&gt; is something like: &lt;code&gt;lights/001&lt;/code&gt;
There can also be a group topic, which goes in the same place as topic.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;%prefix%&lt;/code&gt; is one of&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;cmnd&lt;/code&gt;: command the module to do something&lt;/li&gt;
&lt;li&gt;&lt;code&gt;stat&lt;/code&gt;: results of a command&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tele&lt;/code&gt;: telemetry data&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;code&gt;%command%&lt;/code&gt; is something like &lt;code&gt;POWER&lt;/code&gt; or &lt;code&gt;STATUS&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;To turn on light 1, you would send &lt;code&gt;cmnd/i3/inside/lights/001/POWER 1&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;To query the state of something, send something like &lt;code&gt;stat/i3/inside/lights/001/POWER&lt;/code&gt;.
No payload, and use &lt;code&gt;stat&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/arendst/Sonoff-Tasmota/wiki/MQTT-Features&quot;&gt;The full tasmota command list&lt;/a&gt; has a lot of built in functionality.
Our custom code is a bit less featureful, but it does implement &lt;code&gt;STATUS&lt;/code&gt; to return the mac/ip address.&lt;/p&gt;
&lt;p&gt;It&#39;s been a slow process, but we need to make sure it will work well, and not be worse than not having it for more than a few hours a t a time.
Bit scary to just start working on a huge system like this without a plan.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://xkcd.com/1319/&quot;&gt;&lt;img src=&quot;https://imgs.xkcd.com/comics/the_general_problem.png&quot; alt=&quot;I find that when someone&#39;s taking time to do something right in the present, they&#39;re a perfectionist with no ability to prioritize, whereas when someone took time to do something right in the past, they&#39;re a master artisan of great foresight.&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;We can only hope we will be master artisans of great foresight.&lt;/p&gt;
&lt;p&gt;Setup links:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://home-assistant.io/docs/installation/virtualenv/&quot;&gt;Homeassistant&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;AppDaemon (?) Not sure we actually use this. Does some extra automation for homeassistant&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://docs.grafana.org/installation/debian/&quot;&gt;InfluxDB&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;Also install telegraf to log cpu/memory/other stats of the server&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Grafana
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://docs.grafana.org/installation/debian/&quot;&gt;amd64&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://forum.pine64.org/archive/index.php?thread-4659.html&quot;&gt;pine64&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/fg2it/grafana-on-raspberry/wiki&quot;&gt;pi&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Mostly unrelated notes on RPI install&lt;/p&gt;
&lt;p&gt;sources.list rpi stretch&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#grafana
deb https://dl.bintray.com/fg2it/deb stretch main
#influx
deb https://repos.influxdata.com/debian stretch stable
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;sudo apt-get install python3 python3-venv python3-pip grafana influxdb mosquitto mosquitto-clients&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Follow &lt;a href=&quot;https://www.home-assistant.io/docs/installation/raspberry-pi/&quot;&gt;https://www.home-assistant.io/docs/installation/raspberry-pi/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I like /opt/homeassistant better&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ cat /etc/systemd/system/homeassistant.service
[Unit]
Description=Home Assistant
After=network-online.target

[Service]
Type=simple
User=homeassistant
ExecStart=/opt/homeassistant/bin/hass -c &amp;quot;/home/homeassistant/.homeassistant&amp;quot;

[Install]
WantedBy=multi-user.target
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Use &lt;a href=&quot;https://github.com/grafana/grafana/blob/master/packaging/deb/systemd/grafana-server.service&quot;&gt;https://github.com/grafana/grafana/blob/master/packaging/deb/systemd/grafana-server.service&lt;/a&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ cat /etc/systemd/system/grafana-server.service
[Unit]
Description=Grafana instance
Documentation=http://docs.grafana.org
Wants=network-online.target
After=network-online.target
After=influxd.service

[Service]
EnvironmentFile=/etc/default/grafana-server
User=grafana
Group=grafana
Type=simple
Restart=on-failure
WorkingDirectory=/usr/share/grafana
RuntimeDirectory=grafana
RuntimeDirectoryMode=0750
ExecStart=/usr/sbin/grafana-server                                                  &#92;
                            --config=${CONF_FILE}                                   &#92;
                            --pidfile=${PID_FILE_DIR}/grafana-server.pid            &#92;
                            cfg:default.paths.logs=${LOG_DIR}                       &#92;
                            cfg:default.paths.data=${DATA_DIR}                      &#92;
                            cfg:default.paths.plugins=${PLUGINS_DIR}                &#92;
                            cfg:default.paths.provisioning=${PROVISIONING_CFG_DIR}

LimitNOFILE=10000
TimeoutStopSec=20
UMask=0027

[Install]
WantedBy=multi-user.target
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;systemctl daemon-reload
systemctl enable homeassistant
systemctl enable grafana
systemctl enable mosquitto
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;influx is enabled already?&lt;/p&gt;
&lt;p&gt;Start all services, reboot, etc&lt;/p&gt;
&lt;p&gt;&lt;code&gt;influx --execute &amp;quot;CREATE DATABASE hass&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Add to &lt;code&gt;~homeassistant/.homeassistant/configuration.yaml&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;influxdb:
  host: localhost
  database: hass

mqtt:
  broker: localhost
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Running!&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;UPDATE 2018-11-12: Added picture of sonoff touch and moved the non-local picture of a sonoff basic to local&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>Using and Debugging MBED with arm-gcc</title>
        <link href="https://technicallycompetent.com/blog/mbed/"/>
        <updated>2018-06-27T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/mbed/</id>
        <content type="html">&lt;p&gt;Just notes on using mbed&lt;/p&gt;
&lt;h2&gt;Setting up&lt;/h2&gt;
&lt;p&gt;Get &lt;code&gt;gcc-arm-none-eabi-6-2017-q2-update&lt;/code&gt;, put it somewhere.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;gcc-arm-none-eabi-7-2017-q4-major&lt;/code&gt; didn&#39;t work for me, see
&lt;a href=&quot;https://github.com/ARMmbed/mbed-os/issues/6920&quot;&gt;mbed-os issue #6920&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;mbed import some url&lt;/code&gt;, just be careful about
&lt;a href=&quot;https://github.com/ARMmbed/mbed-cli/issues/706&quot;&gt;scp like urls&lt;/a&gt;
or &lt;code&gt;mbed new&lt;/code&gt; whatever.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;mbed config TARGET whatever
mbed config TOOLCHAIN GCC_ARM
mbed config GCC_ARM_PATH /opt/gcc-arm-none-eabi-6-2017-q2-update/bin/
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Remember to put the mbed firmware on the device if needed.&lt;/p&gt;
&lt;p&gt;Test that the device exists with &lt;code&gt;mbedls&lt;/code&gt;, the mbed command to program is&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;udisksctl mount -b /dev/sdc; mbed compile --profile mbed-os/tools/profiles/debug.json --flash
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Mount the device, compile with the debug profile(optional), and flash it.&lt;/p&gt;
&lt;h2&gt;debugging&lt;/h2&gt;
&lt;p&gt;Install &lt;a href=&quot;https://github.com/mbedmicro/pyOCD&quot;&gt;pyOCD&lt;/a&gt; sets up the gdb server&lt;/p&gt;
&lt;p&gt;Really, try &lt;code&gt;sudo -E pyocd-gdbserver --list&lt;/code&gt; before you think it doesn&#39;t work,
it was a permissions issue for me, use their udev rule.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;.gdbinit&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;define reload
mon reset
load
end

target remote localhost:3333
load
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Run &lt;code&gt;pyocd-gdbserver&lt;/code&gt;
Run &lt;code&gt;$GCC_PATH_THING/arm-none-eabi-gdb BUILD/whatever/whatever/whatever_applicaiton.elf&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Compile with debug profile, don&#39;t flash. Run &lt;code&gt;reload&lt;/code&gt; in gdb, will program it.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>Lora Gateway Research</title>
        <link href="https://technicallycompetent.com/blog/lora-gateway/"/>
        <updated>2018-05-31T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/lora-gateway/</id>
        <content type="html">&lt;p&gt;Trying to get to a lorawan gateway.&lt;/p&gt;
&lt;p&gt;Got the &lt;a href=&quot;https://github.com/CongducPham/LowCostLoRaGw&quot;&gt;Low Cost LoRa Gateway&lt;/a&gt; running, but no lorawan.&lt;/p&gt;
&lt;h2&gt;lorawan client with the st lora dev board B-L072Z-LRWAN1&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;git clone https://github.com/ARMmbed/mbed-os-example-lorawan
cd mbed-os-example-lorawan
mbed deploy
#or do the mbed import thing

connect dev board
mbedls -u # should show device
mbed config TARGET DISCO_L072CZ_LRWAN1
mbed config TOOLCHAIN GCC_ARM

mbed compile --flash
# [mbed] ERROR: Unable to reset the target board connected to your system.
# Try updating firmware with tool here: https://my.st.com/content/my_st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-programmers/stsw-link007.license=1527606754349.html
remount
# Still doesn&#39;t work

# give up and export
mbed export -i make_gcc_arm
make
# edit makefile to include
#     STLINK=/home/mark/advanced/b2v/lora/stm32/stlink/build/Release
#     .PHONY: burn
#     burn: $(PROJECT).bin
#         $(STLINK)/st-flash write $(PROJECT).bin 0x8000000
make burn
minicom -D /dev/ttyACM0
#set serial rate to 230400 (115200*2 because that&#39;s the default?)
#It works!
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I wasn&#39;t able to get the thing to connect to the machineQ network, but I think that&#39;s a range/coverage issue, not a authentication issue.&lt;/p&gt;
&lt;h2&gt;setting up our own gateway&lt;/h2&gt;
&lt;p&gt;Lora gateway with two libelium sx1272 modules (note, &lt;strong&gt;not&lt;/strong&gt; lorawan)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/CongducPham/LowCostLoRaGw&quot;&gt;https://github.com/CongducPham/LowCostLoRaGw&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://cpham.perso.univ-pau.fr/LORA/RPIgateway.html&quot;&gt;http://cpham.perso.univ-pau.fr/LORA/RPIgateway.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Modify the arduino code to be FCC, 900MHz, not paboost.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ignore config file&lt;/strong&gt; on the rpi, run with &lt;code&gt;sudo ./lora_gateway --mode 1 --freq 913.88&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;PingPong doesn&#39;t ACK back from the gateway, but the gateway does receive.&lt;/li&gt;
&lt;li&gt;But again, thisis lora not lorawan so not terribly useful.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Actual lorawan gateways:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;20, single channel
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://sandboxelectronics.com/?product=lorago-dock-915mhz-single-channel-lorawan-gateway&quot;&gt;https://sandboxelectronics.com/?product=lorago-dock-915mhz-single-channel-lorawan-gateway&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;open source?&lt;/li&gt;
&lt;li&gt;code is open source.&lt;/li&gt;
&lt;li&gt;sx1276 + esp8266&lt;/li&gt;
&lt;li&gt;single channel, not a real gateway. Might be good enough for us though?&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://sandboxelectronics.com/wp-content/uploads/2017/09/LoRaGoDockAssembly.pdf&quot;&gt;assembly pdf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://sandboxelectronics.com/wp-content/uploads/2017/09/LoRaGoDockSchematics.pdf&quot;&gt;schematic&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/SandboxElectronics/LoRaGoDOCK-Gateway&quot;&gt;github&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.ebay.com/itm/LoRaGo-Dock-915MHz-Single-Channel-LoRaWAN-Gateway-Based-on-SX1276-and-ESP8266/112777043755?epid=2265194658&amp;amp;hash=item1a42091f2b:g:HaQAAOSwWEZaav2U&quot;&gt;ebay&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;120USD, open source full gateway 915MHz
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.tindie.com/products/will123321/sx1308-raspberry-pi-lora-gateway-board/&quot;&gt;https://www.tindie.com/products/will123321/sx1308-raspberry-pi-lora-gateway-board/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;290 full gateway kit for 915MHz from seeed studio:
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.seeedstudio.com/LoRa%2FLoRaWAN-Gateway-915MHz-for-Raspberry-Pi-3-p-2821.html&quot;&gt;https://www.seeedstudio.com/LoRa%2FLoRaWAN-Gateway-915MHz-for-Raspberry-Pi-3-p-2821.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;actually from risingHF (no price) &lt;a href=&quot;http://www2.risinghf.com/#/product-details?product_id=6&amp;amp;lang=en&quot;&gt;http://www2.risinghf.com/#/product-details?product_id=6&amp;amp;lang=en&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;??? risingHF consumer product: &lt;a href=&quot;http://www2.risinghf.com/#/product-details?product_id=10&amp;amp;lang=en&quot;&gt;http://www2.risinghf.com/#/product-details?product_id=10&amp;amp;lang=en&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;60 consumer gateway? &lt;a href=&quot;https://www.robotshop.com/en/lg01-p-lora-gateway-915-mhz-north-america.html&quot;&gt;https://www.robotshop.com/en/lg01-p-lora-gateway-915-mhz-north-america.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;300 pi hat gateway &lt;a href=&quot;https://www.robotshop.com/en/915mhz-lora-gateway-raspberry-pi-hat.html&quot;&gt;https://www.robotshop.com/en/915mhz-lora-gateway-raspberry-pi-hat.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;150 rak831 sx1301 based &lt;a href=&quot;http://www.rakwireless.com/en/WisKeyOSH/RAK831&quot;&gt;http://www.rakwireless.com/en/WisKeyOSH/RAK831&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;325 the things network gateway &lt;a href=&quot;http://www.newark.com/the-things-network/ttn-gw-915/accessory-type-wireless-gateway/dp/05AC1807&quot;&gt;http://www.newark.com/the-things-network/ttn-gw-915/accessory-type-wireless-gateway/dp/05AC1807&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;this is the people who run the backend stuff a lot of people use&lt;/li&gt;
&lt;li&gt;pretty much guarenteed to work?&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The common one, the IMST iC880a is for the 861MHz spectrum, not usable in the USA.
The sandbox electronics LoRaGo thing claims to be pretty much the iC880a but for the 915MHz.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>Hello World on an stm32 l0 LoRa dev board</title>
        <link href="https://technicallycompetent.com/blog/stm32-lrwan-hello-world/"/>
        <updated>2018-05-24T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/stm32-lrwan-hello-world/</id>
        <content type="html">&lt;p&gt;Trying to make it blink.&lt;/p&gt;
&lt;p&gt;Took far longer than expected or probably necessary.&lt;/p&gt;
&lt;p&gt;It seems a lot of my life has been trying to replicate and or work around weird IDE include behavior with make and gcc.
To get code to compile with the HAL libraries from ST, you need to manually include the ones you use in the sources in your makefile, and manually include a bunch of directories in your include path.&lt;/p&gt;
&lt;p&gt;I&#39;m guessing the fancy IDEs just do some guessing magic to add the files to be compiled.
Or maybe just makes the object files for all of them and lets you have access to that.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Start point: &lt;a href=&quot;http://www.wolinlabs.com/blog/linux.stm32.discovery.gcc.html&quot;&gt;WolinLabs STM32 Discovery Development On Linux&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;End goal: &lt;a href=&quot;https://my.st.com/content/my_st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-eval-tools/stm32-mcu-eval-tools/stm32-mcu-discovery-kits/b-l072z-lrwan1.html&quot;&gt;LoRa Demo code/HAL libraries&lt;/a&gt; from st running.&lt;/li&gt;
&lt;li&gt;Current point: Blinking.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Official &lt;a href=&quot;http://www.st.com/content/ccc/resource/technical/document/user_manual/group0/ac/62/15/c7/60/ac/4e/9c/DM00329995/files/DM00329995.pdf/jcr:content/translations/en.DM00329995.pdf&quot;&gt;documentation for the dev kit&lt;/a&gt; from st.&lt;/p&gt;
&lt;p&gt;Thanks to eewiki for &lt;a href=&quot;https://eewiki.net/pages/viewpage.action?pageId=47644832#GettingStartedwithSTM32ARMCortex-M0+-Example_of_GPIOExampleofGPIO:&quot;&gt;documentation on how to use GPIO&lt;/a&gt; that I couldn&#39;t find elsewhere.&lt;/p&gt;
&lt;h2&gt;Setup&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Compile &lt;a href=&quot;https://github.com/texane/stlink&quot;&gt;the open source version of stlink&lt;/a&gt; somewhere.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;No need to install globally.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code&gt;st-info --probe
&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;Make sure that that actually sees your thing, should look like:&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code&gt;Found 1 stlink programmers
 serial: 303636434646333233343335353033
openocd: &amp;quot;&#92;x30&#92;x36&#92;x36&#92;x43&#92;x46&#92;x46&#92;x33&#92;x32&#92;x33&#92;x34&#92;x33&#92;x35&#92;x35&#92;x30&#92;x33&amp;quot;
  flash: 196608 (pagesize: 128)
   sram: 20480
 chipid: 0x0447
  descr: L0x Category 5 device
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Take the st example/firmware zip, extract it somewhere.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Modify the makefile to have paths that point to the st code dir, and the stlink release directory.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Get GDB to evaluate our macros&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Need to modify ~/.gdbinit to whitelist other .gdbinit files. Read the gdb startup messages, it will explain.&lt;/li&gt;
&lt;li&gt;I had to do this, if you&#39;re copying mine this is in it:
&lt;ul&gt;
&lt;li&gt;Modified the &lt;code&gt;reload&lt;/code&gt; macro in the &lt;code&gt;.gdbinit&lt;/code&gt; to take an argument to not kill the program if not needed, it would be better if I could figure out how to make gdb macros have failure be an option on some commands.&lt;/li&gt;
&lt;li&gt;If it&#39;s built with python support, you can have it run python, and presumably other languages, but that&#39;s more investment than I had at the time.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Building&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;make
make burn
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Debugging&lt;/h2&gt;
&lt;h3&gt;Useful commands:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;make showelf
&lt;ul&gt;
&lt;li&gt;Show the assembly, same as running &lt;code&gt;arm-none-eabi-objdump -Cd blinky.elf | less&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Running GDB:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;st-util
&lt;ul&gt;
&lt;li&gt;Start the gdb server&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;arm-none-eabi-gdb blinky.elf&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;In gdb, &lt;code&gt;reload&lt;/code&gt; or &lt;code&gt;reload anyArg&lt;/code&gt; will burn new code.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Got it blinking with a breakpoint for delay, but trying to use the blink code from Ross Wolin or the &lt;code&gt;HAL_Delay&lt;/code&gt; seemed to just hang.
Spent a day or so debugging this, set it down for a while, and then had the bright idea to ask &amp;quot;What&#39;s the clock?&amp;quot;.&lt;/p&gt;
&lt;p&gt;Turns out the default clock is 2.1MHz.
The delay function Ross gave us is&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;//Quick hack, approximately 1ms delay
void ms_delay(int ms)
{
   while (ms-- &amp;gt; 0) {
      volatile int x=5971;
      while (x-- &amp;gt; 0)
         __asm(&amp;quot;nop&amp;quot;);
   }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So, &lt;code&gt;5971 + number of instructions to run a loop&lt;/code&gt; is about 1ms.
At 2.1MHz, one instruction is &lt;code&gt;4.7*10^-7&lt;/code&gt; seconds. 1ms is &lt;code&gt;1*10^-3&lt;/code&gt; seconds.
So the number of instructions in 1ms is &lt;code&gt;10^-3/(4.7*10^-7) = 2128&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;So considering that this is the important bit of the delay funciton, you would think we just divide that by the 5 other loop instructions.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; 80001ea:       23fa            movs    r3, #250        ; 0xfa
 80001ec:       60fb            str     r3, [r7, #12]
 80001ee:       e000            b.n     80001f2 &amp;lt;ms_delay+0x12&amp;gt;
 80001f0:       46c0            nop                     ; (mov r8, r8)
 80001f2:       68fb            ldr     r3, [r7, #12]
 80001f4:       1e5a            subs    r2, r3, #1
 80001f6:       60fa            str     r2, [r7, #12]
 80001f8:       2b00            cmp     r3, #0
 80001fa:       dcf9            bgt.n   80001f0 &amp;lt;ms_delay+0x10&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But I did my math wrong the first time, and got 250, which works near-correct(500ms is 543), so the timing is still magic?&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;HAL_Delay&lt;/code&gt; still doesn&#39;t work, and I have absolutely no idea why.
Maybe I was supposed to define the clock speed for the HAL stuff somewhere like &lt;code&gt;F_CPU&lt;/code&gt; in AVR.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>Hacking the Logicdata Desk Controller</title>
        <link href="https://technicallycompetent.com/blog/hacking-logicdata-desk/"/>
        <updated>2018-05-14T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/hacking-logicdata-desk/</id>
        <content type="html">&lt;p&gt;The definition that is &lt;a href=&quot;http://tmrc.mit.edu/hackers-ref.html&quot;&gt;not actually from MIT in spite of always being cited as from MIT&lt;/a&gt; of hacking is&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Hacking: Using things in ways they were not intended to be used.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;It&#39;s a good definition.&lt;/p&gt;
&lt;p&gt;So here&#39;s how I hacked my electronic sit/stand desk controller to have set points in yet another one day project.&lt;/p&gt;
&lt;p&gt;So first off, many thanks for Phil Hord for &lt;a href=&quot;https://github.com/phord/RoboDesk&quot;&gt;doing 90% of the work for me&lt;/a&gt;.
He wrote the analysis code for the logicdata protocol, as well as the clever way to read the button lines while asserting them so the desk still moves.
This is mostly a writeup of how to use his codebase, and some of how it works.&lt;/p&gt;
&lt;p&gt;So now my discovery process, starting with the controller.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/hacking-logicdata-desk/controller.jpg&quot; alt=&quot;the logicdata controller and a microcontroller&quot;&gt;&lt;/p&gt;
&lt;p&gt;Logicdata was nice enough to provide a &lt;a href=&quot;https://web.archive.org/web/20180514132622/http://www.logicdata.net/wp-content/uploads/2017/05/Datasheet_Compact_English-Rev4.pdf&quot;&gt;datasheet&lt;/a&gt;, not that I trust them to keep it up so have a link to archive.org.&lt;/p&gt;
&lt;p&gt;This contains the pinout for the button connector.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/hacking-logicdata-desk/controller-pinout.png&quot; alt=&quot;the logicdata button pinout&quot;&gt;&lt;/p&gt;
&lt;p&gt;It has a serial line! Those do interesting things!&lt;/p&gt;
&lt;p&gt;Turns out, at least one other person on the planet has noticed this, and it was Phil Hord, who has some &lt;a href=&quot;https://www.youtube.com/watch?v=SxIxr1Ul7UI&quot;&gt;videos of something related to the desks&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;From there, I found his github, and his &lt;a href=&quot;https://github.com/phord/RoboDesk&quot;&gt;code&lt;/a&gt;.
The interesting bits are hidden away on the LogicData branch.&lt;/p&gt;
&lt;p&gt;After that, it was an entire half day to get it running on an nodemcu board, chosen for it&#39;s well-respected feature of being within reach.&lt;/p&gt;
&lt;p&gt;So because we want to be able to read the button presses, but also be able to control the desk without fully MitM ing the buttons, phord came up with a rather clever workaround.
Write to the buttons or whatever, set them as input, read them, try again till it looks like we aren&#39;t reading what we wrote, and then switch back to output and continue asserting the line high or low.&lt;/p&gt;
&lt;p&gt;It does make the debouncing code a little more confusing.&lt;/p&gt;
&lt;p&gt;The LogicData protocol is the other important thing.
I didn&#39;t spend much time looking at it on the scope, because the code just worked.
So here are the notes phord left on it, which I did confirm with a scope.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;// 32-bit words
// Idle line is logic-high (5v)
// MARK is LOW
// SPACE is HIGH
// Speed is 1000bps, or 1 bit per ms
// Start data by sending MARK for 50ms
// Approximately 50ms between words
// First two bits are always(?) 01 (SPACE MARK)
// All observed words start with 010000000110 (0x406; SPACE MARK SPACEx7 MARKx2 SPACE)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;There are a few things his code doesn&#39;t interpret, but it does read the height of the desk, which is the thing I wanted so I didn&#39;t poke too hard into how the message parsing worked.&lt;/p&gt;
&lt;p&gt;Ran into the issue of using a 3.3v microcontroller with 5V logic; I apparently can sustain a movement, but can&#39;t start one.
I&#39;m hopeful that a level shifter will fix that.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/mtfurlan/RoboDesk&quot;&gt;https://github.com/mtfurlan/RoboDesk&lt;/a&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;UPDATE 2019-03-15:&lt;/p&gt;
&lt;p&gt;On 2018-11-14 I printed a case for it, and mounted it to my desk.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/hacking-logicdata-desk/open-case.jpg&quot; alt=&quot;the logicdata controller in a case&quot;&gt;
&lt;img src=&quot;/assets/pages/hacking-logicdata-desk/case.jpg&quot; alt=&quot;the logicdata controller mounted to the desk&quot;&gt;&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>Programming the AT90USBKEY2</title>
        <link href="https://technicallycompetent.com/blog/at90usbkey2/"/>
        <updated>2018-04-24T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/at90usbkey2/</id>
        <content type="html">&lt;p&gt;In my continuing quest to turn a thinkpad keyboard into a USB keyboard, I decided to try the at90 line of avr chips.
Bought a AT90USBKEY2 dev kit, and tried to put TMK on it.&lt;/p&gt;
&lt;p&gt;This was another &amp;quot;one&amp;quot; day project.
It ended in running the onekey example, so this post is more just &amp;quot;how to use the AT90USBKEY2.&lt;/p&gt;
&lt;h2&gt;Important stuff first: How to flash.&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;press RST and HWB simultaneously on the board&lt;/li&gt;
&lt;li&gt;release RST then release HWB&lt;/li&gt;
&lt;li&gt;Power cycle the board. &lt;em&gt;IMPORTANT&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The end results of my day are pretty much this repo of a blink sketch with a makefile that works and a README telling you how to press the buttons.
&lt;a href=&quot;https://github.com/mtfurlan/at90usbkey2-blink&quot;&gt;https://github.com/mtfurlan/at90usbkey2-blink&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;What happened is that the timing in the blink sketch was wrong.&lt;/p&gt;
&lt;p&gt;I spent most of my day working on &lt;a href=&quot;https://electronics.stackexchange.com/q/361303/181040&quot;&gt;trying to figure out why the delay was wrong&lt;/a&gt;, and the best guess seems to be that there is some issue with the soft reset.
I may follow up with atmel on that, maybe I&#39;m just doing something really stupid.&lt;/p&gt;
&lt;p&gt;Or just reset the board better.&lt;/p&gt;
&lt;h2&gt;Important documentation:&lt;/h2&gt;
&lt;p&gt;Thanks to the CSC 460 Project Team A from 2007 for this pinout diagram:
&lt;a href=&quot;https://webhome.csc.uvic.ca/~mcheng/samples/cox/documentation/AT90_Pin_Diagram.pdf&quot;&gt;&lt;img src=&quot;/assets/pages/at90usbkey2/pinout.png&quot; alt=&quot;labeled gpio pins&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And then the jtag pinout I think from the atmel manual:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/at90usbkey2/jtag.png&quot; alt=&quot;jtag pinout&quot;&gt;&lt;/p&gt;
&lt;p&gt;Thanks to this person &lt;a href=&quot;http://generichid.sourceforge.net/hardware.htm&quot;&gt;http://generichid.sourceforge.net/hardware.htm&lt;/a&gt;
for which pins are already used by onboard stuff, and how to undo the onboard stuff if you need.&lt;/p&gt;
&lt;h2&gt;And lastly, TMK.&lt;/h2&gt;
&lt;p&gt;To make the TMK onekey example work, you really just need to change &lt;code&gt;MCU&lt;/code&gt; to &lt;code&gt;at90usb1287&lt;/code&gt;.
That&#39;s it, it works.&lt;/p&gt;
&lt;p&gt;EDIT: Clock speed is &lt;code&gt;8000000&lt;/code&gt;, that one is important too.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>Building a custom thermostat</title>
        <link href="https://technicallycompetent.com/blog/thermostat/"/>
        <updated>2018-04-11T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/thermostat/</id>
        <content type="html">&lt;p&gt;So at i3, one issue we have is people leaving the thermostats on high temepratures and going home.&lt;/p&gt;
&lt;p&gt;So we built our own into the automation system.&lt;/p&gt;
&lt;p&gt;At it&#39;s core, a thermostat is just a temperature sensor, some relays, some buttons, and a display.&lt;/p&gt;
&lt;p&gt;And lo, a thermostat:
&lt;img src=&quot;/assets/pages/thermostat/first_board.jpg&quot; alt=&quot;protoboard version&quot;&gt;
It just appeared, fully formed.&lt;/p&gt;
&lt;p&gt;Alternately, &lt;a href=&quot;http://abzman2k.wordpress.com/&quot;&gt;abzman&lt;/a&gt; made it.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://github.com/i3detroit/custom-mqtt-programs/blob/master/thermostat/thermostat.ino&quot;&gt;code&lt;/a&gt; was good fun to write.
Did you know that these things have complex behaviors? That are hard to keep in your head all at once?&lt;/p&gt;
&lt;p&gt;Who knew.&lt;/p&gt;
&lt;p&gt;Recommendation: Actually write down test procedures.&lt;/p&gt;
&lt;p&gt;In the end it seemed to work, and it was put into use:
&lt;img src=&quot;/assets/pages/thermostat/v1.jpg&quot; alt=&quot;v1 installed&quot;&gt;&lt;/p&gt;
&lt;p&gt;That one has a bug in the cooling side of the temperature control.
Don&#39;t tell anyone.
It&#39;ll be fixed when I merge the branches for the new boards which will be before summer so nobody should use the AC.
Hopefully.&lt;/p&gt;
&lt;p&gt;After we had the prototype working for a bit, I learned to use kicad.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/thermostat/boards.jpg&quot; alt=&quot;pcb version&quot;&gt;&lt;/p&gt;
&lt;p&gt;My first board turned out pretty well, considering.&lt;/p&gt;
&lt;p&gt;Issues:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;a few of the LEDs are backwards&lt;/li&gt;
&lt;li&gt;so the relay output is backwards, but our relays have NO and NC things so it&#39;s fine&lt;/li&gt;
&lt;li&gt;I pulled the i2c expander reset the wrong way, so we have to jumper one pin&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We have 4 thermostats at i3, but only one does AC. The plan is to use the same thermostat with the cool button not usable.&lt;/p&gt;
&lt;p&gt;Got a bunch of revisions to make written down, and even partially completed, but I&#39;m not sure we will need to make a new version.&lt;/p&gt;
&lt;p&gt;They&#39;re not installed at i3 yet, but I&#39;m testing one in my house.
Has not yet burned down.&lt;/p&gt;
&lt;p&gt;At least, it hadn&#39;t when I left this morning.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;UPDATE 2018-05-15:&lt;/p&gt;
&lt;p&gt;It was taken out of service a few weeks ago, once a flaw (possibly clear if you read closely) was discovered.&lt;/p&gt;
&lt;p&gt;If you put the heater on the normally closed contacts, they are normally closed.
If the thermostat loses power, it turns the heat on.&lt;/p&gt;
&lt;p&gt;And this is the story of why I was trying to work in a house that was 31C.&lt;/p&gt;
&lt;p&gt;Board redesign in progress.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>Linux MTA Email Forwarding with nullmailer</title>
        <link href="https://technicallycompetent.com/blog/linux-MTA-forwarding/"/>
        <updated>2018-03-07T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/linux-MTA-forwarding/</id>
        <content type="html">&lt;p&gt;Notifications are useful when services fail.&lt;/p&gt;
&lt;p&gt;Sadly, they often get sent to &lt;code&gt;root@127.0.0.1&lt;/code&gt;, where they don&#39;t get read because nobody sets up their mta.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://untroubled.org/nullmailer/&quot;&gt;nullmailer&lt;/a&gt; to the rescue.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo apt-get install nullmailer mailutils
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In &lt;code&gt;/etc/nullmailer/remotes&lt;/code&gt; put&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;74.125.206.108 smtp --port=465 --auth-login --ssl --user=yourSendingEmail@domain.tld --pass=iWonderIfQuotesWorkForSpaces --insecure
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The password comes from the app password thing, you need to setup two factor in the gmail account.&lt;/p&gt;
&lt;p&gt;To test this, try running&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;echo &amp;quot;error&amp;quot; | NULLMAILER_NAME=&amp;quot;Some Service&amp;quot; mail -s &amp;quot;issue with service&amp;quot; &amp;quot;yourReceivingEmail@domain.tld&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;NULLMAILER_NAME&lt;/code&gt; is optional, but will set from name instead of just being from yourSendingEmail@domain.tld&lt;/p&gt;
&lt;h2&gt;smartd configuration&lt;/h2&gt;
&lt;p&gt;That can also be used in cronjobs, or other reporting.&lt;/p&gt;
&lt;p&gt;In &lt;code&gt;/etc/smartd.conf&lt;/code&gt;, we set stuff to hopefully check &lt;code&gt;/dev/sda&lt;/code&gt; for issues and report them.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/dev/sda -M test -s S/../.././02 -H -C 0 -U 0 -m yourReceivingEmail@domain.tld
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This should send a test email on daemon start, and run a short test every day at 2:00.
The jury is still out as to if it sends a test email every day at 2:00.
The test should not report anything unless there are problems.&lt;/p&gt;
&lt;p&gt;I never figured out how to set the env var &lt;code&gt;NULLMAILER_NAME&lt;/code&gt;, so the from is just whatever email you&#39;re sending from, but it does report hostname in the topic.&lt;/p&gt;
&lt;p&gt;And then finally in &lt;code&gt;/etc/default/smartmontools&lt;/code&gt; uncomment &lt;code&gt;start_smartd=yes&lt;/code&gt; to autostart because that&#39;s how you do it I guess?&lt;/p&gt;
&lt;h2&gt;tmpfs&lt;/h2&gt;
&lt;p&gt;There is an issue with this if the hard drive fails and gets mounted read only, you don&#39;t get any email from smartd about how the hard drive has issues.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://serverfault.com/questions/961168/sending-email-with-read-only-root-drive-by-using-a-tmpfs-for-var-spool-nullmail&quot;&gt;https://serverfault.com/questions/961168/sending-email-with-read-only-root-drive-by-using-a-tmpfs-for-var-spool-nullmail&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;fstab:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;tmpfs /var/spool/nullmailer tmpfs nodev,nosuid,noexec,nodiratime,size=5M   0 0
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Somehow run this before nullmailer daemon:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo mkdir /var/spool/nullmailer/tmp
sudo mkdir /var/spool/nullmailer/queue
sudo chown -R mail:root /var/spool/nullmailer/
sudo chmod 755 /var/spool/nullmailer/
sudo chmod 750 /var/spool/nullmailer/queue/
sudo chmod 750 /var/spool/nullmailer/tmp/
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now it&#39;s in a tmpfs!&lt;/p&gt;
&lt;p&gt;Full script:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!/bin/bash
set -xeu

if [[ $EUID != 0 ]] ; then
  echo This must be run as root!
  exit 1
fi

tee /etc/systemd/system/nullmailer-mount.service &amp;gt;/dev/null &amp;lt;&amp;lt;EOF
[Unit]
Description=populate /var/spool/nullmailer/
Before=nullmailer.service

[Service]
Type=oneshot
ExecStart=systemd-tmpfiles --create nullmailer.conf
ExecStart=mkdir -p /var/spool/nullmailer/tmp
ExecStart=mkdir -p /var/spool/nullmailer/queue
ExecStart=chown -R mail:root /var/spool/nullmailer/
ExecStart=chmod 755 /var/spool/nullmailer/
ExecStart=chmod 750 /var/spool/nullmailer/queue/
ExecStart=chmod 750 /var/spool/nullmailer/tmp/

[Install]
WantedBy=nullmailer.service
EOF

if ! grep nullmailer /etc/fstab&amp;gt;/dev/null ; then
  sudo tee -a /etc/fstab &amp;gt;/dev/null &amp;lt;&amp;lt;FSTAB

  tmpfs /var/spool/nullmailer tmpfs nodev,nosuid,noexec,nodiratime,size=5M   0 0
FSTAB
fi

mkdir -p /var/spool/nullmailer
mount -a


apt-get install nullmailer mailutils -y
systemctl enable nullmailer-mount.service

tee /etc/nullmailer/remotes &amp;gt;/dev/null &amp;lt;&amp;lt;EOF
74.125.206.108 smtp --port=465 --auth-login --ssl --user=yourSendingEmail@domain.tld --pass=iWonderIfQuotesWorkForSpaces --insecure
EOF

systemctl restart nullmailer

echo &amp;quot;testing on $HOSTNAME on $(date --iso=seconds)&amp;quot; | NULLMAILER_NAME=&amp;quot;Nullmailer Setup Script on $HOSTNAME&amp;quot; mail -s &amp;quot;test email&amp;quot; &amp;quot;yourEmail@domain.tld&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;hr&gt;
&lt;ul&gt;
&lt;li&gt;This was updated 2019-04-02 when I added the tmpfs stuff and rewrote parts.&lt;/li&gt;
&lt;li&gt;This was updated 2019-07-24 with setup script.&lt;/li&gt;
&lt;li&gt;This was updated 2021-10-27 with a better nullmailer-mount unit&lt;/li&gt;
&lt;li&gt;2021-10-28 better mail test&lt;/li&gt;
&lt;li&gt;2022-06-06 error checking in script&lt;/li&gt;
&lt;/ul&gt;
</content>
    </entry>
    
    <entry>
        <title>USB Thinkpad Laptop Keyboard</title>
        <link href="https://technicallycompetent.com/blog/TMK-thinkpad-keyboard/"/>
        <updated>2017-10-10T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/TMK-thinkpad-keyboard/</id>
        <content type="html">&lt;p&gt;One thing I&#39;ve wanted for a while is a USB keyboard with a trackpoint.&lt;/p&gt;
&lt;p&gt;I made a good start with an atmega32u4 on an arduino micro board.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://smile.amazon.com/ThinkPad-USB-Keyboard-with-TrackPoint/dp/B002ONCC6G&quot;&gt;It exists as a product&lt;/a&gt;.
80USD if you&#39;re lucky, currently 300.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://flashandrc.wordpress.com/category/thinkpad-keyboard/&quot;&gt;It also exists as a dead project&lt;/a&gt;.
rampadc was nice enough to open source it, which was new since the last time I checked on that project.
Sadly, they made some (self-admittedly) poor design choices, so we&#39;re only using the very very helpful references they provide.&lt;/p&gt;
&lt;p&gt;The first step was finding a connector for the keyboard.
It was identified as a JAE AA01B-S040VA1 on &lt;a href=&quot;https://electronics.stackexchange.com/a/72550&quot;&gt;electronics.stackexchange&lt;/a&gt;, with some parts listed as substitutes.
Chasing substitute for substitute lead to the &lt;a href=&quot;https://www.digikey.com/product-detail/en/molex-llc/0543630489/WM6787CT-ND/3044201&quot;&gt;WM6787CT-ND&lt;/a&gt; which looked promising, and after ordering a few, found that it does fit.&lt;/p&gt;
&lt;p&gt;My first surface mount soldering ever:
&lt;img src=&quot;/assets/pages/tmk-thinkpad/t60-adapter.jpg&quot; alt=&quot;thinkpad keyboard breakout&quot;&gt;
Beautiful, isn&#39;t it.&lt;/p&gt;
&lt;p&gt;I lost the board files, but you can &lt;a href=&quot;https://oshpark.com/shared_projects/8JzemyDh&quot;&gt;order it here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Moving onwards to firmware to run the keyboard, I chose &lt;a href=&quot;https://github.com/tmk/tmk_keyboard&quot;&gt;TMK&lt;/a&gt;, as it seems to be the best open-source solution.&lt;/p&gt;
&lt;p&gt;Each of their examples comes with a few &amp;quot;variants&amp;quot;, such as vusb or lufa.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;a href=&quot;https://www.obdev.at/products/vusb/index.html&quot;&gt;V-USB&lt;/a&gt; is a software-only implementation of a low-speed USB device for Atmel’s AVR® microcontrollers, making it possible to build USB hardware with almost any AVR® microcontroller, not requiring any additional chip.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;a href=&quot;http://www.fourwalledcubicle.com/LUFA.php&quot;&gt;LUFA&lt;/a&gt; (Lightweight USB Framework for AVRs, formerly known as MyUSB) is my first foray into the world of USB. It is an open-source complete USB stack for the USB-enabled Atmel AVR8 and (some of the) AVR32 microcontroller series, released under the permissive MIT License (see documentation or project source for full license details). The complete line of Atmel USB AVRs and USB AVR boards are supported by the library, as are any custom user boards, via custom board hardware drivers supplied by the user.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;TMK recommends using LUFA going forward, if possible.&lt;/p&gt;
&lt;p&gt;I was told very clearly a few hours into trying to use make the USB hardware for v-usb it was a poor choice.&lt;/p&gt;
&lt;p&gt;Explored microcontroller options, limited by what I had on on hand&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;bare atmega328p
&lt;ul&gt;
&lt;li&gt;Needs external clock, and external USB hardware. Got the external clock working, USB hardware is what was hard.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;arduino pro micro
&lt;ul&gt;
&lt;li&gt;atmega32u4, so built in usb hardware&lt;/li&gt;
&lt;li&gt;not enough pins, but got the onekey TMK example running here first&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;arduino micro
&lt;ul&gt;
&lt;li&gt;atmega32u4&lt;/li&gt;
&lt;li&gt;has 24 pins, with a 25th if you want to solder to the tx led&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;http://1.bp.blogspot.com/-xqhL0OrJcxo/VJhVxUabhCI/AAAAAAABEVk/loDafkdqLxM/s1600/micro_pinout.png&quot; alt=&quot;arduino micro pinout&quot;&gt;
This is a useful image.
More boards and processor pinouts archived at &lt;a href=&quot;https://www.robot-italy.com/en/blog/progetti/450&quot;&gt;RobotItaly&lt;/a&gt; which is also on archive.org.&lt;/p&gt;
&lt;p&gt;The person who made this(&lt;a href=&quot;http://pighixxx.com&quot;&gt;http://pighixxx.com&lt;/a&gt;) has a &lt;a href=&quot;http://www.pighixxx.com/test/portfolio-items/micro/?portfolioID=314&quot;&gt;newer design&lt;/a&gt;.
I like this design more, and I dislike their website, it&#39;s trying to be animatd, and have a fancy style, but it&#39;s just hard to use and slow to load.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;avrdude -v -c avr109 -p m32u4 -P /dev/ttyACM2 -U flash:w:file.hex&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;-c avr109&lt;/code&gt; is the programmer, seems to be the one used for general &amp;quot;chip has USB stuff, it will deal&amp;quot;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-p m32u4&lt;/code&gt; sets the device being programmed, an atmega 32u4&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-P /dev/ttyACM2&lt;/code&gt; is just the port it got on my computer&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-U flash whatever&lt;/code&gt; flashes a file to the device. You can also set or read fuses here.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It is now a keyboard that presses &#39;a&#39; if you poke the right pins.
I did change which pin it used, due to some unmemorable part of getting it to work.&lt;/p&gt;
&lt;p&gt;Now, looking at the key matrix.&lt;/p&gt;
&lt;p&gt;In the style of the TMX example I was using, I made an ascii keyboard diagram, it&#39;ll be helpful mostly later when there is more than one &amp;quot;layer&amp;quot;.
&lt;img src=&quot;/assets/pages/tmk-thinkpad/ascii-layout.png&quot; alt=&quot;ascii keyboard&quot;&gt;&lt;/p&gt;
&lt;p&gt;A layer is a keymap, and you can have multiple layers.
So on this keyboard, num lock would enable a different layer, see how &lt;code&gt;890 UIOP JKL; M,./&lt;/code&gt; have numbers and numbers on them that match a numpad?
&lt;img src=&quot;https://www.replacementlaptopkeys.com/product_images/images/ibm/thinkpad_r60_laptop_keyboard_key.jpg&quot; alt=&quot;The keyboard&quot;&gt;
The numlock turns those on instead of the &amp;quot;normal&amp;quot; keys. That is using multiple layers.&lt;/p&gt;
&lt;p&gt;Rampadc provided the only data I could find on this matrix,
&lt;img src=&quot;https://flashandrc.files.wordpress.com/2014/08/fil3zp5hw4ojq7d-large.jpg&quot; alt=&quot;keyboard-matrix&quot;&gt;
as well as this pinout for the keyboard
&lt;img src=&quot;https://cdn.instructables.com/ORIG/FG4/BSFY/HUFW65ZZ/FG4BSFYHUFW65ZZ.png&quot; alt=&quot;keyboard-pinout&quot;&gt;
They kindly also provide the matrix in 2d array format, fairly close to what TMK expects in &lt;a href=&quot;https://github.com/rampadc/arduino-thinkpadkb-usb/blob/master/MicroThinkPadAdapter/MicroThinkPadAdapter.ino#L78&quot;&gt;their github repo&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;They label it as 16x8 rows/columns, and they power each row and read the column.
I use it as 8x16 pins, as it works better with the example matrix reading code from the &lt;a href=&quot;https://github.com/tmk/tmk_keyboard/blob/master/keyboard/hbkb&quot;&gt;Happy Bucking Spring Keyboard&lt;/a&gt;.
Having to read 8 inputs is a bit lucky, as each port is 8 pins(up to, not all pins are existing, or maybe just not exposed).
Means we can just look at &lt;code&gt;PINB&lt;/code&gt;, which is the state of all 8 pins set to input to read the entire row.&lt;/p&gt;
&lt;p&gt;Fun fact: AREF != 3V3, it will not power an i2c digital IO expander no matter how much you try to debug the i2c lines with an oscilloscope.&lt;/p&gt;
&lt;p&gt;Without an expander, there are 24 pins, or 16+8, or just enough for the matrix, and nothing else, which means no trackpoint this time around.&lt;/p&gt;
&lt;p&gt;Wire it up, write the code to scan the matrix, and pray to the dark AVR gods.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/tmk-thinkpad/tangle.jpg&quot; alt=&quot;tangle-of-wire-final-product&quot;&gt;&lt;/p&gt;
&lt;p&gt;It actually worked, the gods have answered.&lt;/p&gt;
&lt;p&gt;At least, qwerty works.
Backspace and &#39;&#92;&#39; are switched, and a few other small keymapping issues.&lt;/p&gt;
&lt;p&gt;After the easy remapping fixes, there are a few larger remaining problems:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Super and menu are left alt and right alt respectively, even if alt is not defined anywhere in the keymap.&lt;/li&gt;
&lt;li&gt;Even setting every no-op in the matrix, the alt keys do nothing.&lt;/li&gt;
&lt;li&gt;Fn sends several key presses, even though the pinouts say fn should have it&#39;s own pin, pin 1 the same way power does.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/mtfurlan/tmk_keyboard/tree/personalChanges/keyboard/t61&quot;&gt;The Code&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;make -f Makefile.lufa clean &amp;amp;&amp;amp; make -f Makefile.lufa&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;avrdude -v -c avr109 -p m32u4 -P /dev/ttyACM2 -U flash:w:t61_lufa.hex&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Next steps:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Pick an avr chip with more IO, do a custom board for it.&lt;/li&gt;
&lt;li&gt;Figure out what&#39;s up with the matrix that makes alt wrong, and super/page always alt.&lt;/li&gt;
&lt;li&gt;Test trackpad, shouldn&#39;t be hard there is example code.&lt;/li&gt;
&lt;li&gt;fix the fn key, and start using TMK keymap layers.&lt;/li&gt;
&lt;li&gt;num lock layer.&lt;/li&gt;
&lt;/ul&gt;
</content>
    </entry>
    
    <entry>
        <title>Arduino Media Keypad</title>
        <link href="https://technicallycompetent.com/blog/arduino-media-keypad/"/>
        <updated>2016-07-10T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/arduino-media-keypad/</id>
        <content type="html">&lt;p&gt;I wanted a small programmable keypad.
It&#39;s primary purpose was to be media keys for a model M that needed to be cleaned and bolt modded, but now that I use a (different) model M, I finished the project.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/arduino-keypad/arduinoKeypad.jpg&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;Take a keyboard tester, add an arduino pro micro, and boom: Programmable keyboard.&lt;/p&gt;
&lt;p&gt;Code is &lt;a href=&quot;https://github.com/mtfurlan/arduinoKeypad&quot;&gt;available on github&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Hardware side:&lt;/p&gt;
&lt;p&gt;Wire the buttons to the arduino, in whatever order is convenient at the time.
&lt;img src=&quot;/assets/pages/arduino-keypad/arduinoKeypadWires.jpg&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;Carve out a hole in the side of the box, and glue the arduino in.
&lt;img src=&quot;/assets/pages/arduino-keypad/arduinoKeypadTogether.jpg&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;And then the hardware side is done!&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/arduino-keypad/arduinoKeypadDone.jpg&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;The software side is a bit silly. The arduino keyboard library does not support sending arbitrary HID codes, because fuck you. So you need to either modify the arduino library, which is what I did for the initial demo, or make a remote library, which is what is currently there.
It should be noted that all credit for the remote library goes to Stefan Jones, whose code I adapted.&lt;/p&gt;
&lt;p&gt;So my code, you define a list of pins, and a list of functions for that pin.
The loop runs a bit of debouncing, and if it&#39;s been pressed runs the function for that key. You need to define that function, but you get the choice of the arduino libraries that do keyboard keys, and the remote library that does media keys like volume up/down.&lt;/p&gt;
&lt;p&gt;Also provided is an example that will open hackaday, in my blatent attempt to get something onto hackaday.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>Tearing Down a Lafayette 17-02372 flip clock radio</title>
        <link href="https://technicallycompetent.com/blog/teardown-flip-clock/"/>
        <updated>2016-01-27T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/teardown-flip-clock/</id>
        <content type="html">&lt;p&gt;So I wanted the flip clock, and took pictures because the last flip clock we found didn’t quite make sense as to how it went together, so this may help some poor fuck in the future.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/flipclock/flipclockFront.jpg&quot; alt=&quot;front of clock&quot;&gt;&lt;/p&gt;
&lt;p&gt;So this is the Lafayette 17-02372.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/flipclock/flipclockSchematic.jpg&quot; alt=&quot;schematic&quot;&gt;
&lt;img src=&quot;/assets/pages/flipclock/flipclockModel.jpg&quot; alt=&quot;model plate&quot;&gt;&lt;/p&gt;
&lt;p&gt;Thought it was nice of them to put a circuit in, sorry the picture is a bit terrible. Amusing to me they list the number of components inside.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/flipclock/flipclock.jpg&quot; alt=&quot;the mechanism&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/flipclock/flipclockGears.jpg&quot; alt=&quot;gears&quot;&gt;&lt;/p&gt;
&lt;p&gt;So this part is cool, it’s the sleep function. I took a video of how it works, because I’m shit at description. TODO: Insert.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/flipclock/flipclockWires.jpg&quot; alt=&quot;the original wiring&quot;&gt;&lt;/p&gt;
&lt;p&gt;Now what the fuck is this bullshit, a wire is wrapped around the AC in, and goes into the circuit.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/flipclock/flipclockPully1.jpg&quot; alt=&quot;pully&quot;&gt;
&lt;img src=&quot;/assets/pages/flipclock/flipclockPully2.jpg&quot; alt=&quot;pully&quot;&gt;&lt;/p&gt;
&lt;p&gt;It’s just rope and wheels! This should have been expected, but it’s cool.&lt;/p&gt;
&lt;p&gt;So yeah, completely void of anything innovative, but scrapping things still makes me feel a wee bit bad, so documenting what it was makes me feel a bit better.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
        <title>Hard Drive Power Supply</title>
        <link href="https://technicallycompetent.com/blog/hard-drive-power-supply/"/>
        <updated>2016-01-13T00:00:00Z</updated>
        <id>https://technicallycompetent.com/blog/hard-drive-power-supply/</id>
        <content type="html">&lt;p&gt;Really more of a test post to get this blog off the ground, but today I made a power supply for a hard drive out of some 12v power brick by soldering in a LM78M05 to add a 5v rail.&lt;/p&gt;
&lt;p&gt;The package on the right side closest to the camera is the LM78M05.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/hard-drive-power-supply/IMGP0020.JPG&quot; alt=&quot;power brick with wires for hard drive connector coming out&quot;&gt;&lt;/p&gt;
&lt;p&gt;At this point, I ran it for a bit , and it seemed to get hot, and I noticed that the LM78M05 had a bit of a bad connection to the heatsink. So I added a bunch of thermal paste.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/hard-drive-power-supply/IMGP0026.JPG&quot; alt=&quot;strain relief&quot;&gt;&lt;/p&gt;
&lt;p&gt;Closed up up, and it seems to work fine.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/assets/pages/hard-drive-power-supply/IMGP0027.JPG&quot; alt=&quot;all packaged up and in use&quot;&gt;&lt;/p&gt;
&lt;p&gt;Totally not a pile of hack.&lt;/p&gt;
</content>
    </entry>
</feed>
