Note: I don’t yet have extensive experience on NetBox 2.9.x but these have been shown useful in earlier NetBox versions. I’ll update the page later if I find some further comments about the performance in NetBox 2.9.x. Speeding up fetching the devices Fetching lots of devices (hundreds or thousands, depending on the environment) with netbox.dcim.devices.all() […]
Pathlib in Python
I found pathlib standard library in Python just recently. It is a full set of classes, methods, properties and operators that make it very easy to work with files, directories and paths in operating system-independent way. You all do remember that not all filesystems use / (slash) as the path separator…? I had a specific […]
Reading CSV Files With Python
It’s not rare that as a technical worker you get some data in CSV format (comma-separated values), and the data has to be read and interpreted some way. MS Excel is the default tool for some to handle those cases, but I’m one of those that never got used to using Excel in external data […]
Using Pynetbox
Pynetbox is a Python API client library for NetBox. Here are some basic examples of using pynetbox. In this page: Getting started Creating and changing something Retrieving objects Deleting objects Handling object status Using tags Referring to other objects Here we assume that you already have NetBox running (I have NetBox 2.8.6 in this demo), […]
Subcommands with Argument Parsing in Python
An example how subcommands can be used with argparse module: Sample output: markku@btest:~/temp$ python3 argtest.py usage: argtest.py [-h] [-c CONFIG_FILE] {update-device,add-vlan} … positional arguments: {update-device,add-vlan} update-device update device data add-vlan add a VLAN optional arguments: -h, –help show this help message and exit -c CONFIG_FILE, –config-file CONFIG_FILE specify the configuration file to read (default: argtest.cfg) […]
File Transfers and the Cloud (Or How Latency Affects Your Application)
In this post I’ll discuss a reality that is often overlooked when talking about using cloud services: Network latency matters. Here is the test network: On Your Marks Let’s first imagine that the hosts HostA and HostB are near each other, like in the same data center. The latency between the hosts is negligible: markku@HostA:/mnt$ […]
Set Paste Mode in Vim
When pasting indented data to Vim, set it to paste mode: :set paste To go back to normal mode: :set nopaste
Lenovo ThinkBook 13s Fan Problems
Note: This is a post that will hopefully be updated when more information is available. Currently my opinion is: don’t buy this model. Update on 8th of July 2020: No changes, no updates issued by Lenovo, still problems with the fan and the power settings. For example, setting the fan settings manually in Lenovo Vantage […]
LDAPS Problem: Can’t contact LDAP server (-1)
LDAP authentication problem in the customer environment: The error message was received right after entering the password. Tshark says: 1 0.000000000 192.168.99.200 → 10.10.10.10 TCP 74 44780 → 3269 [SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM=1 TSval=2891116193 TSecr=0 WS=128 2 0.001225814 10.10.10.10 → 192.168.99.200 TCP 74 3269 → 44780 [SYN, ACK] Seq=0 Ack=1 Win=8192 Len=0 MSS=1460 […]
How to Decrypt TLS Traffic with Wireshark
This is a small note to keep the links to posts by Peter Wu: Extract pre-master keys from an OpenSSL application Extracting openssl pre-master secret from apache2 Example in Debian Buster: With the keys saved by that process (and doing the packet capture at the same time, in either server or client side), you can […]