Skip to content

Instantly share code, notes, and snippets.

@Shawn1224
Shawn1224 / setup.sh
Last active November 24, 2022 14:30
macos-dev-setup
#! /bin/bash
xcode-select --install
# get back from another machine
# brew bundle dump
# ----------------------------------------------------- basic ----------------------------------------------------- #
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew doctor
@Shawn1224
Shawn1224 / mkdir-at-root-on-mac-big-sur.md
Last active August 23, 2021 14:58
When you run command mkdir in mac os to create a folder, it gives you an error message `mkdir: /data: Read-only file system`

Usually fellow the steps below of the first method is fine. But in some higher versions of macOS, beyond 10.0.1 or Big Sur does not work, in my personal expirence.

  1. https://www.dev2qa.com/how-to-fix-read-only-file-system-error-when-run-mkdir-command-on-macos/
  1. Restart macOS, press Command+R to go to macOS utilities window.

  2. Click menu item Utilities —> Terminal at top menu bar.

  3. Then input command csrutil disable in the popup terminal window. This command will disable the System Integrity Protection.

@Shawn1224
Shawn1224 / passing-values-to-generators.js
Created August 3, 2021 16:35 — forked from ericelliott/passing-values-to-generators.js
Passing values into generators through `.next()`
function* crossBridge() {
const reply = yield 'What is your favorite color?';
console.log(reply);
if (reply !== 'yellow') return 'Wrong!'
return 'You may pass.';
}
{
const iter = crossBridge();
const q = iter.next().value; // Iterator yields question
[uwsgi]
strict = true ; 显式声明!要啥配啥,不要瞎配没有的东西,有的可能有但是不一定兼容,没有用的就不要配了
py-autoreload = 1 ; 修改代码后自动重启
chdir = /data/service/xxx
wsgi-file = xxx/wsgi.py
pidfile = ./project-master.pid
master = true
enable-threads = true
protocol = uwsgi
# https://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
@Shawn1224
Shawn1224 / open-app.md
Created July 28, 2021 02:08
Open multiple mac app instances
open -n "../xxx.app"
@Shawn1224
Shawn1224 / delete_branch.md
Created January 29, 2021 03:30
Set an alias command to quickly delete git branch completely.
  1. Create a shell file
touch ~/del_branch.sh
  1. Put below into the file
#!/bin/bash
echo "exec $0"
set -x
@Shawn1224
Shawn1224 / git-config-locally.sh
Last active January 29, 2021 03:27
git config locally
git init
git config --local --list
git config user.email "nobodylovesuwhenurdownnout@gmail.com"
git config user.name "Bart"
@Shawn1224
Shawn1224 / uninstall-huawei-pre-installed-apps.sh
Created September 4, 2020 07:50
uninstall Huawei pre installed apps.
adb shell pm uninstall --user 0 com.huawei.hifolder
adb shell pm uninstall --user 0 com.huawei.hiview
adb shell pm uninstall --user 0 com.huawei.motionservice
adb shell pm uninstall --user 0 com.huawei.parentcontrol
adb shell pm uninstall --user 0 com.huawei.regservice
@Shawn1224
Shawn1224 / frontend-rules.md
Created July 25, 2020 09:55
Some coding rules about frontend

Tips

  • 驼峰命名法该如何解决某些单词需要大写的问题?

    如果单词缩写是两个字母的,则全大写,例如是 IOException 而不是 IoException。 如果单词缩写超过两个字母,则第一个字母大写,其余字母小写。

  • 🚫<br>

    <br> 来换行或作间距可不是好主意,如果不是文章/邮件的排版等特别需要,请不要用 <br>, 用 styles