Posts tagged python
Suppose a hole is drilled underground into the back of a drift. The hole is drilled from a pivot point at a particular height from the floor. Typically this height is a characteristic of the drill. In itself, this is relatively moderate and quite standard in underground mining. Sometimes, the drill may break down, and they need to use a different drill. Suppose further that the alternate drill has a different pivot height from the floor. How can we determine where the new pivot point of each hole would be without re-designing the pattern? To narrow the scope a little, how can we determine the new horizontal distance of the pivot point from the reference line?
The try/except block has an option else clause. That
else clause is executed if an exception is not raised in the block. Loops, also have an else clause. I never thought that I would actually need to use those and thought they were superfluous. Today, I used both. In the following code, I wanted to create a folder, but wanted to make sure that I didn’t create a duplicate folder (i.e. I didn’t want to write files into the same folder).
This tutorial is about installing the latest versions of python from the source into the users home folder as opposed to a server-wide install. Normally /opt/python/python-3.6.1 would be the best choice for the installation. In this case, installing locally is fine as well.
I have a captive portal setup on my PFSense which allows my laptops and various other devices to connect through wifi. I was looking at the DHCP logs provided by PFsense the other day and realized that I needed a way to verify the macs that were requesting ip addresses. I put together a python script that parses the log and attempts to match the mac addresses that I know with the ones in the log. Enjoy the code and note that the macs have been changed.
A while back I finished a pretty good book on python Python Scripting for Computational Science by Hans Petter Langtangen (link). It was a pretty good introduction to python. I really liked the slant towards the sciences and engineering. The problem sets were good.