Archive


Category: 似水流年

  • minikube minutes

    create a cluster minikube start –force –image-mirror-country='cn' –image-repository='registry.cn-hangzhou.aliyuncs.com/google_containers' –cpus 2 –memory 4g –driver docker –profile lazy-rabbit-studio kubectl get nodes kubectl get context kubectl config use-context lazy-rabbit-studio minikube image load gcr.io/k8s-minikube/kicbase:v0.0.45 minikube start –force –base-image=gcr.io/k8s-minikube/kicbase:v0.0.45 -cpus 2 –memory 4g –driver docker –profile lazy-rabbit-studio minikube start –vm-driver=docker –base-image="anjone/kicbase" –image-mirror-country='cn' –image-repository='registry.cn-hangzhou.aliyuncs.com/google_containers' –kubernetes-version='v1.22.0' –force minikube start –vm-driver=docker –base-image="anjone/kicbase" –image-mirror-country='cn' […]

  • push gateway

    Overview Occasionally you will need to monitor components which cannot be scraped. The Prometheus Pushgateway allows you to push time series from short-lived service-level batch jobs to an intermediary job which Prometheus can scrape. Combined with Prometheus’s simple text-based exposition format, this makes it easy to instrument even shell scripts without a client library. Data […]

  • Prettier for java

    Overview Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary. A Prettier plugin must first parse the source code of the target language into a traversable data structure (Usually an […]

  • Java programming prompts

    Overview — 翻译自 25-perfect-ai-prompts-for-java-developers "Suggest strategies for optimizing Java code for improved performance, including using bytecode optimization and efficient memory management techniques." 请建议优化 Java 代码以提高性能的策略,包括使用字节码优化和高效的内存管理技术。 "Explain the principles of Java concurrency and suggest ways to use concurrency techniques for improved code performance and scalability." 请解释 Java 并发的原理并建议使用并发技术来提高代码性能和可扩展性的方法。 "Suggest ways to optimize Java code for improved […]

  • cloud native buildpacks

    Cloud Native Buildpacks (CNBs) transform your application source code into container images that can run on any cloud. With buildpacks, organizations can concentrate the knowledge of container build best practices within a specialized team, instead of having application developers across the organization individually maintain their own Dockerfiles. This makes it easier to know what is […]

  • 打包保护你的 Python 程序

    1. 编译成可执行文件 可以使用工具将 Python 脚本转换为独立的可执行文件: 工具: PyInstaller: 支持多平台(Windows、macOS 和 Linux)。 pyinstaller –onefile your_script.py 上述命令会生成一个单独的可执行文件,位于 dist/ 目录下。 cx_Freeze: 也是一个常用的工具,支持类似功能。 cxfreeze your_script.py –target-dir dist/ py2exe(Windows 专用): 将 Python 脚本编译成 Windows 下的可执行文件。 优点: 生成的可执行文件不需要 Python 环境即可运行。 部分情况下可以混淆或隐藏源代码。 缺点: 用专业的反编译工具可能仍然还原部分代码逻辑。 2. 字节码保护 Python 源代码在运行时会被编译成字节码文件(.pyc),可以通过生成 .pyc 文件分发代码: 使用 compileall 模块生成字节码文件: python -m compileall your_script.py 然后分发生成的 .pyc 文件。 配合工具如 cython 或 […]

  • 提高效率的 @EnableJdbcAuditing

    @EnableJdbcAuditing 是 Spring Data JDBC 提供的一个注解,用于启用审计功能(Auditing)。它主要负责自动填充实体类中的审计字段,比如 createdBy、createdDate、lastModifiedBy 和 lastModifiedDate。 以下从功能、实现逻辑和源码解析三个方面详细说明。 1. 功能 @EnableJdbcAuditing 提供以下功能: 自动填充创建和修改时间:在插入或更新记录时,自动填充实体类中的时间字段(如 createdDate 和 lastModifiedDate)。 支持用户信息:可以自动填充创建者和修改者信息(如 createdBy 和 lastModifiedBy),需要配合自定义 AuditorAware 实现。 2. 使用示例 数据库表 假设有一张用户表 user: CREATE TABLE user ( id BIGINT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(50), created_by VARCHAR(50), created_date TIMESTAMP, last_modified_by VARCHAR(50), last_modified_date TIMESTAMP ); 实体类 定义对应的实体类,标注审计字段: import org.springframework.data.annotation.CreatedBy; import org.springframework.data.annotation.CreatedDate; […]

  • Agile Testing Quadrants

    四个维度 面向业务 面向技术 指导开发 指导产品 理想情况下, 我们希望以下 3 个象限是自动化的 Q1. 功能性验收测试 Q3. 单元/集成/系统测试 Q4. 非功能性验收测试(性能,压力,安全测试)

  • DNS-F

    DNS-F (DNS Failover) is a DNS-based mechanism supported by Nacos, a dynamic service discovery and configuration management platform, to provide failover support for service discovery. It works by allowing services to use DNS queries to retrieve IP addresses of available service instances, ensuring resilience and reliability when instances become unavailable. Here’s a breakdown of what […]

  • The new and revised 15 factors

    12 factor In the modern era, software is commonly delivered as a service: called web apps, or software-as-a-service. The twelve-factor app is a methodology for building software-as-a-service apps that: Use declarative formats for setup automation, to minimize time and cost for new developers joining the project; Have a clean contract with the underlying operating system, […]