Invested How Warren Buffett and Charlie Munger Taught Me

Foreword by Phil Town Warren Buffett says investing is buying an asset that produces cash flow for substantially less than it’s worth, like buying a $ 10 bill for $ 5. She finally did the math and discovered that unless she was willing to be a wage slave for her whole life, accumulating enough money to have choices was nearly impossible without investing. Introduction, or How to Use This Book a market crash is a natural part of the economic cycle that is going to happen whether I want it to or not. Chapter 1: January—Becoming Brave Rule #1 is Don’t Lose Money. Rule #2? Don’t Forget Rule #1. ...

September 28, 2024 · 4 min · xgDebug

The Simple Path to Wealth

Beginnings “If you reach for a star, you might not get one. But you won’t come up with a hand full of mud either.” Spend less than you earn—invest the surplus—avoid debt. Carrying debt is as appealing as being covered with leeches and has much the same effect. ...

September 28, 2024 · 9 min · xgDebug

使用ncnn布署pytorch模型到Android手机

使用 ncnn 布署 pytorch 模型到 Android 手机 编译 NCNN 时要打开显卡支持 vulkan 是针对 gpu 的 -DNCNN_VULKAN=ON MobileNetV3 編譯成 MT 時要打開 CMAKE 0091 特性 cmake_minimum_required(VERSION 3.20.0) cmake_policy(SET CMP0091 NEW) set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") project("client-project") 训练 YOLO \Envs\torch\Scripts\activate.ps1 python train.py --batch 6 --workers 2 --imgsz 960 --epochs 300 --data "\Core\yaml\data.yaml" --cfg "\Core\yaml\cfg.yaml" --weights \Core\weights\best.pt --device 0 转换模型 from torch import nn import torch.utils.model_zoo as model_zoo import torch.onnx from libs import define from libs.net import Net from libs.dataset import ImageDataset import os test_data = ImageDataset(define.testPath,False) test_loader = torch.utils.data.DataLoader( test_data, batch_size=1, shuffle=True) device = torch.device("cuda" if torch.cuda.is_available() else "cpu") model = Net(out_dim=19).to(device) model.load_state_dict(torch.load( "./widget/last.pt" )) model.eval() def saveOnnx(): for data, target in test_loader: data, target = data.to(device), target.to(device) label = target.long() y = model(data) # Export the model torch.onnx.export(model, # model being run data, # model input (or a tuple for multiple inputs) "./widget/best.onnx", # where to save the model (can be a file or file-like object) export_params=True, # store the trained parameter weights inside the model file opset_version=10, # the ONNX version to export the model to do_constant_folding=True, # whether to execute constant folding for optimization input_names = ['input'], # the model's input names output_names = ['output'], # the model's output names dynamic_axes={'input' : {0 : 'batch_size'}, # variable lenght axes 'output' : {0 : 'batch_size'}}) traced_script_module = torch.jit.trace(model, data) return saveOnnx() # 转换 os.system("python -m onnxsim ./widget/best.onnx ./widgetbest-sim.onnx") os.system("./bin/onnx2ncnn.exe ./widget/best-sim.onnx ./widget/best.param ./widget/best.bin") os.system("./bin/ncnnoptimize.exe ./widget/best.param ./widget/best.bin ./widget/best-opt.param ./widget/best-opt.bin 65536") python .\export.py --weights weights/best.pt --img 960 --batch 1 --train python -m onnxsim best.onnx best-sim.onnx .\onnx2ncnn.exe best-sim.onnx best.param best.bin ncnnoptimize best.param best.bin best-opt.param best-opt.bin 65536 Git clone ncnn repo with submodule $ git clone https://github.com/Tencent/ncnn.git $ cd ncnn $ git submodule update --init Build for Linux / NVIDIA Jetson / Raspberry Pi Build for Windows x64 using VS2017 Build for macOS Build for ARM Cortex-A family with cross-compiling Build for Hisilicon platform with cross-compiling Build for Android Build for iOS on macOS with xcode Build for WebAssembly Build for AllWinner D1 Build for Loongson 2K1000 Build for Termux on Android Build for Linux Install required build dependencies: ...

