Skip to content

Instantly share code, notes, and snippets.

View xiaolai's full-sized avatar
🎯
Focusing

xiaolai xiaolai

🎯
Focusing
View GitHub Profile
@xiaolai
xiaolai / index.html
Last active November 27, 2022 09:15
Electron Fiddle Gist
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'">
<link href="./styles.css" rel="stylesheet">
<title>Hello World!</title>
</head>
<body>
@xiaolai
xiaolai / 55-bytes-of-css.md
Created September 26, 2022 01:29 — forked from JoeyBurzynski/55-bytes-of-css.md
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@xiaolai
xiaolai / running-kindle-apk-on-Mac-with-M1-Chip.md
Last active July 24, 2022 13:02
在 M1 芯片苹果电脑上运行 Kindle 安卓版

这些年我在 Amazon 上买了几近千本的电子书(其中相当一部分配有有声版的 Audiobook)。在 iOS(iPad/iPhone)上体验还算可以,有 Kindle App,也有 Audible App —— 唯一的缺陷是,每次换设备的时候,都得重新下载一遍,并且,Amazon 的开发人员执拗地在这么多年过后也不给加一个「全部下载」的方式…… 我甚至开始不讲道理地怀疑这帮鸟人自己的 Kindle 里都不超过十本书,所以才不把「下载全部」当回事儿。

MacOS 上一直就没有 Audible,得通过 iTunes 转手一遍,非常讨厌;而 Kindle App 就更讨厌了,一直保持着远古时代的 UI 不说,这都好多年了,坚决不给加上「如果有配套有声书的话就可以边朗读边划线阅读」的功能 —— 而这功能恰恰是 iOS 上的 Kindle App 最令人喜欢的,乃至于其它功能差一点都能因此忍受的……

MacOS Big Sur 刚推出的时候,增加了个功能,就是 iOS 的 App 可以直接安装到 MacOS 上 —— 真是太棒了!可惜,没高兴几天,苹果给了开发者一个选择,Amazon 的开发者选择的结果是,在 MacOS 上不能安装 Kindle for iOS,在 MacOS 只能接着用他们那个愚蠢到死的桌面版本 —— Kindle for Desktop 的团队就应该直接解散掉啊!一个常年只能打两颗星的产品,不应该着急一点吗?

现在在 MacOS App Store 里搜索 Kindle(iPhone & iPad Apps)不再显示 Kindle 了,搜出来的都是不相干的玩意……

于是,想到了个办法:

@xiaolai
xiaolai / Personal Library.md
Last active June 6, 2022 14:01
My own library
  1. Download and pin books at https://read.amazon.com, and use epubor KCR converter to convert them into epubs.
  2. Download audio books at https://audible.com, with aax format.
  3. Obtain your activation bytes with the instruction of this post.
  4. Install ffmpeg with brew.
  5. Install audible-converter with npm. (File name will be extended automatically)
audible-converter "*.aax" -a <your-activation-bytes>
  1. Install atomicparsley with brew. (to add artwork to converted m4a files) Bash script to add artworks to m4a files:
@xiaolai
xiaolai / Python 2 and Alfred on macOS Monterey.md
Last active March 27, 2022 03:15
Python 2 and Alfred on macOS Monterey
@xiaolai
xiaolai / multiple-github-account.md
Created October 21, 2021 01:46
multiple account on github with ssh-key

In Terminal:

ssh-keygen -t rsa -f "id_rsa_<new account name>" -C "<email of new account>"
ssh-add ~/.ssh id_rsa_<new account name>

Edit ~/.ssh/config:

Host 
@xiaolai
xiaolai / open-terminal-here.applescript
Created September 5, 2021 05:10
Open Terminal Here
tell application "Finder"
if (count of windows) > 0 then
set thePath to target of front window
else
display dialog "There are no open Finder windows." with icon caution buttons {"OK"} with title "Open Terminal Here..."
return
end if
end tell
if not (exists thePath) then
@xiaolai
xiaolai / keybindings.json
Created October 17, 2021 07:05
VSCode enclose selection with unicode braces.md
[
{
"key": "ctrl+shift+'",
"command": "editor.action.insertSnippet",
"args": {"snippet": "“$TM_SELECTED_TEXT$0”"},
"when": "editorTextFocus&&editorHasSelection"
},
{
"key": "ctrl+'",
"command": "editor.action.insertSnippet",
@xiaolai
xiaolai / dart_and_flutter.md
Last active October 8, 2021 08:55
Dart & Flutter
# xcode needed
brew install flutter cocoapods android-studio chrome visual-studio-code
flutter doctor --android-licenses
flutter doctor
@xiaolai
xiaolai / ubuntu_at_redmibook.md
Last active September 25, 2021 07:32
UBUNTU@RedmiBook

禁用睡眠

systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

启用睡眠

systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target

盖板动作