Skip to content

Instantly share code, notes, and snippets.

Avatar
🐾
Nyaa~

zthxxx zthxxx

🐾
Nyaa~
View GitHub Profile
View cloud-ide-setup.sh
# https://code.visualstudio.com/docs/editor/command-line#_working-with-extensions
# code --list-extensions
code --uninstall-extension cduruk.thrift
code --uninstall-extension byted-sec.bytesec-vscode
code --uninstall-extension byted-ide.ppe-debug
code --uninstall-extension byted-ide.ftt
code --uninstall-extension byted-ide.cloud-dev-task
code --uninstall-extension byted-ide.cloud-dev-debug
code --install-extension shalldie.background
@zthxxx
zthxxx / .lunar-vim-install.sh
Last active April 21, 2023 07:00
installation for LunarVim
View .lunar-vim-install.sh
# https://www.lunarvim.org/
# https://www.lunarvim.org/docs/installation
brew install neovim rust
brew tap homebrew/cask-fonts
brew install --cask font-hack-nerd-font
npm i -g neovim
# install without asking confirm plugins (asking default in official)
View .sources.mts
import path from 'path'
import { spawn } from 'child_process'
import { promises as fs } from 'fs'
import readline from 'readline'
import { chunk } from 'lodash-es'
/**
* usage:
* tsx <path>/.sources.mts <target dir>
*/
@zthxxx
zthxxx / .deps.mts
Last active August 29, 2022 07:27
some scripts for analysis dependency graph from entry, with result of dependency-cruiser
View .deps.mts
import path from 'path'
import { argv, fs } from 'zx'
import type { IModule } from 'dependency-cruiser'
import {
keyBy,
} from 'lodash-es'
/**
* depcruise -p -c dependency-cruiser.config.js --output-type json src > .logs/depcruise/src.json
*/
@zthxxx
zthxxx / comb-import.mts
Last active July 27, 2022 15:00
梳理代码依赖项
View comb-import.mts
/**
* download command:
* curl -O https://gist.githubusercontent.com/zthxxx/6306cab0615df6c0545bbc4fb07179dc/raw/comb-import.mts
*/
import path from 'path'
import os from 'os'
import { $, argv, fs } from 'zx'
@zthxxx
zthxxx / codeshift-duplicate-import.ts
Created July 26, 2022 09:16
auto merge duplicate import, support distinguish between import and import type, but not support with namespace import or duplicate default import
View codeshift-duplicate-import.ts
import {
namedTypes as types,
} from 'ast-types'
import type {
Options as RecastOptions,
} from 'recast'
import type {
Transform,
FileInfo,
API,
View expression.pegjs
{
/**
* pegjs grammar:
* https://github.com/pegjs/pegjs/blob/7d13580855/docs/grammar/README.md
* https://github.com/pegjs/pegjs/blob/7d13580855/docs/grammar/action-execution-environment.md
*
* playground: https://pegjs.org/online
*
* > pegjs expression.pegjs -o parser.js --format es
*/
@zthxxx
zthxxx / gist:2599867d9da448f76cb401c3e2ba094f
Last active January 25, 2022 06:32
spotlight indexing turn off and only enable for specify dir
View gist:2599867d9da448f76cb401c3e2ba094f
sudo mdutil -a -i off
sudo mdutil -V /System/Volumes/Data/Applications -i on
View git-data-for-package-lock.sh
git fetch --all
# 7 天内有多少 commit 改动了 package-lock
git log --format=format:'%h' --no-merges --since="7 days ago" --all -- package-lock.json | wc -l
# 7 天内所有 commit 共产生了多少完全无重复的 package-lock
git log --format=format:'%h' --no-merges --since="7 days ago" --all -- package-lock.json | \
xargs -I{} git ls-tree {} package-lock.json | \
sort | uniq | wc -l
View git-search-when-delete-files.sh
git log --name-status --diff-filter=D <file / dir>