예제 #1
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")
예제 #2
0
        google-chrome "https://inkscape.org/doc/keys.html" &
        xdg-open {path} &
        inkscape
        """, wait=False)

    def pi(self):
        t.run("""
terminator -e "ssh [email protected]"
        """)

    def server(self, num=""):
        if num == "":
            t.run("""
    terminator -e "ssh [email protected]"
            """)
        else:
            t.run(f"""
    Copy server_password {num}
    terminator -e "ssh [email protected].{num}"
            """)

    def android(self):
        t.run("""
cd ~/Android/Sdk/emulator/
./emulator @Pixel_3a_API_30_x86 -no-snapshot-load
        """)


py.fire(Mission)
py.make_it_global_runnable(executable_name="Start")
예제 #3
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)
예제 #4
0
        self.write()

    def write(self):
        """start to write blog using web editor"""
        #t.run_program('code editor.html')
        last_article = io.read('.last_article')
        t.run_program(f'code "{last_article}"')

    def change(self):
        """change markdown file by vim"""
        last_article = io.read('.last_article')
        t.run_program('''terminator -e "vim '{}'"'''.format(last_article))

    def delete(self):
        """delete the last_article"""
        t.run_command('rm {}'.format(io.read('.last_article')))
        t.run_command('rm .last_article')

    def list(self):
        """list all articles"""
        articles = t.run_command('ls article').split('\n')
        articles = [
            article[:-3] for article in articles if article[-3:] == '.md'
        ]
        for article in articles:
            print(article)


py.fire(BlogTool)
예제 #5
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")
예제 #6
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")