-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
227 changed files
with
1,034 additions
and
1,126 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions
8
LjinuxRoot/bin/_waitforconnection.py → Beryllium/bin/_waitforconnection.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
rename_process("waitforconnection") | ||
while True: | ||
for pv[get_pid()]["i"] in range(2): | ||
ljinux.io.ledset(7) | ||
be.io.ledset(7) | ||
sleep(0.1) | ||
ljinux.io.ledset(4) | ||
be.io.ledset(4) | ||
sleep(0.1) | ||
if ljinux.api.console_connected(): | ||
if be.api.console_connected(): | ||
break | ||
ljinux.io.ledset(4) | ||
be.io.ledset(4) | ||
time.sleep(0.2) | ||
time.sleep(0.2) # Delay for the terminal to get used to it. | ||
term.clear_line() |
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
LjinuxRoot/bin/advance_build_date.py → Beryllium/bin/advance_build_date.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
be.based.run( | ||
"title " | ||
+ be.based.system_vars["USER"] | ||
+ "@" | ||
+ be.based.system_vars["HOSTNAME"] | ||
+ ": " | ||
+ be.api.betterpath() | ||
) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
rename_process("cat") | ||
vr("inpt", be.based.user_vars["argj"].split()) | ||
|
||
try: | ||
with be.api.fopen(vr("inpt")[1], "r") as pv[get_pid()]["f"]: | ||
if vr("f") is None: | ||
be.based.error(4, vr("inpt")[1]) | ||
be.api.setvar("return", "1") | ||
else: | ||
for pv[get_pid()]["line"] in vr("f"): | ||
term.nwrite(vr("line")) | ||
vrd("line") | ||
be.api.setvar("return", "0") | ||
except IndexError: | ||
be.based.error(1) | ||
be.api.setvar("return", "1") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# change directory | ||
fpexec /bin/cd.py | ||
fpexec /bin/ljinuxtitle.py | ||
fpexec /bin/betitle.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
rename_process("cd") | ||
vr("capdir", getcwd()) | ||
vr("opts", be.api.xarg()) | ||
if len(vr("opts")["w"]): | ||
vr("target", vr("opts")["w"][0]) | ||
if vr("target") == "-": | ||
vr("target", be.based.user_vars["prevdir"]) | ||
else: | ||
vr("target", "~") | ||
vr("dr", be.api.isdir(vr("target"))) | ||
if vr("dr") == 1: | ||
chdir(be.api.betterpath(vr("target"))) | ||
if vr("capdir") != getcwd(): | ||
be.api.setvar("prevdir", vr("capdir")) | ||
be.based.olddir = getcwd() | ||
elif not vr("dr"): | ||
be.based.error(14, "cd") | ||
else: | ||
be.based.error(17, "cd") |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,63 @@ | ||
rename_process("cp") | ||
try: | ||
vr("rd", getcwd()) | ||
vr("src", ljinux.api.betterpath(ljinux.based.user_vars["argj"].split()[1])) | ||
vr("srcisd", ljinux.api.isdir(vr("src"), rdir=vr("rd"))) | ||
vr("dst", ljinux.api.betterpath(ljinux.based.user_vars["argj"].split()[2])) | ||
vr("dstisd", ljinux.api.isdir(vr("dst"), rdir=vr("rd"))) | ||
vr("src", be.api.betterpath(be.based.user_vars["argj"].split()[1])) | ||
vr("srcisd", be.api.isdir(vr("src"), rdir=vr("rd"))) | ||
vr("dst", be.api.betterpath(be.based.user_vars["argj"].split()[2])) | ||
vr("dstisd", be.api.isdir(vr("dst"), rdir=vr("rd"))) | ||
vrd("rd") | ||
|
||
if vr("srcisd") is 2 or (vr("dstisd") is 2 and vr("dst").endswith("/")): | ||
raise OSError | ||
elif vr("srcisd") is 0 and vr("dstisd") in [0, 2]: | ||
with ljinux.api.fopen(vr("src"), "rb") as pv[get_pid()]["srcf"]: | ||
with be.api.fopen(vr("src"), "rb") as pv[get_pid()]["srcf"]: | ||
vr("srcd", vr("srcf").read()) | ||
with ljinux.api.fopen(vr("dst"), "wb") as pv[get_pid()]["dstf"]: | ||
with be.api.fopen(vr("dst"), "wb") as pv[get_pid()]["dstf"]: | ||
if vr("dstf") is None: | ||
raise RuntimeError | ||
vr("dstf").write(vr("srcd")) | ||
elif vr("srcisd") is 1 and vr("dstisd") is 2: | ||
ljinux.api.setvar("argj", "mkdir {}".format(vr("dst"))) | ||
ljinux.based.command.fpexec("/bin/mkdir.py") | ||
be.api.setvar("argj", "mkdir {}".format(vr("dst"))) | ||
be.based.command.fpexec("/bin/mkdir.py") | ||
gc.collect() | ||
gc.collect() | ||
for pv[get_pid()]["i"] in listdir(vr("src")): | ||
term.write(vr("src") + "/" + vr("i") + " -> " + vr("dst") + "/" + vr("i")) | ||
if ljinux.api.isdir(pv[get_pid()]["src"] + "/" + pv[get_pid()]["i"]): | ||
ljinux.api.setvar( | ||
if be.api.isdir(pv[get_pid()]["src"] + "/" + pv[get_pid()]["i"]): | ||
be.api.setvar( | ||
"argj", | ||
"cp " + vr("src") + "/" + vr("i") + " " + vr("dst") + "/" + vr("i"), | ||
) | ||
ljinux.based.command.fpexec("/bin/cp.py") | ||
be.based.command.fpexec("/bin/cp.py") | ||
vr("src", pv[get_pid()]["src"][: vr("src").rfind("/")]) | ||
vr("dst", vr("dst")[: vr("dst").rfind("/")]) | ||
vr("srcisd", ljinux.api.isdir(vr("src"))) | ||
vr("dstisd", ljinux.api.isdir(vr("dst"))) | ||
vr("srcisd", be.api.isdir(vr("src"))) | ||
vr("dstisd", be.api.isdir(vr("dst"))) | ||
else: | ||
with ljinux.api.fopen(vr("src") + "/" + vr("i"), "rb") as srcf: | ||
with be.api.fopen(vr("src") + "/" + vr("i"), "rb") as srcf: | ||
vr("srcd", srcf.read()) | ||
with ljinux.api.fopen(vr("dst") + "/" + vr("i"), "wb") as dstf: | ||
with be.api.fopen(vr("dst") + "/" + vr("i"), "wb") as dstf: | ||
dstf.write(vr("srcd")) | ||
vrd("srcd") | ||
gc.collect() | ||
gc.collect() | ||
elif vr("srcisd") is 0 and vr("dstisd") is 1: | ||
with ljinux.api.fopen(vr("src"), "rb") as pv[get_pid()]["srcf"]: | ||
with ljinux.api.fopen( | ||
with be.api.fopen(vr("src"), "rb") as pv[get_pid()]["srcf"]: | ||
with be.api.fopen( | ||
vr("dst") + "/" + vr("src")[vr("src").rfind("/") + 1 :], "wb" | ||
) as pv[get_pid()]["dstf"]: | ||
if vr("dstf") is None: | ||
raise RuntimeError | ||
vr("dstf").write(vr("srcd")) | ||
ljinux.api.setvar("return", "0") | ||
be.api.setvar("return", "0") | ||
|
||
except IndexError: | ||
ljinux.based.error(1) | ||
ljinux.api.setvar("return", "1") | ||
be.based.error(1) | ||
be.api.setvar("return", "1") | ||
|
||
except RuntimeError: | ||
ljinux.based.error(7) | ||
ljinux.api.setvar("return", "1") | ||
be.based.error(7) | ||
be.api.setvar("return", "1") | ||
|
||
except OSError: | ||
ljinux.based.error(4, f=ljinux.based.user_vars["argj"].split()[1]) | ||
be.based.error(4, f=be.based.user_vars["argj"].split()[1]) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
rename_process("df") | ||
from os import statvfs | ||
|
||
vr("dfr", statvfs("/")) # board | ||
del statvfs | ||
|
||
vr("opts", be.api.xarg()) | ||
|
||
|
||
def human_readable(whatever): | ||
if whatever < 1024: # kb | ||
return f"{int(whatever)}b" | ||
elif whatever < 1048576: # mb | ||
return f"{int(whatever/1024)}K" | ||
elif whatever < 1073741824: # gb | ||
return f"{int(whatever/1048576)}M" | ||
else: | ||
return f"{int(whatever/1073741824)}G" | ||
|
||
|
||
# get values in bytes | ||
vr("free", vr("dfr")[1] * vr("dfr")[3]) | ||
vr("total", vr("dfr")[1] * vr("dfr")[2]) | ||
vr("used", vr("total") - vr("free")) | ||
|
||
vr("bs", 2) | ||
vr("bs_sps", " " * vr("bs")) | ||
|
||
vr( | ||
"vfree", | ||
(human_readable(vr("free")) if "h" in vr("opts")["o"] else str(vr("free"))) | ||
+ vr("bs_sps"), | ||
) | ||
vr( | ||
"vtotal", | ||
(human_readable(vr("total")) if "h" in vr("opts")["o"] else str(vr("total"))) | ||
+ vr("bs_sps"), | ||
) | ||
vr( | ||
"vused", | ||
(human_readable(vr("used")) if "h" in vr("opts")["o"] else str(vr("used"))) | ||
+ vr("bs_sps"), | ||
) | ||
vr("vperc", (str(int(vr("used") * 100 / vr("total"))) + "%")) | ||
|
||
vr("tl", len(vr("vtotal")[: -vr("bs")])) | ||
vr("ul", len(vr("vused")[: -vr("bs")])) | ||
vr("fl", len(vr("vfree")[: -vr("bs")])) | ||
vr("pl", len(vr("vperc")[: -vr("bs")])) | ||
|
||
vr("sps", [vr("bs_sps")] * 4) | ||
|
||
if vr("tl") < 4: | ||
pv[get_pid()]["vtotal"] += " " * (4 - vr("tl")) | ||
else: | ||
pv[get_pid()]["sps"][0] += (vr("tl") - 4) * " " | ||
|
||
if vr("ul") < 4: | ||
pv[get_pid()]["vused"] += " " * (4 - vr("ul")) | ||
else: | ||
pv[get_pid()]["sps"][1] += (vr("ul") - 4) * " " | ||
|
||
if vr("fl") < 5: | ||
pv[get_pid()]["vfree"] += " " * (5 - vr("fl")) | ||
else: | ||
pv[get_pid()]["sps"][2] += (vr("fl") - 5) * " " | ||
|
||
if vr("pl") < 4: | ||
pv[get_pid()]["vperc"] += " " * (4 - vr("pl")) | ||
else: | ||
pv[get_pid()]["sps"][3] += (vr("pl") - 4) * " " | ||
|
||
term.write( | ||
"Filesystem Size{}Used{}Avail{}Use%{}Mounted on\n".format( | ||
vr("sps")[0], | ||
vr("sps")[1], | ||
vr("sps")[2], | ||
vr("sps")[3], | ||
) | ||
+ "/" | ||
+ pv[0]["root"] | ||
+ " {}{}{}{}/".format( | ||
vr("vtotal"), | ||
vr("vused"), | ||
vr("vfree"), | ||
vr("vperc"), | ||
) | ||
) | ||
|
||
be.api.setvar("return", "0") | ||
del human_readable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
echo "Are you high? This is beryllium, not bimbows.." |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
rename_process("dropcache") | ||
vr("opts", ljinux.api.xarg()) | ||
vr("opts", be.api.xarg()) | ||
if "help" in vr("opts")["o"] or "h" in vr("opts")["o"]: | ||
term.write("Usage: dropcache\n\nClears all code cache.") | ||
else: | ||
ljinux.code_cache.clear() | ||
be.code_cache.clear() | ||
term.write("Cleared all code cache!") | ||
ljinux.api.setvar("return", "0") | ||
be.api.setvar("return", "0") |
File renamed without changes.
Oops, something went wrong.