September 28, 2024 · 5 min · xgDebug

在Android 11 上使用 LLDV 调试原生程序

手机端 PUSH 调试服务器到手机 adb push lldb-server /data/local/tmp chmod 755 /data/local/tmp/lldb-server 启动调试器服务 /data/local/tmp/lldb-server platform --listen "*:8888" --server 电脑端 端口转发 adb forward tcp:8888 tcp:8888 启动 LLDB .\lldb.exe 查看支持平台 platform list 选 ANDROID 平台 platform select remote-android 连接到手机 手机序列号: 9643e0ec0604 要换成当前调试的手机,使用 adb devices 查看序列号 platform connect connect://9643e0ec0604:8888 查看当前正在运行的进程 platform process list 附加上去 attach 9053 下断点 b send 跑起来 c 查看线程列表 thread list 查看调用栈 bt

September 28, 2024 · 1 min · xgDebug

何谓三观不合

你敬畏天理,他崇拜权威, 这是世界观不同; 你站在良知一边,他站在强者一边, 这是价值观不同; 你努力是为理想的生活, 他努力是做人上人, 这是人生观不同。 ...

September 12, 2023 · 1 min · xgDebug

Arch安装stable-diffusion-webui中遇到的一些坑

1. 不要使用清华的源,要用阿里的,因为清华的源不全 2. 要使用 python launch.py 来安装一些 git 库 3. 要安装 requirements_versions.txt 带版本的 pip 库 4. 可以使用 python webui.py –port=7860 –server=0.0.0.0 –medvram 节省显存

September 12, 2023 · 1 min · xgDebug

一个人生的哲学:不要看这个人对你怎么样,要看她对周围其他人怎么样。

一个人的行为习惯往往是长期养成的,并反映了其内在的价值观和信念。 一个人如果对待周围其他人都是友善、尊重和善良的,那么他/她也更有可能对你是友好的。反之,如果一个人对待周围其他人都是冷漠、自私和无礼的,那么他/她也更有可能对你是冷漠、自私和无礼的。 ...

September 8, 2023 · 1 min · xgDebug

容忍傻子,理解傻子,收割傻子。

别动上层人的利益,也别动下层人的观念,动上层人的利益犹如要他性命,动下层人的观念犹如刨他祖坟,而下层观念正是上层利益的来源。

August 30, 2023 · 1 min · xgDebug

Atomic Habits

Habits are the compound interest of self-improvement. The same way that money multiplies through compound interest, the effects of your habits multiply as you repeat them. They seem to make little difference on any given day and yet the impact they deliver over the months and years can be enormous. Highlight(yellow) - 1: The Surprising Power of Atomic Habits > Location 313 。人们做了一些小的改变,没有看到切实的结果,并决定停止。你会想,“我已经连续一个月每天都跑步了,为什么我的身体没有任何变化?一旦这种想法占据了上风,就很容易让好习惯被抛在一边。但为了产生有意义的改变,习惯需要持续足够长的时间才能突破这个高原——我称之为潜在潜力高原。 People make a few small changes, fail to see a tangible result, and decide to stop. You think, “I’ve been running every day for a month, so why can’t I see any change in my body?” Once this kind of thinking takes over, it’s easy to let good habits fall by the wayside. But in order to make a meaningful difference, habits need to persist long enough to break through this plateau—what I call the Plateau of Latent Potential. ...

August 26, 2023 · 23 min · xgDebug

成功的敌人不是失败,而是无趣与无聊

成功的敌人不是失败,而是无趣与无聊,所以我们必须让它有趣。 做产品也是一样,必须一开始就有人用,有互动,有反馈,否则你坚持不下去的。一定要从一开始就有种子用户,开发中的时候就有一个群的人在期待。 ...

August 26, 2023 · 1 min · xgDebug

不会说好听的就别说话

If you can’t say nice things, say nothing. Don’t put people down.

August 24, 2023 · 1 min · xgDebug

别看新闻,不要寻找大新闻,大新闻会找到你

You don’t need to follow the daily news. True breaking news will find you, and the rest isn’t urgent or just doesn’t matter.

