2024年5月29日

linux-c-log-rotation-scheme

摘要: linux-c-log-rotation-scheme #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> void logworker() { ino_t inode = 0; FILE *logfile; logfil 阅读全文

posted @ 2024-05-29 16:58 明天有风吹 阅读(2) 评论(0) 推荐(0) 编辑

2023年12月6日

fish 复用 .bash_profile 里的环境变量,以及 alias 命令别名

摘要: vim ~/.config/fish/config.fish 添加以下代码 # REUSE ENVIRONMENT VARIABLES FROM ~/.bash_profile bash -c '. ~/.bash_profile; env' | while read e set var (echo 阅读全文

posted @ 2023-12-06 13:41 明天有风吹 阅读(74) 评论(0) 推荐(0) 编辑

2023年11月6日

Rust 在可执行文件中嵌入代码版本信息

摘要: 缘起 我想要最终编译出的可执行文件中包含代码仓库的版本信息 fn main() { println!("Hello RustHub"); // git rev-parse --short HEAD let commit_hash = "6c1b45f"; println!("commit_hash: 阅读全文

posted @ 2023-11-06 14:13 明天有风吹 阅读(54) 评论(0) 推荐(0) 编辑

2023年10月30日

一些有免费额度的服务

摘要: cloudflare cloudflare 云端 sqlite: Turso serverless heroku vercel netlify aircode zeabur shuttle streamlit CDE(Cloud development environment) github cod 阅读全文

posted @ 2023-10-30 15:42 明天有风吹 阅读(40) 评论(0) 推荐(0) 编辑

2023年9月12日

用 Rust 的 declarative macro 做了个小东西

摘要: 最近几天在弄 ddnspod 的时候,写了个宏: custom_meta_struct 解决什么问题 #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] struct ActionA { url: String, // http 阅读全文

posted @ 2023-09-12 13:38 明天有风吹 阅读(281) 评论(0) 推荐(0) 编辑

2023年8月5日

bevy 0.11 camera2d zoom and pan with touchpad on macos

摘要: ```rust use bevy::prelude::*; use bevy::{input::mouse::MouseWheel, render::camera::ScalingMode}; use bevy::input::touchpad::TouchpadMagnify; use bevy: 阅读全文

posted @ 2023-08-05 20:04 明天有风吹 阅读(37) 评论(0) 推荐(0) 编辑

2023年8月2日

视频转 gif

摘要: ```console ffmpeg -i input.mp4 \ -vf "fps=10,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \ -loop 0 output.gif ``` 阅读全文

posted @ 2023-08-02 16:38 明天有风吹 阅读(7) 评论(0) 推荐(0) 编辑

bevy cursor to world

摘要: ![](https://img2023.cnblogs.com/blog/342816/202308/342816-20230802162445233-237827897.gif) # 代码 ```rust //! bevy version: 0.11 //! Spawn a ball on the 阅读全文

posted @ 2023-08-02 16:27 明天有风吹 阅读(16) 评论(0) 推荐(0) 编辑

2023年7月12日

async-await Rust: 200 多行代码实现一个极简 runtime

摘要: > What I cannot create, I do not understand Rust 中的 runtime 到底是咋回事, 为了彻底搞懂它, 我在尽量不借助第三方 crate 的情况下实现了一个玩具 runtime, 之所以说是玩具,因为它没有复杂的调度算法(只有一个全局 task qu 阅读全文

posted @ 2023-07-12 16:47 明天有风吹 阅读(292) 评论(0) 推荐(0) 编辑

2023年6月25日

Rust 过程宏 proc-macro 是个啥

摘要: ## 定义一个 procedural macro 新建一个 lib 类型的 crate: ```bash cargo new hello-macro --lib ``` procedural macros 只能在 `proc-macro` 类型的 crate 内定义,所以需要修改 Cargo.tom 阅读全文

posted @ 2023-06-25 18:29 明天有风吹 阅读(194) 评论(0) 推荐(0) 编辑

2023年6月21日

聊一聊 Rust 的 stack overflow

摘要: 早上看到了这篇文章 [智能指针有可能会让你的应用崩溃](https://mp.weixin.qq.com/s/HB3RHJBhrhKCp4mToPC2nw), 下面分析一下 会导致 stack overflow 的代码 ```rs struct Node { val: T, next: Option 阅读全文

posted @ 2023-06-21 17:30 明天有风吹 阅读(336) 评论(0) 推荐(0) 编辑

2023年6月17日

macOS 安装 postgreSQL

摘要: [PostgreSQL Documentation](https://www.postgresql.org/docs/current/index.html) ```bash brew install postgresql brew services start postgresql createdb 阅读全文

posted @ 2023-06-17 15:53 明天有风吹 阅读(94) 评论(0) 推荐(0) 编辑

用声明式宏解析 Rust 语法之 enum parser

摘要: 上一篇[用声明式宏解析 Rust 语法](https://mp.weixin.qq.com/s/ruA8jOUdl0Fzo73FPHSLMw) 我们的 "`macro parser`" 解析了 `function` 和 `struct`, 这篇来尝试 parse 一下更复杂的 [`enum`](ht 阅读全文

posted @ 2023-06-17 13:24 明天有风吹 阅读(137) 评论(5) 推荐(0) 编辑

2023年6月16日

用声明式宏解析 Rust 语法

摘要: 在上一篇 [Rust 声明式宏中的 Metavariables 有哪些](https://mp.weixin.qq.com/s/xIwW5h-T7PoKMyEVReIUUw) 的基础上, 今天尝试解析一下 Rust 中的几种 item。我们知道一个 crate 是由 item 组成的,每一个 `fn 阅读全文

posted @ 2023-06-16 18:30 明天有风吹 阅读(188) 评论(0) 推荐(0) 编辑

2023年6月14日

Rust 声明式宏中的 Metavariables 有哪些

摘要: [Metavariables](https://doc.rust-lang.org/reference/macros-by-example.html#metavariables) 官方文档确实写得很好,但是缺少一些风味,容易催眠😵‍💫 还是直接看例子更爽一些,通常我们可以从示例代码中之间看出官方 阅读全文

posted @ 2023-06-14 18:27 明天有风吹 阅读(25) 评论(0) 推荐(0) 编辑

2023年6月7日

MacBook Pro 硬盘扩容

摘要: 准备给自己的 MacBook Pro (Retina, 13-inch, Mid 2014) 更换硬盘,在此记录一下 # 前期准备 - SSD 固态硬盘 M.2 接口(NVMe 协议) 一个 (三星 Samsung 970 EVO Plus) - M.2 NVMe 转 AHCI 转接板一个 (麦沃 阅读全文

posted @ 2023-06-07 16:29 明天有风吹 阅读(122) 评论(0) 推荐(0) 编辑

2023年5月25日

ulimit

摘要: [ulimit Man Page](https://ss64.com/bash/ulimit.html) ``` ulimit User limits - limit the use of system-wide resources. Syntax ulimit [-HS] -a ulimit [- 阅读全文

posted @ 2023-05-25 13:48 明天有风吹 阅读(11) 评论(0) 推荐(0) 编辑

ifconfig brctl command not found

摘要: ```sh sudo apt install net-tools sudo apt install bridge-utils ``` 阅读全文

posted @ 2023-05-25 13:13 明天有风吹 阅读(6) 评论(0) 推荐(0) 编辑

2023年5月22日

如何严谨地做性能测试

摘要: [性能测试应该怎么做?](https://coolshell.cn/articles/17381.html) 一般来说,性能测试要统一考虑这么几个因素:Thoughput吞吐量,Latency响应时间,资源利用(CPU/MEM/IO/Bandwidth…),成功率,系统稳定性。 下面的这些性能测试的 阅读全文

posted @ 2023-05-22 15:47 明天有风吹 阅读(24) 评论(0) 推荐(0) 编辑

2023年5月18日

Android 动态改变 navigation 的 startDestination, 使得已登录的用户直接跳过 LoginFragment

摘要: 需求: 未登录用户打开 App,会展示登录页面 LoginFragment 已登录用户打开 App,直接展示 MainFragment nav_graph.xml 结构如下: MainActivity.java: @Override protected void onCreate(Bundle sa 阅读全文

posted @ 2023-05-18 15:18 明天有风吹 阅读(337) 评论(0) 推荐(0) 编辑

2023年5月11日

Android 开发 利用 jq 在 Makefile 里给 output-metadata.json 增加字段

摘要: Makefile: .PHONY: upload upload: metadata #./push-apk.sh .PHONY: metadata metadata: app/build/outputs/apk/release/output-metadata.json app/build/outpu 阅读全文

posted @ 2023-05-11 14:22 明天有风吹 阅读(131) 评论(0) 推荐(0) 编辑

2023年4月24日

golang 笔记

摘要: A Tour of Go In Go, the := operator is a shortcut for declaring and initializing a variable in one line (Go uses the value on the right to determine t 阅读全文

posted @ 2023-04-24 15:09 明天有风吹 阅读(7) 评论(0) 推荐(0) 编辑

2023年4月1日

HTML + javascript implement a draggable list 一个可以拖拽交换顺序的列表

摘要: Reference: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dragover_event <body> <style type="text/css"> .draggable { text-align: center; 阅读全文

posted @ 2023-04-01 15:59 明天有风吹 阅读(22) 评论(0) 推荐(0) 编辑

2023年3月20日

WebPageProxy::processDidTerminate: (pid 0), reason 3

摘要: https://stackoverflow.com/questions/67067390/loadhtmlstring-for-a-simple-wkwebview-crashed-at-runtime-with-error-webpageproxy/67067391#67067391 阅读全文

posted @ 2023-03-20 14:26 明天有风吹 阅读(54) 评论(0) 推荐(0) 编辑

2023年3月17日

Android Studio 的 Proxy 配置

摘要: 除了在 System Settings 的 HTTP Proxy 配置以外,还有一个 ~/.gradle/gradle.properties 文件要注意 阅读全文

posted @ 2023-03-17 14:49 明天有风吹 阅读(1348) 评论(0) 推荐(0) 编辑

2023年3月9日

excel 批量删除大量关键字

摘要: excel 自带的替换功能每次只能替换一个关键字,还不支持 regex,vba 我不会,也不想学,所以还是用 python 关键字按行写到 keyword.txt 中: hell\s*o av 讨厌 hate 然后是 py 脚本 excel_clear_word.py: #!/usr/bin/env 阅读全文

posted @ 2023-03-09 17:12 明天有风吹 阅读(312) 评论(0) 推荐(0) 编辑

2023年3月8日

excel 合并

摘要: 最近整理收钱吧的账单明细,因为收钱吧限制每次最多只能导出 1 个月的明细,所以我需要合并这些零零碎碎的表格,方便在 excel 中做统计筛选 https://openpyxl.readthedocs.io/en/stable/tutorial.html #!/usr/bin/env python3 阅读全文

posted @ 2023-03-08 20:12 明天有风吹 阅读(218) 评论(0) 推荐(0) 编辑

Simulate arrow keys on mobile phone 手机上模拟键盘的上下左右按钮

摘要: <textarea placeholder="test touchmove" ontouchstart="onTouchStart(event)" ontouchmove="onTouchMove(event)" ontouchend="onTouchEnd(event)"></textarea> 阅读全文

posted @ 2023-03-08 15:02 明天有风吹 阅读(62) 评论(0) 推荐(0) 编辑

2023年3月3日

html show modal dialog

摘要: <button onclick="showModalDialog()">show modal dialog</button> <dialog id="dialog" onclose="onModalClose(event)"> <header>This is a sample dialog</hea 阅读全文

posted @ 2023-03-03 18:13 明天有风吹 阅读(45) 评论(0) 推荐(0) 编辑

js 以 json 格式 post form data

摘要: 用 js 发起请求,以避免页面跳转 <form action="/hello" method="POST" onsubmit="submitFormData(event)"> <input type="text" name="name" required placeholder="username" 阅读全文

posted @ 2023-03-03 15:59 明天有风吹 阅读(435) 评论(0) 推荐(0) 编辑

2023年1月12日

Dotfiles Management

摘要: cd ~ mkdir .dotfiles cd .dotfiles git init --bare # initialise a bare git repo cd - echo "alias dotfiles='git --git-dir=/home/mx/.dotfiles --work-tree 阅读全文

posted @ 2023-01-12 14:09 明天有风吹 阅读(23) 评论(0) 推荐(0) 编辑

2023年1月11日

Reduce Depth of an Existing Git Repo 让 git 只保留最近 n 次的 commit 删除其余的

摘要: shallow clone git clone --depth=1 https://github.com/cloudwu/skynet.git git log --oneline | wc -l 1 du -hs .git 792K .git fully clone, and reduce the 阅读全文

posted @ 2023-01-11 15:49 明天有风吹 阅读(105) 评论(0) 推荐(0) 编辑

2023年1月8日

Xcode "There is not enough disk space available to install the product." with plenty of space.

摘要: 我的老 MacBook Pro (Retina, 13-inch, Mid 2014) 可用空间 41 GB,App Store 硬是死活不给装 Xcode,说我硬盘空间不够。 Xcode "There is not enough disk space available to install th 阅读全文

posted @ 2023-01-08 13:31 明天有风吹 阅读(55) 评论(0) 推荐(0) 编辑

2022年11月24日

s3 upload files with shell script

摘要: TL; DR #!/usr/bin/env bash # hangj.cnblogs.com s3_key="Q3AM3UQ867SPQQA43P2F" s3_secret="zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG" session_token="Secur 阅读全文

posted @ 2022-11-24 14:54 明天有风吹 阅读(61) 评论(0) 推荐(0) 编辑

2022年9月20日

How to install and configure fail2ban to secure linux server

摘要: How to check linux login history fail2ban-basic 最近把吃灰好几年的树莓派重新整起来之后: whitelist ignoreip = 127.0.0.0/8 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 EOF 阅读全文

posted @ 2022-09-20 17:34 明天有风吹 阅读(98) 评论(0) 推荐(0) 编辑

2022年9月18日

raspberry pi mount a usb drive tutorial

摘要: # fdisk is a tool to manage disks on Linux # this will display all disks # At the end of the displaying lines, you will see your usb drive, check the 阅读全文

posted @ 2022-09-18 14:43 明天有风吹 阅读(22) 评论(0) 推荐(0) 编辑

2022年9月17日

send email with python 发邮件

摘要: 使用 python 发邮件,具体参数改一下即可使用 # https://docs.python.org/3/library/email.examples.html # https://stackoverflow.com/a/26191922/1936057 def sendmail(subject, 阅读全文

posted @ 2022-09-17 21:47 明天有风吹 阅读(16) 评论(0) 推荐(0) 编辑

2022年9月16日

Find and Replace in Vim / Vi

摘要: Find and Replace in Vim / Vi 命令格式 :[range]s/{pattern}/{string}/[flags] [count] 可以在normal 模式下输入 :help substitute 查看帮助文档 | 示例 | 释义 | | | | | :s/Foo/bar/ 阅读全文

posted @ 2022-09-16 15:35 明天有风吹 阅读(36) 评论(0) 推荐(0) 编辑

2022年9月13日

github codespace quickly setup a ladder(ssserver)

摘要: #!/usr/bin/env bash gh cs ssh --codespace your-repository-temporary-xxxx "/home/codespace/.cargo/bin/ssserver -d -c /workspaces/your-ssserver-director 阅读全文

posted @ 2022-09-13 16:07 明天有风吹 阅读(52) 评论(0) 推荐(0) 编辑

2022年9月10日

some learning resource

摘要: interesting blogs https://johanhelsing.studio/ https://gafferongames.com/ https://wizardzines.com/ https://margin.re/blog/ https://web.stanford.edu/cl 阅读全文

posted @ 2022-09-10 23:00 明天有风吹 阅读(11) 评论(0) 推荐(0) 编辑

导航

+V atob('d2h5X251bGw=')

请备注:from博客园