Package: auto-everything
auto_everythingLinux automationInstallation (For Python >= 3.10)python3-mpipinstall"git+https://github.com/yingshaoxo/auto_everything.git@dev"--break-system-packages# Use github on care, you may get banned(404) by saying the 'fuck' word: https://yingshaoxo.xyz/pictures/github/index.htmlorpython3-mpipinstallauto_everything--break-system-packagesWhat the fuck thedebianorpipis thinking of? Why we can't use pip to directly install a package anymore?debian/ubuntu linux branchwant to force people to let their package go througha strict censorship processso that they can decide which software is good, which is not?npx 'npm install -g *' still working fine, 'export PATH=$PATH:/**/bin/' still working fine.Thoseassohle dictatorswho in charge never want to make things easy, are they?Where is the freedom? My dear people!What is the difference betweenpip installandapt install? Simply becausepypi has more freedom?Installation (For 3.5 <= Python < 3.10)sudopip3installauto_everything==3.9

or

poetryaddauto_everything==3.9Basic APIImportfromauto_everything.terminalimportTerminalt=Terminal()Run a command and get replyreply=t.run_command('uname -a')print(reply)Run commands and get direct screen outputcommands="""sudo apt updateuname -a"""t.run(commands)Run a programt.run_program('firefox')Run a python scriptt.run_py('your_file.py')Run a bash scriptt.run_sh('your_file.sh')Detect if a program or script is runningstatus=t.is_running('terminal')print(status)Kill itt.kill('terminal')For simplifying python developmentImportfromauto_everything.pythonimportPythonpy=Python()TurnPython Classinto aCommand Line Programpy.fire(your_class_name)Make itglobal executable:py.make_it_global_runnable(executable_name="Tools")ExampleLet's assume you have a file namedTools.py:fromauto_everything.baseimportPythonpy=Python()classTools():defpush(self,comment):t.run('git add .')t.run('git commit -m "{}"'.format(comment))t.run('git push origin')defpull(self):t.run("""git fetch --allgit reset --hard origin/master""")defundo(self):t.run("""git reset --mixed HEAD~1""")defreset(self):t.run("""git reset --hard HEAD^""")defhi(self):print("Hi, Python!")py.fire(Tools)py.make_it_global_runnable(executable_name="MyTools")After the first running of this script bypython3 Tools.py hi, you would be able to useMyToolsto run this script at anywhere within your machine:yingshaoxo@pop-os:~$MyToolshi
Hi,Python!For simplifying generalserver and clientdevelopmentDefine YRPC Protocolsservice Greeter {
    rpc say_hello (hello_request) returns (HelloReply);
}

enum UserStatus {
    OFFLINE = 0;
    ONLINE = 1;
}

message hello_request {
   string name = 1;
   UserStatus user_status = 2;
   repeated UserStatus user_status_list = 3;
}

