Skip to content

Instantly share code, notes, and snippets.

View xiaolai's full-sized avatar
🎯
Focusing

xiaolai xiaolai

🎯
Focusing
View GitHub Profile
@xiaolai
xiaolai / github.sh
Created December 25, 2022 08:43
Bash Function to Open a Gepo's Github Page from Terminal
function github {
if [ -d .git ]; then
remotes=$(git remote -v | head -1 | awk -F'git@github.com:' '{print $2}' | cut -d" " -f1)
if [ -z "$remotes" ];
then
remotes=$(git remote -v | awk -F'https://github.com/' '{print $2}' | cut -d" " -f1)
fi
remote_url=$(echo $remotes | cut -d" " -f1)
url="https://github.com/"
@xiaolai
xiaolai / iina-as-an-audiobook-player.md
Last active June 25, 2023 23:44
A better way to listen audiobook on MacOS
@xiaolai
xiaolai / download-all-my-kindle-books.ipynb
Last active August 16, 2023 01:17
a jupyter notebook for downloading all books to devices, using Selenium.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@xiaolai
xiaolai / Using various profiles for vscode.md
Last active December 5, 2022 12:31
Using various profiles for vscode.md
alias codedefault="/opt/homebrew/bin/code"
alias code="codedefault --extensions-dir $HOME/.vscode/default/extentions --user-data-dir $HOME/.vscode/default/user"
alias codedart="codedefault --extensions-dir $HOME/.vscode/dart/extentions --user-data-dir $HOME/.vscode/dart/user"
alias codejs="codedefault --extensions-dir $HOME/.vscode/js/extentions --user-data-dir $HOME/.vscode/js/user"
alias codego="codedefault --extensions-dir $HOME/.vscode/go/extentions --user-data-dir $HOME/.vscode/go/user"
alias codemd="codedefault --extensions-dir $HOME/.vscode/markdown/extentions --user-data-dir $HOME/.vscode/markdown/user"
alias codepy="codedefault --extensions-dir $HOME/.vscode/python/extentions --user-data-dir $HOME/.vscode/python/user"
@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 / notion.md
Last active April 24, 2024 23:40
Change fonts of Notion APP

Change font settings for Notion (Web/Desktop App)

Notion provides only three fonts to choose... I have to inject css styles to meet my ends, using Stylus extension for Edge and Nativefier for Desktop App.

notion.css

.notion-page-content {
    font-family: 'Kaiti SC'
} 
@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 / 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 / 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",