August 24, 2023 · 1 min · xgDebug

Habits of the rich

Habit of Financial Discipline: Become someone who practices disciplined financial management. This could involve habits such as creating a budget, tracking expenses, and avoiding unnecessary spending. Habit of Continuous Learning: Embrace the identity of a lifelong learner in the realm of personal finance. Make it a habit to read books, articles, and attend seminars on financial literacy and investment strategies. Habit of Savvy Investing: Cultivate the identity of an informed and strategic investor. Regularly set aside time to research investment opportunities and make informed decisions about where to invest your money. Habit of Goal Setting: Adopt the identity of a goal-oriented individual. Set clear financial goals and break them down into actionable steps. Regularly review and adjust your goals as needed. Habit of Networking and Relationship Building: Become someone who actively seeks out connections in the financial world. Network with professionals, mentors, and like-minded individuals who can provide guidance and opportunities. Habit of Entrepreneurial Thinking: Develop an identity that embraces entrepreneurial thinking. This might involve exploring side businesses, investments in startups, or other ventures that can diversify your income streams. Habit of Long-Term Planning: Embody the identity of a strategic planner. Develop a habit of thinking about your financial future in the long term, which includes retirement planning, estate planning, and more. Habit of Resilience: Cultivate the identity of a resilient individual who learns from setbacks. Financial success often involves facing challenges; adopting the habit of bouncing back and learning from failures is crucial. Habit of Generosity: Adopt the identity of someone who values giving back. Allocate a portion of your financial success to charitable causes, reinforcing the idea that financial success enables positive impact. Habit of Risk Management: Become someone who is conscious of financial risks. Develop habits of managing and mitigating risks through insurance, emergency funds, and thoughtful decision-making. Habit of Negotiation and Assertiveness: Embrace an identity of someone who advocates for their financial interests. Develop the habit of negotiating for better deals, raises, and terms. Remember, the key is to start small and build gradually. Choose one or a few of these habits that resonate with you and incorporate them into your daily routine. As you consistently practice these habits, they will become ingrained in your identity, leading to more sustainable and impactful changes in your financial life. Over time, these small identity-based habits can accumulate and lead to significant financial success. ...

August 24, 2023 · 2 min · xgDebug

改正一道粗心大意的错题只是临时解决了问题,培养仔细审题的习惯才能永久解决问题

当你在结果层面解决问题时,你只会暂时解决它们。为了取得良好的进步,你需要在系统层面解决问题。修复输入,输出将自行修复。

August 23, 2023 · 1 min · xgDebug

How to Become a People Magnet

1 - Understanding human nature People are, above all, interested in themselves. Yup. Sorry. No matter who you are people will always be a thousand times more interested in themselves than in you. No judgment here. People’s actions are governed by self-interest. In every human relationship, your counterpart will always think or ask themselves “what’s in it for me?” Remember this question “What’s in it for me?” By the way, you’re asking this question in all your interactions too, consciously or subconsciously. ...

August 21, 2023 · 16 min · xgDebug

蜜蜂不勤劳辛苦,我哪来的甜蜜。

生活中,总会有一些看似平常的事物,却蕴含着深刻的哲理。就拿蜜蜂和甜蜜来说吧,我们或许很少思考过这背后的故事。蜜蜂,它们是大自然中的勤劳者,辛勤地采集花蜜,转化为甜蜜的珍馐。而这些甜蜜,则成了人们生活中的美味享受,让人们沐浴在幸福的滋味中。 ...

August 17, 2023 · 2 min · xgDebug

权力的48条法则

权力法则 1 永远不要盖过上司的光芒 在取悦他们或给他们留下深刻印象的同时,不要过分显露你的才华,否则会适得其反——引发他的恐惧和不安。 权力法则 2 永远不要太信任朋友,学会如何利用敌人 ...

August 15, 2023 · 11 min · xgDebug

Use ncnn to deploy pytorch model to Android phone

