Skip to content

Commit 12102dd

Browse files
authored
Added Linux and Windows scripts (Logan1x#111)
* Added Linux and Windows scripts * Updated folder name and finalized Readme
1 parent 35c4775 commit 12102dd

File tree

3 files changed

+207
-0
lines changed

3 files changed

+207
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# 🛠️ In Development
2+
3+
This repository contains a collection of **automation and optimization scripts**, aiming to improve the **development environment on Linux** and **gaming performance on Windows**.
4+
5+
---
6+
7+
## 🐧 Linux Automation Scripts
8+
9+
The Python script **`automation_script.py`** is designed to streamline the setup of a new development environment on Linux.
10+
It automates the installation of essential tools, ensuring everything is ready to get you started quickly.
11+
12+
### Linux Script Features
13+
- **System Updates**: Runs `apt update` and `apt upgrade` to keep packages up to date.
14+
- **Essential Tools**: Automatically installs `htop` (process monitor), `Git` (version control), and `Neofetch` (system information).
15+
- **Development Environment**: Installs **Visual Studio Code** via Snap.
16+
- **Customization**: Includes `GNOME Tweaks` and `GNOME Shell Extensions` to customize the user interface.
17+
18+
---
19+
20+
## 🎮 Windows Optimization Scripts
21+
22+
The PowerShell script **`windows_gaming_tweaks.ps1`** is an interactive tool for optimizing Windows and boosting gaming performance.
23+
It provides a simple, straightforward menu to run system maintenance and repair tasks.
24+
25+
### 💻 Windows Script Features
26+
- **SFC/SCANNOW**: Scans and repairs corrupted system files.
27+
- **CHKDSK**: Analyzes and fixes disk errors to maintain data integrity.
28+
- **Temporary File Cleanup**: Removes unnecessary files that take up space and slow down the system.
29+
- **DISM**: Repairs the operating system image, ensuring updates work properly.
30+
31+
---
32+
33+
## How to Use
34+
35+
### 🔹 On Linux
36+
1. Clone the repository:
37+
```bash
38+
git clone https://github.com/Logan1x/Python-Scripts.gitgit
39+
```
40+
41+
2. Enter the repository directory:
42+
```bash
43+
cd Python-Scripts
44+
```
45+
46+
3. Execute the script:
47+
```bash
48+
python3 automation_script.py
49+
```
50+
51+
### 🔹 On Windows
52+
53+
1. Open PowerShell as Administrator. To do this, right-click the Start Menu icon and select `Windows PowerShell (Admin)` or `Terminal (Admin)`.
54+
55+
2. Navigate to the directory where the script is saved:
56+
```bash
57+
cd C:\path\to\repository
58+
```
59+
60+
3. Execute the script:
61+
```bash
62+
.\windows_gaming_tweaks.ps1
63+
```
64+
65+
Note: If the script doesn't run, you might need to adjust the PowerShell execution policy. Use the command `Set-ExecutionPolicy RemoteSigned` (run as Administrator) to allow local scripts to execute.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#In development
2+
3+
import subprocess
4+
import sys
5+
6+
def autom_sudoapt(command):
7+
try:
8+
subprocess.run(command, check=True, text=True, shell=True)
9+
print(f"Comando '{command}' executado com sucesso.")
10+
except subprocess.CalledProcessError as e:
11+
print(f"Erro ao executar o comando '{command}': {e}", file=sys.stderr)
12+
sys.exit(1)
13+
14+
def main():
15+
print("Iniciando a atualização e instalação do htop, vscode e git...")
16+
17+
autom_sudoapt("sudo apt update -y")
18+
19+
autom_sudoapt("sudo apt upgrade -y")
20+
21+
autom_sudoapt("sudo apt install -y htop")
22+
23+
autom_sudoapt("sudo apt install -y git")
24+
25+
autom_sudoapt("sudo snap install -y --classic code")
26+
27+
autom_sudoapt("sudo apt install neofetch -y")
28+
29+
autom_sudoapt("sudo apt install gnome-tweaks -y")
30+
31+
autom_sudoapt("sudo apt install gnome-shell-extensions -y")
32+
33+
autom_sudoapt("sudo apt install gnome-terminal -y")
34+
35+
print("Atualização e instalação concluídos!")
36+
37+
if __name__ == "__main__":
38+
main()
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
#In development
2+
3+
# Check for administrator privileges
4+
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
5+
Write-Warning "This script needs to be run as an Administrator. Restarting with elevated privileges..."
6+
Start-Process powershell "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
7+
exit
8+
}
9+
10+
# Function to display the menu
11+
function Show-Menu {
12+
Clear-Host
13+
Write-Host "------------------------------------------------------" -ForegroundColor Cyan
14+
Write-Host "Script for Windows optimization with a focus on games " -ForegroundColor White
15+
write-Host " Developed by euopaulin " -ForegroundColor White
16+
Write-Host "------------------------------------------------------" -ForegroundColor Cyan
17+
Write-Host " Choose an option:" -ForegroundColor White
18+
Write-Host "------------------------------------------------------" -ForegroundColor Cyan
19+
Write-Host "1. Run SFC/SCANNOW" -ForegroundColor DarkRed
20+
Write-Host "2. Run CHKDSK" -ForegroundColor DarkRed
21+
Write-Host "3. Clean temporary files" -ForegroundColor DarkRed
22+
Write-Host "4. Restore system image (DISM)" -ForegroundColor DarkRed
23+
Write-Host "5. Exit" -ForegroundColor DarkGreen
24+
Write-Host "------------------------------------------------------" -ForegroundColor Cyan
25+
}
26+
27+
# Main loop to show the menu and process user input
28+
while ($true) {
29+
Show-Menu
30+
31+
$choice = Read-Host "Enter the number of your choice"
32+
33+
switch ($choice) {
34+
"1" {
35+
Write-Host "Option 1 selected: Running SFC/SCANNOW..." -ForegroundColor Yellow
36+
try {
37+
& sfc /scannow
38+
if ($LASTEXITCODE -eq 0) {
39+
Write-Host "SFC/SCANNOW executed successfully." -ForegroundColor Green
40+
} else {
41+
Write-Host "Error running SFC/SCANNOW. Make sure to run the script as an Administrator." -ForegroundColor Red
42+
}
43+
} catch {
44+
Write-Host "An error occurred while running the command." -ForegroundColor Red
45+
}
46+
break
47+
}
48+
"2" {
49+
Write-Host "Option 2 selected: Running CHKDSK..." -ForegroundColor Yellow
50+
$drive = Read-Host "Enter the drive letter (e.g., C)"
51+
Write-Host "Checking drive $drive..." -ForegroundColor Yellow
52+
try {
53+
# Using the native PowerShell command
54+
Repair-Volume -DriveLetter $drive -Scan -Verbose
55+
Write-Host "CHKDSK executed successfully." -ForegroundColor Green
56+
} catch {
57+
Write-Host "An error occurred while running the command." -ForegroundColor Red
58+
}
59+
break
60+
}
61+
"3" {
62+
Write-Host "Option 3 selected: Cleaning temporary files..." -ForegroundColor Yellow
63+
try {
64+
$tempPaths = "$env:TEMP\*", "$env:SystemRoot\Temp\*"
65+
foreach ($tempPath in $tempPaths) {
66+
if (Test-Path $tempPath) {
67+
Remove-Item -Path $tempPath -Recurse -Force -ErrorAction SilentlyContinue
68+
}
69+
}
70+
Write-Host "Temporary files cleaned successfully." -ForegroundColor Green
71+
} catch {
72+
Write-Host "An error occurred while cleaning temporary files." -ForegroundColor Red
73+
}
74+
break
75+
}
76+
"4" {
77+
Write-Host "Option 4 selected: Restoring system image (DISM)..." -ForegroundColor Yellow
78+
try {
79+
& dism /Online /Cleanup-Image /RestoreHealth
80+
if ($LASTEXITCODE -eq 0) {
81+
Write-Host "DISM executed successfully." -ForegroundColor Green
82+
} else {
83+
Write-Host "Error running DISM. Make sure to run the script as an Administrator." -ForegroundColor Red
84+
}
85+
} catch {
86+
Write-Host "An error occurred while running the command." -ForegroundColor Red
87+
}
88+
break
89+
}
90+
"5" {
91+
Write-Host "Exiting the script. Goodbye!" -ForegroundColor Red
92+
Start-Sleep -Seconds 2
93+
exit
94+
}
95+
default {
96+
Write-Host "Invalid option. Please enter a number from 1 to 5." -ForegroundColor Red
97+
break
98+
}
99+
}
100+
101+
Write-Host ""
102+
Write-Host "Press any key to continue..." -ForegroundColor White
103+
$null = [System.Console]::ReadKey($true)
104+
}

0 commit comments

Comments
 (0)