Skip to content

Instantly share code, notes, and snippets.

View bxb100's full-sized avatar
🥲
R.I.P, My friend

Lemon bxb100

🥲
R.I.P, My friend
View GitHub Profile
@bxb100
bxb100 / README.md
Last active April 14, 2023 08:03
Display time elapse in your terminal

Initiate

Laurence build a tiny project to show washing time remaining elapse in the terminal[^1], that idea is very fun. and I was very curious about all code behind of this

Using ChatGPT to explain

#! /bin/sh
set -e

P1: jextract

Using

    Hardware Overview:

      Model Name: MacBook Pro
      Model Identifier: MacBookPro17,1
 Chip: Apple M1
@bxb100
bxb100 / awk usage.md
Last active January 29, 2023 09:01
AWK 常见的一些使用方式

筛选出一个 function

从以 function digga() 开头的行到 } 开头行结束

awk '/^function digga()/,/^}/' .functions

获取文本中 m3u8 链接

正则获取有 m3u8 链接行, 然后正则替换 ; 为空字符, 然后打印以 -F fs( fs 默认为 white space ) 分隔的第 4 个字符串

@bxb100
bxb100 / zigzag-encoding.README
Created November 26, 2022 17:15 — forked from mfuerstenau/zigzag-encoding.README
ZigZag encoding/decoding explained
ZigZag-Encoding
---------------
Maps negative values to positive values while going back and
forth (0 = 0, -1 = 1, 1 = 2, -2 = 3, 2 = 4, -3 = 5, 3 = 6 ...)
(i >> bitlength-1) ^ (i << 1)
with "i" being the number to be encoded, "^" being
XOR-operation and ">>" would be arithemtic shifting-operation
@bxb100
bxb100 / github-draft-release-snippet.yml
Created October 12, 2022 04:46
create draft release
create_draft_release:
name: Create Github draft release
runs-on: ubuntu-latest
steps:
- name: Audit gh version
run: gh --version
- name: Check for existing release
id: check_release
run: |
@bxb100
bxb100 / bash_strict_mode.md
Created October 12, 2022 02:41 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation
@bxb100
bxb100 / NIX install in macOS.md
Last active September 4, 2022 02:47
It's work for me on Apple Silicon
@bxb100
bxb100 / CodoFormatRef.md
Last active July 31, 2022 03:39
代码格式引用

rust

不过,过长的代码行难以阅读,所以最好拆开来写。通常来说,当使用 .method_name() 语法调用方法时引入换行符和空格将长的代码行拆开是明智的。现在来看看这行代码干了什么。[^1]