Categories
Linux Systems Administration

A tool to take Cisco Umbrella logs and output them to Syslog messages

I wrote a tool recently that allows taking log files from the Cisco-managed S3 bucket, and outputs each log line as a Syslog message, with the content of the log line as a JSON-formatted message. Details of the Cisco-managed S3 bucket are here: https://docs.umbrella.com/deployment-umbrella/docs/cisco-managed-s3-bucket Once logged onto disk, the output of this tool looks like: […]

Categories
Linux Networking Programming

Trio Tutorial – Simple TCP Chat Program – Part 4

Series Part 1: https://jaytuckey.name/2021/07/22/trio-tutorial-simple-tcp-chat-program-part-1/ Part 2: https://jaytuckey.name/2021/07/24/trio-tutorial-simple-tcp-chat-program-part-2/ Part 3: https://jaytuckey.name/2021/07/24/trio-tutorial-simple-tcp-chat-program-part-3/ In part 4 we look into making the server handle disconnections without crashing. We also look into how me can make messages quicker to distribute. For this code we use the trio functionality to wait for limited time for a task to complete, by using […]

Categories
Linux Networking Programming

Trio Tutorial – Simple TCP Chat Program – Part 3

Series Part 1: https://jaytuckey.name/2021/07/22/trio-tutorial-simple-tcp-chat-program-part-1/ Part 2: https://jaytuckey.name/2021/07/24/trio-tutorial-simple-tcp-chat-program-part-2/ In part 3 we build more of the server. We build out the functionality to receive messages, then distribute them to all connected users. For this part we use Trio’s nurseries to start up new running tasks: https://trio.readthedocs.io/en/stable/reference-core.html#nurseries-and-spawning We use the nursery.start_soon() function to kick off new tasks […]

Categories
Linux Networking Programming

Trio Tutorial – Simple TCP Chat Program – Part 2

Series Part 1: https://jaytuckey.name/2021/07/22/trio-tutorial-simple-tcp-chat-program-part-1/ In part 2 we look at making a tool to assist with testing the TCP server we are building: We use the built-in python socket library in the testclient: https://docs.python.org/3/library/socket.html Got any questions? Contact me: https://jaytuckey.name/about/

Categories
Linux Networking Programming

Trio Tutorial – Simple TCP Chat Program – Part 1

I’ve made a video about making a simple TCP-based program using Python and Trio. The video is here: https://www.youtube.com/watch?v=6JM1hgjLV-A The features I plan to build are: each user has a long running tcp connection user is asked for name on connection user sends message each other connected user receives the message In part 1 we […]

Categories
Programming

Saving query parameters into the browser history, using Flask + HTMX

I’ve recently been using the htmx (https://htmx.org/) javascript library to make some simple Flask web applications I have made a bit more dynamic. The page is very simple, but contains a big table of data in the center. It has a form at the top of the page that allows you to write simple queries […]

Categories
Linux Networking Programming

Sending an email via Microsoft O365 SMTP Servers using Python

This is a simple script to send an email via MS’s O365 Service: Note how you need to set up an SSL context and perform .starttls() to properly create a secure connection.

Categories
Linux Programming Systems Administration

Tips for doing “shell” scripting in Python

I’ve been moving a bunch of my shell scripts to python recently, because of how much better it handles the concept of “a process didn’t run successfully”. Consider the bash script: What happens here if Command 2 fails? Note that we still get the success message at the end – bash silently ignored our error-ing […]

Categories
General Tech Linux Systems Administration

New Project – coconut-deadmanswitch – A tool to monitor Cron Jobs and Scheduled Tasks

I’ve started a new project! I recently talked about my experiments with coconut-lang here: https://jaytuckey.name/2020/10/25/thoughts-on-coconut-the-compile-to-python-functional-language-extension/ I’ve now started a project using coconut! It’s what I’m calling a “Dead Man’s Switch” (DMS) monitoring tool. The idea is this: Every cron job / scheduled task sends an update to the DMS monitor The monitor records the updates […]

Categories
Linux Programming

Thoughts on Coconut – the Compile-to-Python Functional Language Extension

Today I have been playing with the Coconut Language – see http://coconut-lang.org/ – so I thought I would put down some thoughts on using it, going through what I like and find interesting. What Is Coconut? So what is coconut? From their website: Coconut is a functional programming language that compiles to Python. One super-neat […]