Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
webbrowser11 authored Jul 14, 2024
0 parents commit fa4c739
Show file tree
Hide file tree
Showing 9 changed files with 315 additions and 0 deletions.
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright © 2024 Alter Net codes, SCA foundation, the open-source community

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
25 changes: 25 additions & 0 deletions apps/helloworldapp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import subprocess
import os
import sys

def main():
print("Hello, World!")
print("Make an app in the app folder (with the same structure just modified to fit your app code).")

# Path to the kernel script in the KERNEL folder
kernel_script = os.path.join(os.getcwd(), 'KERNEL', 'kernel.py')

# Check if the kernel script exists before trying to run it
if os.path.isfile(kernel_script):
try:
# Run the kernel script as a subprocess
subprocess.run([sys.executable, kernel_script], check=True)
except subprocess.CalledProcessError as e:
print(f"Error executing the kernel script: {e}")
except Exception as e:
print(f"An unexpected error occurred: {e}")
else:
print("Kernel script not found. Make sure 'kernel.py' exists in the 'KERNEL' directory.")

if __name__ == "__main__":
main()
27 changes: 27 additions & 0 deletions apps/simpletextapp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import subprocess
import os
import sys

def main():
print("Simple Text")
print("(What did you expect from an app called simpletext?)")
print("Oh, and by the way... 10 + 20 = " + str(10 + 20) + "! How cool!")
print("Thanks, scratch_fakemon!")

# Path to the kernel script in the KERNEL folder
kernel_script = os.path.join(os.getcwd(), 'KERNEL', 'kernel.py')

# Check if the kernel script exists before trying to run it
if os.path.isfile(kernel_script):
try:
# Run the kernel script as a subprocess
subprocess.run([sys.executable, kernel_script], check=True)
except subprocess.CalledProcessError as e:
print(f"Error executing the kernel script: {e}")
except Exception as e:
print(f"An unexpected error occurred: {e}")
else:
print("Kernel script not found. Make sure 'kernel.py' exists in the 'KERNEL' directory.")

if __name__ == "__main__":
main()
54 changes: 54 additions & 0 deletions apps/textapp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import os

def create_file(filename):
with open(filename, 'w') as file:
content = input("Enter content for the file (end with an empty line):\n")
while True:
line = input()
if line == "":
break
file.write(line + "\n")
print(f"File '{filename}' created successfully.")

def read_file(filename):
if os.path.isfile(filename):
with open(filename, 'r') as file:
print(f"Contents of '{filename}':")
print(file.read())
else:
print(f"File '{filename}' does not exist.")

def edit_file(filename):
if os.path.isfile(filename):
with open(filename, 'a') as file:
content = input("Enter content to append to the file (end with an empty line):\n")
while True:
line = input()
if line == "":
break
file.write(line + "\n")
print(f"File '{filename}' updated successfully.")
else:
print(f"File '{filename}' does not exist.")

def main():
print("Welcome to TextApp!")
while True:
command = input("Enter command (create, read, edit, exit): ").strip().lower()
if command == "create":
filename = input("Enter filename to create: ").strip()
create_file(filename)
elif command == "read":
filename = input("Enter filename to read: ").strip()
read_file(filename)
elif command == "edit":
filename = input("Enter filename to edit: ").strip()
edit_file(filename)
elif command == "exit":
print("Exiting TextApp. Goodbye!")
break
else:
print("Invalid command. Please enter 'create', 'read', 'edit', or 'exit'.")

if __name__ == "__main__":
main()
92 changes: 92 additions & 0 deletions kernel/kernel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import subprocess
import os
import sys
from datetime import datetime
import pytz

treevalue = 1
print("Welcome to the skyOS! Thank you to all those contributors who worked on this!")
print("Hope you find this OS useful!")
print("SkyOS v2.0 OScore python3")

# Assuming the apps directory is one level up from the KERNEL directory
apps_dir = os.path.join(os.path.dirname(os.getcwd()), 'apps')

command_history = []

while True:
command = input("command: ").strip().lower()
command_history.append(command)

if command == "help":
print("Available commands:")
print("help - show this help message")
print("info - show information about this program")
print("echo - echo back what you type")
print("helloworld.app - run the helloworld application")
print("simpletext.app - run the simple text app by scratch_fakemon!")
print("tree - create a value for tree. use the -p command to print the value.")
print("history - show all command history")
print("time - see the time in 12hr format")

