Friday 2018-10-05

Here's a simple exercise I did using Python2 and Leonard Richardson's Beautiful Soup 4 to quickly and cleanly scrape my local National Weather Service data. I use this data for some local code on my LAN that displays the current temperature and seven day forecast to a constantly running screen on a dock. BeautifulSoup in Python makes scraping webpages for data trivial and actually, quite fun. Definitely a ton more fun than a DIY solution.

''' Get the weather data - requires dpkg python-bs4'''

import urllib
from bs4 import BeautifulSoup

myUrl = 'https://forecast.weather.gov/MapClick.php?lat=30.40&lon=-97.75'

destfile = open('/tmp/getweather.txt','w')

server = urllib.urlopen(myUrl)
wdata = server.read()

soup = BeautifulSoup(wdata, "html.parser")

curconditions = soup.find('p', class_="myforecast-current")
curcond = curconditions.contents[0]

curdegrees = soup.find('p', class_="myforecast-current-lrg")
curdeg = curdegrees.contents[0]

humidity = soup.find('td', class_="text-right")
hum = humidity.find_next('td')

fl = soup.find_all('p', class_="period-name")

destfile.write(curdeg.encode('ascii', 'ignore').decode('ascii') + '<br>' + '\n')
destfile.write(curcond + '<br>' + '\n')
destfile.write(hum.string + '<br>' + '\n')
destfile.write('<br>' + '\n')

for i in fl:
	periodname = i
	nextline = i.find_next('p')
	convertstring = str(nextline)
	splitstring = convertstring.split('title=')
	finalstring = splitstring[-1].split('/')


Monday 2018-09-17

I've been meaning to write a small blog entry on Cameron Kaiser's HUE.pl command line project that I've been using for home automation of my Philips HUE multi-color LED bulbs. It's written in Perl5 and has a dependency of cURL7 which makes it ridiculously portable. I use it with everything from cron(8) (now known as systemd timers) to simple PHP code snippets I embed in my LAN web services. Sure, the HUE app for your smart phone is nice, but you get a lot more control if you code up what you want yourself and bypass the app and speak directly to the HUE bridge.

You can read more about it and download the code from here.

Damn good stuff if I say so myself.

Wednesday 2018-09-12

With Hurricane Florence set to make landfall tomorrow morning, I am keeping my friends in Charlotte, NC and the surrounding areas in my thoughts. The extreme weather changes are something I do not miss from the years I lived in the North East and South East. Yes, it gets hot here in Austin, Texas, but I find it isn't so bad as long as I keep hydrated and fit. And even when the afternoons are 100F and above, the mornings are still quite cool with very low humidity.

If I do miss anything about the North East, it would be the vast mountain forests and many rivers that flow through it.

Tuesday 2018-09-11

Network Manager in XUbuntu will override your sysctl.conf. I found this to be true when I issue the disable setting for IPv6 in XUbuntu's default image for their Bionic release:



So, why does this matter? Well, beyond the effort of digging deep into what ultimately controls your network settings on the system which can waste valuable time and effort, this could be thought of as a security risk for someone not realizing that, by default, SSH listens on both IPv4 and IPv6.

# netstat -tuapn | grep LISTEN
tcp 0 0* LISTEN 703/systemd-resolve
tcp 0 0* LISTEN 878/sshd
tcp 0 0* LISTEN 804/cupsd
tcp6 0 0 :::22 :::* LISTEN 878/sshd

Not a huge security risk, but something I think a new user to Linux should be aware of. Since we are seeing the emergence of this top-down approach to configuration, where giving a kernel a parameter correctly through the subsystem and ultimately having it overridden by a user-land application, this should be something a new sysadmin should be aware of when dealing with the integration of Network Manager and systemd into the system they are ultimately responsible for.

Sunday 2018-09-09

It's been a long time since I've updated a blog. My Son, Matthew Liu Bevilacqua was born on June 9th, 2017 at Saint David's in North West Austin, Texas. I've placed photos of him linked above since then. He amazes me, watching his development, the tiny parts of his personality that are just starting to shine through, his love of food and his naturally kind social nature. Much of this reminds me of what I've read over the years of how we are born good, kind and sharing. It's truly something to experience from my perspective as a new Father.

Communication is also something I've noticed as he tries to express his ideas with very few ways learned just yet. Pointing to his mouth for food. Walking to his high chair. Crying. All ways of expression because that's all he knows of. This is a good lesson to learn and revisit learning from time to time for myself. That communication takes constant practice and patience. Conveying ideas is only as good as how I know too.

I've found time to completely redo my Linode from the ground up using Arch Linux. I can say that I'm very impressed with Arch Linux's 'Keep it Simple' philosophy. Currently, there is no other distro that is doing a better job at implementing systemd(1) correctly. And so far, this has been a wonderful way to get my feet wet doing things in a very systemd-like fashion. They also have a very active community and some excellently constructed documentation on their wiki.