예제 #1
0
#!/usr/bin/env /usr/bin/python3
 
#!/usr/bin/env /usr/bin/python3
from auto_everything.base import Python, Terminal, IO
py = Python()
t = Terminal()
io_ = IO()

class Tools():
    def build(self):
        t.run('yarn build')
        content = io_.read("./build/index.html")
        content = content.replace("<title>React App</title>", """
                <title>yingshaoxo | 技术宅</title>
                <meta name="author" content="yingshaoxo" />
                <meta name="description" content="yingshaoxo, born in 1998, love IT. Want to find out all those mysteries in this universe, especially how human thinks. So I embrace AI." />
                <meta name="keywords" content="yingshaoxo, Python, Javascript, C++" />
                """.replace("\n", "")
                )
        io_.write("./build/index.html", content)

py.make_it_runnable()
py.fire(Tools)
예제 #2
0
#!/usr/bin/env /usr/local/opt/[email protected]/bin/python3.9
#!/usr/bin/env /usr/bin/python3
from auto_everything.base import Python
from auto_everything.terminal import Terminal
from auto_everything.gui import Controller

py = Python()
t = Terminal()
controller = Controller()


class Mission():
    def _kill(self):
        process = [
            "jupyter-lab /home/yingshaoxo/CS",
            "kernel",
            # "pycharm",
            # "code/code",
            "nautilus",
            "xournalpp",
            "evince",
            # "chrome",
            "obs",
            "inkscape",
            "clion",
            "firefox",
            "screenkey",
        ]
        for p in process:
            t.kill(p)
예제 #3
0
#!/usr/bin/env /usr/bin/python3
from auto_everything.base import Python
from auto_everything.terminal import Terminal

py = Python()
t = Terminal()


class Open:
    def worklog(self):
        t.run("""
        cd ~/work/worklog
        code .
        """)

    def this(self):
        t.run("""
        xdg-open .
        """)


py.fire(Open)
py.make_it_global_runnable(executable_name="Open")
예제 #4
0
#!/usr/bin/env /usr/bin/python3
from auto_everything.terminal import Terminal
from auto_everything.disk import Disk
from auto_everything.base import IO
from auto_everything.base import Python
import json
t = Terminal()
disk = Disk()
io = IO()
py = Python()


def seperate():
    print()
    print("-------")
    print()


DEVICE = "/dev/ttyUSB0"
PRE_COMMAND = f"ampy -p {DEVICE} "
LS = PRE_COMMAND + "ls"
DELETE = PRE_COMMAND + "rm "
PUT = PRE_COMMAND + "put "

micropython_files = [
    name.strip("/") for name in t.run_command(LS).split("\n")
    if name.strip() != "" and name[-3:] == ".py"
]
print(micropython_files)
if len(micropython_files) == 0:
    exit()
예제 #5
0
#!/usr/bin/env /usr/bin/python3
from auto_everything.base import Python, Terminal
py = Python()
t = Terminal()


class Tools():
    def push(self, comment):
        t.run('git add .')
        t.run('git commit -m "{}"'.format(comment))
        t.run('git push origin')

    def pull(self):
        t.run("""
git fetch --all
git reset --hard origin/master
""")


py.make_it_runnable()
py.fire(Tools)
예제 #6
0
#!/usr/bin/env /usr/bin/python3
import os

from auto_everything.base import Python, Terminal, IO
py = Python()
t = Terminal()
io = IO()


class BlogTool():
    """
    Just try to simplify the work.
    """
    def __init__(self):
        if not t.exists('.last_article'):
            name = input("What's the name of your article? ").strip(' ')
            self.new(name)

    def new(self, article_name):
        """create an new article"""
        name = article_name.strip(" ")

        file_path = os.path.join('article', name + '.md')
        io.write(file_path, '')

        io.write('.last_article', file_path)

        self.write()

    def write(self):
        """start to write blog using web editor"""
예제 #7
0
#!/usr/bin/env /Users/yingshaoxo/miniforge3/bin/python3
#!/usr/bin/env /Applications/Xcode.app/Contents/Developer/usr/bin/python3

import inquirer
import os
from auto_everything.base import Terminal, Python
from auto_everything.video import Video, DeepVideo
from auto_everything.disk import Disk


t = Terminal()
py = Python()
video = Video()
deepVideo = DeepVideo()
disk = Disk()

t.debug = True


RootDIR = "/Users/yingshaoxo/Movies/Videos"


class Tools:
    def __init__(self):
        os.chdir(RootDIR)

    def run(self):
        questions = [
            inquirer.List('function',
                          message="What is the function you want to call?",
                          choices=['nosilence', 'speedupsilence'],
예제 #8
0
from auto_everything.base import Terminal, Python

t = Terminal()
py = Python()

#browser = "firefox"
browser = "chromium"


@py.loop()
def do():
    if not t.is_running(browser):
        t.run_program(browser)


do()
예제 #9
0
#!/usr/bin/env /usr/bin/python3
from auto_everything.base import Python
from auto_everything.terminal import Terminal
from auto_everything.disk import Store

store = Store("task")
py = Python()
t = Terminal()


class Task():
    def add(self, comment):
        l = store.get("list", [])
        l.append(comment)
        store.set("list", l)
        print(comment)

    def done(self, index):
        l = store.get("list", [])
        del l[index]
        store.set("list", l)

    def list(self):
        l = store.get("list", [])
        for i, v in enumerate(l):
            print(f"{i}: {v}")


py.fire(Task)
py.make_it_global_runnable(executable_name="Task")
예제 #10
0
#!/usr/bin/env /usr/bin/python3
import os

from auto_everything.base import Python, Terminal, IO
py = Python()
t = Terminal()
io = IO()

class BlogTool():
    """
    Just try to simplify the work.
    """
    def __init__(self):
        if not t.exists('.last_article'):
            name = input("What's the name of your article? ").strip(' ')
            self.new(name)

    def new(self, article_name):
        """create an new article"""
        name = article_name.strip(" ")

        file_path = os.path.join('article', name + '.md')
        io.write(file_path, '')

        io.write('.last_article', file_path)

        self.write()

    def write(self):
        """start to write blog using web editor"""
        #t.run_program('code editor.html')
예제 #11
0
#!/usr/bin/env /usr/bin/python3
from auto_everything.base import Python
from auto_everything.terminal import Terminal

py = Python()
t = Terminal()


class Do:
    def experiment(self):
        t.run("""
            jupyter-lab . &
        """)


py.fire(Do)
py.make_it_global_runnable(executable_name="Do")
예제 #12
0
#!/usr/bin/env /usr/bin/python3
from auto_everything.base import Python, Terminal
py = Python()
t = Terminal()

class Tools():
    def checklogs(self):
        path_of_log_file = t.fix_path("./__main.log")
        t.run(f"tail -F {path_of_log_file}")

    def compile(self):
        commands = """
python3 -m nuitka --follow-imports main.py --output-dir=build
#python3 -m nuitka --standalone --follow-imports main.py --output-dir=build
        """
        t.run(commands)
        
    def push(self, comment):
        t.run('git add .')
        t.run('git commit -m "{}"'.format(comment))
        t.run('git push origin')

    def pull(self):
        t.run("""
git fetch --all
git reset --hard origin/master
""")

py.fire(Tools)