Tuya Smart Home Temperature Monitor + Python (tinytuya)

Why look go outside and check the temperature if you can automate it and use Python?

I purchased this inexpensive wifi-enabled temperature monitor from Aliexpress for approx $20 CAD. The goal was to log the temperature and humidty throughout the seasons and make a graph at the end of the year.

During the setup of the device, you have to use their cloud smart home app. You can only guess what they do with your data (hey, maybe they’ll see how cold it gets here in winter and feel bad for me). You’ll have to use the app to connect the developer account to your device.

Tags

Merge big CSV files with Pandas and Python

I deal with large CSV at work, mostly database dumps. Google Sheets and Numbers/Excel just can't keep up with formula changes for 300k+ lines. What do we do? We use Python.

The use case here is replicating a the VLOOKUP function with a left join. We want to get the matching criteria from our referenced CSV file, but only the matching (otherwise that would be a full outer join).

Here's what our data looks like:

We want to look up the lat/long in our reference file and join on zip code. Here's what that data looks like:

Note the matching "zip" column names.

Here's the code:

Tags

Fix Choppy/Skipping audio in Mac OS Maverick

Sometimes during a Facetime call or watching your favorite dumb crime show on some sketchy Russian streaming site, your audio sounds like it's farting through a tin can. Sometimes choppy and not very clear, whatever audio that's playing doesn't sound right.



One way to fix it is by killing Core Audio, which is responsible for processing audio.



 

sudo killall coreaudiod

 

Tags

Getting Old Games to Work: Age of Mythology under Virtualbox (mac OS 11.15)

Here's a short little write up on getting Age of Mythology (great break down by staff here )running under Virtualbox. I'm running mac OS 10.15.4 but this should work under all platforms using VirtualBox.

Afteri some trial and error, I  found that VirtualBox 6.1 wasn't working with 3D acceleration under XP (apparently it's been removed) so I had to downgrade to 5.2. 

Tags

Linux 4.15.2 on SnackLinux

Quick update to SnackLinux, rolled out Linux 4.15.2 with Busybox 1.28.0. Also switched over to x86_64 only (for now at least) since it simplifies a lot of things. I removed the need to staticly link everything and get rid of that niche, since a few other smaller distros cover that (Alpine Linux for example). Again, this simplifies building packages and running into less issues. Check it out on Github for build instructions, or the getting started page on getting SnackLinux running.

Create an ad blocking VPN for mobile use

Ads on your mobile device can use a fair chunk of your monthly data, so I set out to create a way to disable them while browsing. If you happen to have a rooted Android phone, AdAway is the easiest solution that I have found. Another solution is creating your own DNS server, to have all traffic to unwanted domains be unresolved. While that's great, one can only set the DNS servers manually for wifi, not for mobile data (3G/LTE). The fix this issue, what I did was create an OpenVPN server with Bind9 zones to block unwanted domains.

 

To bootstrap installing VPN, I used this script to quickly set up an OpenVPN server. Its all very straight forward and will prompt for a few options.

If all went well, it will generate a client profile for you to use (.ovpn). Next, I installed bind9 and followed this tutorial. Once that is all set up, you'll have an ad blocking DNS server! Only thing left to do is force clients to use the DNS.

Remote code execution with Hitron CGNM-2250

Edit: This has been fixed in the latest firmare update 4.5.10.25

The routers that you receive from your ISP are almost always garbage: not many options to configure and pitiful wifi range. The router/modem that Shaw customers receive is the Hitron CGNM-2250 thankfully isn't completely terrible, 802.11ac plus gigabit ports. I was poking about and researching the model and came upon an exploit for a similar model version for remote code execution. The CGNM-2250 is vulnerable as well, for reference my software version is 4.5.8.20 with hardware version 1A. The input for the ping utility through the web interface isn't sanitized so you can enter arbitrary input. I discovered that it has a few basic utilities, including Dropbear.