elif command == "time":
# Specify the timezone.
timezone = pytz.timezone('America/Los_Angeles')

# Get the current time in the specified timezone
now = datetime.now(timezone)

# Format the date and time as a 12-hour clock with AM/PM
current_time = now.strftime("%I:%M %p")

# Print the current date and time
print(current_time)

elif command == "info":
print("Developed by the SCA and Alter Net codes. All rights reserved.")
print("This kernel may not be reproduced in any way.")
print("You can archive (make sure the archive is public).")
print("v2.0 python3, c23")


elif command == "echo":
echotxt = input("Echo what: ").strip()
print(echotxt)

elif command == "tree":
treevalue = input("tree:")
print("the value of tree is set.")
elif command == "tree -p":
print(treevalue)

elif command == "helloworld.app":
script_path = os.path.join(apps_dir, 'helloworldapp.py')
if os.path.isfile(script_path):
try:
subprocess.run([sys.executable, script_path], check=True)
except subprocess.CalledProcessError as e:
print(f"Error executing the script: {e}")
except Exception as e:
print(f"An unexpected error occurred: {e}")
else:
print("helloworldapp.py not found in the 'apps' directory.")

elif command == "simpletext.app":
script_path = os.path.join(apps_dir, 'simpletextapp.py')
if os.path.isfile(script_path):
try:
subprocess.run([sys.executable, script_path], check=True)
except subprocess.CalledProcessError as e:
print(f"Error executing the script: {e}")
except Exception as e:
print(f"An unexpected error occurred: {e}")
else:
print("simpletextapp.py not found in the 'apps' directory.")

elif command == "history":
print("Command History:")
for index, cmd in enumerate(command_history, start=1):
print(f"{index}: {cmd}")

else:
print("Not a valid command. Type 'help' for a list of commands.")
11 changes: 11 additions & 0 deletions kernel/shutdown/linuxshutdown.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// C program to shutdown in Linux
#include <stdio.h>
#include <stdlib.h>

int main()
{
// Running Linux OS command using system
system("shutdown -P now");

return 0;
}
11 changes: 11 additions & 0 deletions kernel/shutdown/windowsshotdown.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// C program to shutdown a Windows PC
#include <stdio.h>
#include <stdlib.h>

int main()
{
// Running Windows OS command using system
system("shutdown /s /f /t 0");

return 0;
}
50 changes: 50 additions & 0 deletions log.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# the log

## 6/22/24
creation

v0.1-0.9 the pre-creation and bug fixing stage (6/22/24 11:00am-5:00pm)
v1.0 inatial realease (6/22/24 8:00pm)

## 6/23/24
v1.1 added new app! simple text app (1:00-2:00)

## 6/24/24
v1.2
quick bug fix (10:35)
lots of bug fixes (3:00-5:00)

## 6/25/24
v1.3
not much...

## 6/26/24
v1.4
added a command with a new parameter.

## 6/27/24
v1.5 new app (11:30-12:00)
v1.6 updated kernel (12:00-12:30)

## 6/28/24
v1.7
updated the kernel (added time command did some bug fixes, 1:00 - 2:00)

## 6/30/24
v1.8
added a new paramter for the command TREE created on the 26th.

## 7/2/24
v1.9
shutdown scripts

## 7/3/24
v2.0
bug fix

## 7/4/24
v2.0
did an update to the copyright notice.

## stay tuned
stay tuned for more logs and update info!
24 changes: 24 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# skyOS readme.md file
open-source operating system for the Scratch Computing Alliance [SCA]

## description
an os built FROM SCRATCH!! its open-source easy to contribute
to because it is written in python a very easy langauge! (to learn and program in)
*thanks god github exists so the team can work on this.*
how to contribute below!

## contributing
email:
[email protected]
and wait for a notification that you can contribute.
then click accept head over to this repository
and help us work on skyOS!

## website
https://webbrowser11.github.io/skyOSweb/
also for more infromation on cotributing!

## work in progress!
work on this project is STILL IN PROGRESS

<ins>written from SCRATCH!<ins>

0 comments on commit fa4c739

Please sign in to comment.