Collect bitcoin price data with python and Coinbase

Cryptocurrencies have been back on the popular agenda lately, thanks mostly to the surging value of Bitcoin. I have been interested, but not massively invested in cryptocurrency for many years. If I had the courage to buy and hold all those years ago, I might be writing to you from a beach – I assure you, this is not the case! I have been getting into InfluxDB lately and its fantastic ability to store heaps of time series data. Well, using python and Coinbase, I am going to show you how to collect bitcoin (and other crypto assets) price data and store it in InfluxDB… then we are going to make some neat panels in Grafana to help us realise our data. This is going to be a longer write up than most, so here is here are links to each section: ...

2 February 2021 · 6 min · Tom

Writing to an InfluxDB server with Python3

A quick GitHub gist for anyone looking to write to an InfluxDB server with Python3. This is a generic function that accepts three inputs; as an example, I am using temperature data in degrees Celsius. Turning DHT11 readings into beautiful graphs in Grafana Once you have your data in influxDB, a great way to visualise it is using Grafana. I hope to bring you more posts in the future about visualising your python data with Grafana. ...

19 January 2021 · 1 min · Tom

Fortigate: AP-Bridge with a hardware switch

Following on from a previous post on how to setup a VLAN on a Fortigate hardware switch, this post is going to explain how we can link an AP-bridge SSID to a hardware switch and VLAN. For the most part, the only reference material you will need to complete this configuration can be found here: https://docs.fortinet.com/document/fortiap/6.4.0/fortiwifi-and-fortiap-cookbook/252439/configuring-the-fortigate-interface-to-manage-fortiap-units. However, if you have been working with Fortigates and by extension FortiOS for quite some time, you may be wonder where the CAPWAP option vanished to? Fortinet adopted this into the security fabric naming convention. CAPWAP has even been replaced in the CLI by ‘fabric’. ...

17 January 2021 · 2 min · Tom

Fortigate: Add a VLAN to a hardware switch

In this post, we are going to discuss how to add a VLAN to a hardware (sometimes referred to as physical) switch or interface on a Fortigate. It is worth noting that I actually do my testing on a FortiWifi, so I can assure you that this also applies there too. I will be focusing on the configuration which is relevant to FortiOS v6.0 and above, so your millage vary between versions. However, you need can usually be found over at the Fortinet Handbook: https://docs.fortinet.com/product/fortigate/6.0. ...

9 January 2021 · 4 min · Tom

Debian 10 - How to upgrade python 3.7 to python 3.9

I have covered this a number of times in the past and the posts have proved popular and useful to many. So, here is my guide for updating to the latest version of Python 3 (3.9) on Debian 10 Buster. To clarify the purpose of this guide, Debian 10 ships with Python 2 (2.7) and Python 3 (3.7) installed at my time of writing. For those wishing to upgrade from python 3.7.X to 3.8.X or 3.9.X, this is the guide for you. If you are trying to configure python 3.7 as your default interpreter when you call ‘python‘, try this: CHANGING THE DEFAULT PYTHON VERSION IN DEBIAN. This method involves using the ‘update-alternatives‘ command. We will be using a similar method in this guide, however this time we only do so to give 3.9.X a higher priority to 3.7.X, rather than uninstalling older versions. ...

5 January 2021 · 3 min · Tom

Calculating compound interest with Python 3

Compound stonks only go up! I have a growing interest in finance and analytics, so it felt like a great idea to start creating my own set of financial tools with Python. This article will explain how I created a simple but effective script for calculating compound interest with Python. I wrote this in Python 3 (as all new Python projects should be from now onwards), but the library dependencies are very lightweight, making this something that could easily be re-written from Python 2. ...

3 January 2021 · 3 min · Tom

How to force the Windows 10 20H2 update

Note: Windows 10 mainstream support ends October 2025. If you’re on Windows 10, consider upgrading to Windows 11 rather than installing older feature updates. Are you still waiting for your Windows 10 computer to receive the 20H2 update? Here is how to force the windows 10 20H2 update. For many, the update may already available the Windows 10 update settings: The 20H2 update when available in the Windows 10 update settings. Microsoft is staggering the over-the-air update as they usually do with new major releases. However if you are tired of hitting ‘check for updates’ in the windows 10 update settings, there is a way to press the issue: ...

2 January 2021 · 2 min · Tom

How to invoke UAC in a Windows Batch script

Here is my quick and easy way to raise the privilage level of a Windows Batch script; allowing you to run your code at an administrator level. This is not a new question and has been asked many times on StackOverflow forums. The best answer I was able to find was the following from dbenham: https://stackoverflow.com/questions/1894967/how-to-request-administrator-access-inside-a-batch-file/10052222#10052222 That being said there are many ways to skin this cat, so I came up with my own method, all be it derivative. The main difference in the following code is that you will always get a UAC prompt in my variant of the code, even if you are currently running it as an account that is a member of the local administrators group: ...

29 December 2020 · 2 min · Tom

How To call a bash command with variables in Python

A quick Google of the above only seemed to give me answers for the inverse, calling a python script from a bash shell and handing it variables. At least, the first 3 results showed this and I’m probably not alone when it comes to scrolling down past the StackOverflow articles. So I am had to go it alone and the way that I figured out how to call a bash command with variables in Python (3), is a total hack… But it works. This is commonly referred to as ‘getting the job done’ code. ...

28 December 2020 · 3 min · Tom

Monitor your public IP address with Python

This is my lean and effective way to monitor your public IP address with Python, specifically Python3. The script – code and GitHub link below – runs on a continuous loop, which I covered in a previous post: here. NOTE: this code is reliant on the dig system command – so this essentially only work on a unix based system. I was running this on a Debian install. import os import subprocess import re import time print("start monitor vpn monitor check") expected_IP: "0.0.0.0" # ENTER YOUR EXPECTED PUBLIC IPv4 ADDRESS HERE current_IP: subprocess.check_output("dig +short myip.opendns.com @resolver1.opendns.com", shell=True) try: while True: if expected_IP in str(current_IP): print("IPs Match - Things are normal") else: print("Current IP: " + str(current_IP) + "\nIP NOT AS EXPECTED!") #Code to complete actions called here time.sleep(60) # Change this timer to reduce/increase time between checks (seconds) except KeyboardInterrupt: print("\nHard Exit Initiated. Goodbye!") https://github.com/Tombo1001/PyIPmonitor ...

13 December 2020 · 2 min · Tom