message HelloReply {
    string message = 1;
}GeneratePython, Flutter, Typescriptcodefromauto_everything.developimportYRPCyrpc=YRPC()forlanguagein["python","dart","typescript"]:yrpc.generate_code(which_language=language,input_folder="/home/yingshaoxo/CS/protocol_test/protocols",input_files=["english.proto"],output_folder="/Users/yingshaoxo/CS/protocol_test/generated_yrpc")Here, we only use python to do the server part job.Then, you can use it like this:fromgenerated_yrpc.english_rpcimport*classNewService(Service_english):asyncdefsay_hello(self,item:hello_request)->HelloReply:reply=HelloReply()reply.message=item.namereturnreplyservice_instance=NewService()run(service_instance,port="6060")voidmain()async{varclient=Client_english(service_url:"http://127.0.0.1:6060",error_handle_function:(error_message){print(error_message);},);varresult=awaitclient.say_hello(item:hello_request(name:"yingshaoxo"));if(result!=null){print(result);}}OthersSimpler IOfromauto_everything.baseimportIOio=IO()io.write("hi.txt","Hello, world!")print(io.read("hi.txt"))io.append("hi.txt","\n\nI'm yingshaoxo.")print(io.read("hi.txt"))Quick File Operationfromauto_everything.diskimportDiskfrompprintimportpprintdisk=Disk()files=disk.get_files(folder=".",type_limiter=[".mp4"])files=disk.sort_files_by_time(files)pprint(files)Easy Storefromauto_everything.diskimportStorestore=Store("test")store.set("author","yingshaoxo")store.delete("author")store.set("author",{"email":"yingshaoxo@gmail.com","name":"yingshaoxo"})print(store.get_items())print(store.has_key("author"))print(store.get("author",default_value=""))print(store.get("whatever",default_value="alsjdasdfasdfsakfla"))store.reset()print(store.get_items())Encryption and Decryptionencryption_and_decryption=EncryptionAndDecryption()a_dict=encryption_and_decryption.get_secret_alphabet_dict("hello, world")a_sentence="I'm yingshaoxo."encrypted_sentence=encryption_and_decryption.encode_message(a_secret_dict=a_dict,message=a_sentence)print()print(encrypted_sentence)>B'i ybjdqahkxk.decrypted_sentence=encryption_and_decryption.decode_message(a_secret_dict=a_dict,message=encrypted_sentence)print(decrypted_sentence)>I'm yingshaoxo.JWT Tool (Json-Web-Token Tool)jwt_tool=JWT_Tool()secret="I'm going to tell you a secret: yingshaoxo is the best."a_jwt_string=jwt_tool.my_jwt_encode(data={"name":"yingshaoxo"},a_secret_string_for_integrity_verifying=secret)print(a_jwt_string)>eyJhbGciOiAiTUQ1IiwgInR5cCI6ICJKV1QifQ==.eyJuYW1lIjogInlpbmdzaGFveG8ifQ==.583085987ba46636662dc71ca6227c0aoriginal_dict=jwt_tool.my_jwt_decode(jwt_string=a_jwt_string,a_secret_string_for_integrity_verifying=secret)print(original_dict)>{'name':'yingshaoxo'}fake_jwt_string="aaaaaa.bbbbbb.abcdefg"original_dict=jwt_tool.my_jwt_decode(jwt_string=fake_jwt_string,a_secret_string_for_integrity_verifying=secret)print(original_dict)>NoneWeb automationfromauto_everything.webimportSeleniummy_selenium=Selenium("https://www.google.com",headless=False)d=my_selenium.driver# get input boxxpath='//*[@id="lst-ib"]'elements=my_selenium.wait_until_elements_exists(xpath)iflen(elements)==0:exit()# text inputingelements[0].send_keys('\b'*20,"yingshaoxo")# click search buttonelements=my_selenium.wait_until_elements_exists('//input[@value="Google Search"]')iflen(elements):elements[0].click()# exitmy_selenium.sleep(30)d.quit()Yingshaoxo machine learning ideasFor natual language processWe treat every char as an id or tensor elementIn GPU based machine learning algorithm, you will often do things with [23, 32, 34, 54]But now, it becomes ['a', 'b', 'c', 'd']For text summaryFor the self attention mechanism, it is using word apperance counting dict. You could think it as a dict, multiple key link to one same value, for all those multiple key string, if a word show up a lot of time, it is likely a important word.
(You can think this as a TV show, for the same envirnoment, if a person only show once, it is not the main character, it is not important. But if a character show a lot times, you can almost see it at any eposide, then it is a important character)For one sequence or list, If its importance number less than average(half of 'its sequence importance sum'), you remove itOr you could do this: if that word does not appear again in the following sentences of the input_text in your database, you treat it as not important text.For translationlong sequence (meaning group) -> long sequence (meaning group)what you do -> 你干什么
It depends on -> 这取决于(It depends on) (what you do) -> 这取决于 你干什么meaning group can be get automatically, all you have to do is count continues_words appearance time. the more time a continuse_words appear, the more likely it is a meaning groupIt all can be summaryed as "divide and conquer"For question and answerFor context information extraction, you have to use the question. If one sentence of the context should at the bottom of the question, you keep it, otherwise, you remove itThen, for the other context, you do a simple sortFor text generationone char predict next char
two char predict next char
...
one word predict next word
two words predict next word
three words predict next word
...when you use it, use it from bottom to top, use longest sequence to predict the next word first.the more level you make, the more accurate it would be.It is dict based next word generator, so the speed is super quickThis method was created by yingshaoxo. it only need cpu than gpu. it can beat gpt4 with an old computer if you have big dataset (30GB) and big memory to hold the dict.For general AIGeneral AI algorithm:

Natural language -> Python programming language -> Go through CPU -> If it is working, add that sentence to database to add weights to that sentence, if it is not working, minus weights for that sentence -> use words or long sub_string weights to generate more following natural language sentences -> it is a never end loop, but if the storage is about to blow, we need to find a way to do compression and find more way to store data.

Those code are generated in real time. For each response, it generate different algorithm or code. It adopts to any situation.

#yingshaoxo#yingshaoxo: I could give you a template for general AIimportjsonfromauto_everything.terminalimportTerminalterminal=Terminal()global_dict={}defupdate_global_dict_based_on_new_information(input_text):globalglobal_dictpassdefnatual_language_to_task_code(input_text):# This code will only use global_dict as data sourceglobalglobal_dictraw_data=json.dumps(global_dict)previous_code=f'''import jsonglobal_dict = json.loads('{raw_data}')\n'''code=previous_code+f"print('{input_text}')"returncodedefexecute_code(code):# For example, execute python code.result=terminal.run_python_code(code)returnresultprevious_context=""whileTrue:input_text=input("What you want to say? ")code=natual_language_to_task_code(input_text)result=execute_code(code)print(result)new_information=input_text+"\n\n\n"+resultprevious_context+=new_informationupdate_global_dict_based_on_new_information(new_information)