Create Restic Backup Program

I’m sharing a wrapper program written in python to backup my files in my device using restic. import subprocess restic_command = ['restic', 'backup'] backup = ["C:\\Users\\veronica\\ibisPaint", "C:\\Users\\veronica\\Pictures", "C:\\Users\\veronica\\Documents"] print("List of directories to be backed up:\n" ) #list the files that will be backed up. #enumerate = allows you to keep track of the number of iterations in a loop. for number, dir in enumerate(backup, start=1): print(f" {number}. {dir}") # Or: print(" " + str(number) + ".", letter ) # \n makes a new line print("\nBackup process started...\n") # combines the lists together. backup_command = restic_command + backup restic = subprocess.run(backup_command, shell=True) The end. -w- ...

December 30, 2024 · 1 min · SourFox

Create a new user account on Linus Server Take 2

Hallooo peeps! Last time, I made a new user on Linux but in this one, instead of just making a new user, I’ll alo be adding a name for the user and add it into the ‘wheel’ group. Here are the requirements: Username: cooldonkey Password: awesomedonkey24 Name of account: “Donkey” Group: ‘cooldonkey’, ‘wheel’ (wheel group allows a user to run sudo command) The first thing I’ll do is making the user so we’ll use the sudo useradd. But instead of just using useradd, I’ll also add in an option called –comment (-c). This will let me do number 3. Add a name for the user. ...

November 16, 2024 · 1 min · SourFox

How to make a new account on a Linux Server

Hellooo! Let’s learn how to make a new account on a Linux Server. The first command we’ll be using is ‘useradd’. That command allows you to make a new account. This is how it goes: sudo useradd test2 Now that the account username had been created. Now we have to make a password for it. To do that, we’ll use the command ‘sudo passwd (username)’ Like this: sudo passwd test2 ...

November 8, 2024 · 1 min · SourFox

Atm Bill Dispenser

Today, I was given an assignment to write a program to implement an atm dispenser in the following notes: 100, 50, 20, 10, and 5. If the amount is not a multiply of 5, the atm will return a list of 0. In the code are short explanations of why I used it. # asks the customer to enter an amount of number. atm = int(input("Enter an amount in a multiple of 5: ")) # This takes in a amount parameter which is the input from the user and return an array of bills in the following orders: [$100, $50, $20, $10, $5]. def dispenser(amount): # if statement to check if number entered is divisible by 5. If not, return with 0, if yes, continue code. if atm % 5 != 0: return [0, 0, 0, 0, 0] result = [] bill_types = [100, 50, 20, 10, 5] # starts with the starting amount being divided by each number in bill_types. for each_note in bill_types: note_counts = amount // each_note result.append(note_counts) # get the remainder and overwrite the previous. amount = amount % each_note return result # The code below is what will be given back as a sentence to the customer. print(f"You entered ${atm}: {dispenser(atm)}")

August 9, 2024 · 1 min · SourFox

Finding the GCD of two numbers

In this assignment, it’ll be finding the GCD(Greatest Common Divisor). This means I need to write a program to find the GCD of two numbers. Below, I have written the program and next to the hashtags are just a sentence that’ll explain to you what each part of the code is doing. #The two variables 'num' and 'ber' will be where the inputs will be stored in. When it starts it will show '(num)a: ' and you'll have to put a number in. This goes the same for '(ber)b: ' num = int(input("a: ")) ber = int(input("b: ")) #Then once the variable has gotten their information, they will go through this: def gcd(num, ber): if ber == 0: return num else: return gcd(ber, num % ber) #And last, it'll gather their answer and print it for you as a sentence. print(f"The GCD {num}, {ber} is {gcd(num, ber)}.") That’s all today. Bye!

July 12, 2024 · 1 min · SourFox