Jump to content

Have you automated your job (using Python)?

This question is mainly for office workers and people who work from home. What job do you do exactly, how did you automate it with Python, and what work computers do you have at the office?

 

I want to get into doing entry-level data entry jobs or some other beginner office jobs or something in I.T which can be automated using Python. Seeing what creative solutions y'all come up with for your specific use cases and jobs fascinates me as a noob programmer learning Python. Bonus points if you can show off your Python script's source code!

Link to comment
https://linustechtips.com/topic/1587316-have-you-automated-your-job-using-python/
Share on other sites

Link to post
Share on other sites

6 minutes ago, MC.Morrado said:

This question is mainly for office workers and people who work from home. What job do you do exactly, how did you automate it with Python, and what work computers do you have at the office?

 

I want to get into doing entry-level data entry jobs or some other beginner office jobs or something in I.T which can be automated using Python. Seeing what creative solutions y'all come up with for your specific use cases and jobs fascinates me as a noob programmer learning Python. Bonus points if you can show off your Python script's source code!

I've mostly 'automated' my job by redesigning the bad parts of the network to be better, replacing hardware and systems I'm otherwise having to constantly micromanage with more efficient and reliable designs.

 

Now if only all this compliance bs could be automated...

Builder/Enthusiast/Overclocker since 2012 with a focus on SFF/ITX since 2014.

Link to post
Share on other sites

51 minutes ago, MC.Morrado said:

This question is mainly for office workers and people who work from home. What job do you do exactly, how did you automate it with Python, and what work computers do you have at the office?

 

I want to get into doing entry-level data entry jobs or some other beginner office jobs or something in I.T which can be automated using Python. Seeing what creative solutions y'all come up with for your specific use cases and jobs fascinates me as a noob programmer learning Python. Bonus points if you can show off your Python script's source code!

It isn't really my job but I used python to automatically fix my archlinux mimeinfo.cache. Basically my problem was the vscode and zed packages were automatically setting my default file manager to themselves which is something I did not want. So I wrote this:

#!/usr/bin/python3

import re

def replace_line_in_file(lines_param, line_number, new_text):
    if 0 <= line_number < len(lines_param):
        lines_param[line_number] = new_text + '\n'
    else:
        print(f"Error: Line number {line_number} is out of range.")
    return lines_param

p = re.compile(r'(inode/directory)+')

file_path = "/usr/share/applications/mimeinfo.cache"
with open(file_path, 'r') as file:
    lines = file.readlines()

counter = 0

for i, line in enumerate(lines):
    if p.search(line):
        lines = replace_line_in_file(lines, i, "inode/directory=org.gnome.Nautilus.desktop;thunar.desktop;kitty-open.desktop")
        break

with open(file_path, 'w') as file:
    file.writelines(lines)

Then made a pacman hook for it to run after package operations.

Link to post
Share on other sites

I started automating my job where I could to make things easier on myself and the team as a whole. At one point my boss said, "do whatever you think would help the team," and then he didn't talk to me for 2 years (it was glorious). I ended up having a whole team built around me, because I ended up with so many projects and it was helping a lot. That's how I transitioned from a systems admin to a now principal software engineer.

 

There was some Python here and there. These days it's mostly Ansible, which is backed by  Python and does use it for some custom modules. I also do a bit of web stuff, and whatever other language I might need.

 

Don't get too tied to one language. Use whatever makes sense for what you need to get done. I started out using AutoHotKey, because most of what was going to make the job easier at the time was automating my desktop. I did some PowerShell when I needed to help deploy a new app to some Windows servers. Python/Flask when I needed to make an API for something and for this dashboard pipe dream I had. Shell scripts when working with cloud-init, HTML/CSS/JS/PHP for other web stuff (because it's easy to deploy and low maintenance), SQL, some low-code / no-code stuff, etc, etc.... once you know one language doing various other things isn't that big of a deal.

 

To contradict myself a bit, while you don't want to limit yourself by a language choice, also avoid using random obscure languages just for the sake of using them because they are trendy. You'll drive yourself insane trying to keep up with coding trends. I like boring stable stuff that will just work, so I can solve a problem and move on with my life. Let other people suffer on the bleeding edge.

 

I can't show any of the code. Pretty sure I'd be fired for that.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×