Use ncnn to deploy pytorch model to Android phone Open graphics card support when compiling NCNN. Vulkan is for gpu -DNCNN_VULKAN=ON MobileNetV3 Open CMAKE 0091 feature when compiling into MT cmake_minimum_required(VERSION 3.20.0) cmake_policy(SET CMP0091 NEW) set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") project("client-project") Train YOLO \Envs\torch\Scripts\activate.ps1 python train.py --batch 6 --workers 2 --imgsz 960 --epochs 300 --data "\Core\yaml\data.yaml" --cfg "\Core\yaml\cfg.yaml" --weights \ Core\weights\best.pt --device 0 Conversion model from torch import nn import torch.utils.model_zoo as model_zoo import torch.onnx from libs import define from libs.net import Net from libs.dataset import ImageDataset import os test_data = ImageDataset(define.testPath,False) test_loader = torch.utils.data.DataLoader( test_data, batch_size=1, shuffle=True) device = torch.device("cuda" if torch.cuda.is_available() else "cpu") model = Net(out_dim=19).to(device) model.load_state_dict(torch.load( "./widget/last.pt" )) model.eval() def saveOnnx(): for data, target in test_loader: data, target = data.to(device), target.to(device) label = target.long() y = model(data) # Export the model torch.onnx.export(model, # model being run data, # model input (or a tuple for multiple inputs) "./widget/best.onnx", # where to save the model (can be a file or file-like object) export_params=True, # store the trained parameter weights inside the model file opset_version=10, # the ONNX version to export the model to do_constant_folding=True, # whether to execute constant folding for optimization input_names = ['input'], # the model's input names output_names = ['output'], # the model's output names dynamic_axes={'input': {0:'batch_size'}, # variable lenght axes 'output': {0:'batch_size'}}) traced_script_module = torch.jit.trace(model, data) return saveOnnx() # Conversion os.system("python -m onnxsim ./widget/best.onnx ./widgetbest-sim.onnx") os.system("./bin/onnx2ncnn.exe ./widget/best-sim.onnx ./widget/best.param ./widget/best.bin") os.system("./bin/ncnnoptimize.exe ./widget/best.param ./widget/best.bin ./widget/best-opt.param ./widget/best-opt.bin 65536") python .\export.py --weights weights/best.pt --img 960 --batch 1 --train python -m onnxsim best.onnx best-sim.onnx .\onnx2ncnn.exe best-sim.onnx best.param best.bin ncnnoptimize best.param best.bin best-opt.param best-opt.bin 65536 Git clone ncnn repo with submodule $ git clone https://github.com/Tencent/ncnn.git $ cd ncnn $ git submodule update --init Build for Linux / NVIDIA Jetson / Raspberry Pi Build for Windows x64 using VS2017 Build for macOS Build for ARM Cortex-A family with cross-compiling Build for Hisilicon platform with cross-compiling Build for Android Build for iOS on macOS with xcode Build for WebAssembly Build for AllWinner D1 Build for Loongson 2K1000 Build for Termux on Android Build for Linux Install required build dependencies: ...

August 11, 2023 · 12 min · xgDebug

Debugging native applications with LLDV on Android 11

Mobile PUSH debug server to mobile adb push lldb-server /data/local/tmp chmod 755 /data/local/tmp/lldb-server Start the debugger service /data/local/tmp/lldb-server platform --listen "*:8888" --server +++ Computer side Port forwarding adb forward tcp:8888 tcp:8888 Start LLDB . \lldb.exe View supported platforms platform list Select ANDROID platform platform select remote-android Connect to the phone Phone serial number: 9643e0ec0604 To change to the current debugging phone, use adb devices to check the serial number platform connect connect://9643e0ec0604:8888 View the currently running process platform process list Attach to attach 9053 Breakpoint b send Run up c View the list of threads thread list View the call stack bt

August 11, 2023 · 1 min · xgDebug

Money Master The Game

The largest financial institutions are set up to make a profit for themselves, not their clients. What do I really want? (Vision.) 2. What is important about it? (Values.) 3. How will I get it? (Methods.) 4. What is preventing me from having it? (Obstacles.) 5. How will I know I am successful? (Measurements.) Money is certainly one of the ways we can turn the dreams we have into the reality we live. ...

August 9, 2023 · 9 min · xgDebug