Posts

Life is a marathon

life is a journey. It can be short or it can be long. It's not a short race if you choose to live. How far you go is totally depends on how long you want to go and how persistent you are. So put your sadness and weakness back, let's go and see how far we can reach.

a_typical_chinese_novel (chapter1 to 8)

这是一本科幻历史小说。除了符合逻辑、事实与推理,它将不受任何束缚地被讲述。 它可以针砭时政治,可以解析事件、描述道理。 通过阅读本书,你会发现,历史总是惊人的相似。人们所遇到的困难,大多数都是被前人解决过的问题。只不过解决方案 被历代统治集团 审查、删改,使其被从公共知识库删除掉了。 就算该知识没被审查机构删除,只要 该知识的作者 没钱交 服务器费用、出版费、广告费、保护费,该知识同样会被从搜索引擎或者出版物上删除。   第一章 大规模监控与愚民政策 渐渐地,你会发现,不管你做什么事情,都要提前汇报,被批准了才能去做。 举个例子,做生意需要营业执照。架设一个网站,需要备案。就连把jupyter_notebook用域名暴露到公网,都需要提前申请ssl。如此一来,你的自由就很有限了。不管做什么,别人都提前知道。 另外,谈谈愚民政策。愚民,简单点讲,就是统治者觉得除了他们那一派外,其他人都应该尽可能的愚蠢。 举个例子,对于一个很简单的问题,如果你只依赖公共网络的知识去解决它,比如大众搜索引擎,最终的结果是,你会使用最低效的方法。本来3步能解决的问题,网上的教程可能写了20步。最可恶的是,当你独自花了大力气解决了某个问题,隔几个月,你就发现你的解决方案失效了。需要不断地做重复劳动解决之前被解决过的问题。耗费你的生命。 现在,闭上眼睛,想象一个场景:假设你在一片荒原,四周一望无际,一个人都没有,是不是很自由?然后,你来到一片草地,前方从稀到密,出现了一条布满食物与美好事物的大道。你沿着道路慢慢前行,却丝毫没有意识到四周的囚笼逐渐缩小。为什么会这样?主要的原因是你步入了别人的圈套。   第二章 谁智力低,谁就要被掠夺 为什么人们不反抗?最主要的原因是人们的智力太低。要不就是人们没有意识到自己被掠夺,要不就是人们没有反抗的能力。 同时,统治或者控制你的集团并不傻。他们对人们的压制策略,是循序渐进开展的。通过 逐步地 限制人们的自由、剥夺人们的权利、降低人们的能力、减少人们的资源,人们会越来越弱,并逐步地接受一切对他们自身不利的事物,并将这种压榨视为理所当然。 如此一来,就不会出现激进的反抗。就会出现"被圈养的羊"效应: 因为羊从小被链子套着,所以长大后就算把链子解掉,羊也不会跑,并且觉得被链子套住是理所当然的。 只有 反控制的能

How to sync data betwen 3 disk storage?

How to sync data in 3 disk storage? 1. You have diskA, diskB, and diskC. diskC should have biggest storage. 2. You compare diskA, diskB and diskC, find common things in 3 disk. find different parts in 3 disk. 3. You manually choose what folder or file in diskA need to get saved. A software will remember that. 4. You manually choose what folder or file in diskB need to get saved. This time it would be easier for you because software remembers some choice you did last time. 5. You copy everything need to get saved from diskA and diskB to diskC. 6. You delete unwanted difference data in diskC. 7. You re-manage diskC data. 8. You copy diskC data into diskA and diskB directly by overwrite everything.

How to set up a socket service as VPN with pure python?

 # Big direction 1. pure python socket proxy service, one py file 2. ufw allow port 3. use proxy_switch extension in broswer 4. "ssh -L 141:127.0.0.1:141 root@5.3.7.5", connect local 141 as remote 141 # Python script ``` """ Small Socks5 Proxy Server in Python from https://github.com/MisterDaneel/ Modified by yingshaoxo """ # Network import socket import select from struct import pack, unpack # System import traceback from threading import Thread, activeCount from signal import signal, SIGINT, SIGTERM from time import sleep import sys from multiprocessing import Process # # Configuration # MAX_THREADS = 200 BUFSIZE = 2048 TIMEOUT_SOCKET = 5 LOCAL_ADDR = '0.0.0.0' LOCAL_PORT = 2121 # Parameter to bind a socket to a device, using SO_BINDTODEVICE # Only root can set this option # If the name is an empty string or None, the interface is chosen when # a routing decision is made # OUTGOING_INTERFACE = "eth0" OUTGOING_INTERFACE = "

How to set up a webpage_based virtual desktop for your remote linux VPS?

``` docker stop webtop docker rm webtop docker run -d \   --name=webtop \   -e PUID=1000 \   -e PGID=1000 \   -e TZ=Europe/London \   -p 19999:3000 \   -v ~/.webtop:/config \   --shm-size="100mb" \   --restart unless-stopped \   ghcr.io/linuxserver/webtop ``` username abc password abc   http://your_ip:19999  

How to set up jupyter notebook in your server or VPS remotely with subdomain and cloudflare?

 How to set up jupyter notebook in server? # new jupyterlab does not allow cloudflare subdomain access no matter how you try, so we use old pip install jupyterlab==3.2.8 # set up password jupyter lab password # then modify a file 'vim ~/.jupyter/jupyter_server_config.json' to allow subdomain ``` {   "ServerApp": {     "password": "JkZ12Ij",     "allow_origin": "*",     "allow_remote_access": true   } } ~       ``` # new jupyterlab does not have 'jupyter lab' command, so you can only use 'jupyter server'. But it does not allow subdomain access. jupyter lab --ip 127.0.0.1 --port 9998 --allow-root /root/ # I use traefik to do proxy from subdomain to localhost, but use nginx will be easyer since nginx has many tutorial online # auto start, with "crontab -e" @reboot /usr/local/bin/jupyter lab --ip 127.0.0.1 --port 19998 --allow-root /root/

How to make your python code more stable? So it can get running both in python2.7 and python3.x

1. Use zero built-in library or third_party package Try to use built-in functions to do the same thing. If you only focus on one system, that would be easy.   """ abs() all() any() ascii() bin() bool() bytearray() bytes() callable() classmethod() dict() dir() enumerate() eval() exec() float() format() globals() hasattr() hash() help() hex() input() int() isinstance() issubclass() iter() len() list() locals() max() min() object() oct() open() ord() pow() print() property() range() repr() reversed() round() set() setattr() slice() sorted() staticmethod() str() sum() super() tuple() type() vars() zip() __import__() """ 2. Use no types The type will break python2.7, and it will make your code more complex if you use more than json 5 base types. Instead, use this template yingshaoxo created:   ``` Instead of using type in function, you can directly put the type after variable name, so that python2 could run it, for example: def hi(greeting_string):      result

How to make small software project?

How to reduce the burden on developers, reduce software size, optimize program performance, and increase compatibility? For different hardware, systems, and architectures, build different software packages or repositories and let different programmers manage them. For example, vim can be divided into vim_linux, vim_windows, vim_mac, vim_android, etc. If need more precise, it can be divided into vim_linux_amd64, vim_linux_arm64 In this way, you may find that only the developers of Unix are the smartest, and their project have the least amount of code, and their software are most stable. If the project has 0 dependencies, in theory, in that hardware machine it targets to, you can use that software forever without updating or internet access. For people who are looking for general cross platform project, they are stupid. They do not own those hardware or operation systems, so they can't make sure in the future, those stuff won't change. So cross platform software is the most unsta