Skip to content

Instantly share code, notes, and snippets.

@hdemon
Last active March 12, 2023 13:26
Show Gist options
  • Save hdemon/e231d2735fe892b368327c9c971662bb to your computer and use it in GitHub Desktop.
Save hdemon/e231d2735fe892b368327c9c971662bb to your computer and use it in GitHub Desktop.
# Rename files recursively
find . -name "*.jsx" -type f | xargs rename "s/hoge/fuga/g"
# Rename files
for f in *; do mv "$f" "${f/%./}"; done
# Retrieve only file name (eliminate paths)
find . -name "*.png" -type f | awk -F/ '{print $NF}'
# プロンプトを出さずにキーを生成
ssh-keygen -P "" -f ~/.ssh/id_rsa.dotfiles
# git logのcommitterとかを一斉に修正
git filter-branch -f --commit-filter '
if [ "$GIT_COMMITTER_EMAIL" = "[email protected]" ];
then
GIT_COMMITTER_NAME="Masami Yonehara";
GIT_COMMITTER_EMAIL="";
GIT_AUTHOR_NAME="Masami Yonehara";
GIT_AUTHOR_EMAIL="";
git commit-tree "$@";
else
git commit-tree "$@";
fi' HEAD
# domainの名前を調べる
defaults domains | perl -pe 's/,/\n/g'
# digitalocean上のcoreOSのdropletにsshで接続する
ssh [email protected] -i ~/.ssh/id_rsa.digitalocean
# docker machineを使う
docker-machine create default
docker-machine start default
# expressのskeletonを作る
npm install express-generator -g
express hoge
# ディレクトリを含めずに圧縮
zip -j android.zip android/*
# zip android.zip android/* こうやってもandroidディレクトリごと圧縮される
# rename multiple files
rename "s/hoge/fuga/g" *.png
# 昨日から今日のうちに作られた、もしくは更新があったissueの一覧のquery
assignee = currentUser() AND resolution = Unresolved AND (created >= startOfDay("-24h") OR updated >= startOfDay("-24h"))
# ファイルが存在しない場合
if [ ! -e ./foo ]
then
echo "foo is not found."
fi
#
s3cmd --no-mime-magic --guess-mime-type sync dir s3url
# 動いているdocker containerの中に入る
docker exec -it {container_id} /bin/sh
# docker containerの中に curl localhostでアクセスできない
docker-machine ip
# Make sure storage capacity.
df -h
# focus to adress bar
⌘-L
# Open the Clear Browsing Data options
⌘ + Shift + Delete
# Jump to the last tab ⌘ + 9
# Snippet for react / redux
https://marketplace.visualstudio.com/items?itemName=EQuimper.react-native-react-redux
# What I can do by javascript booster
https://marketplace.visualstudio.com/items?itemName=sburg.vscode-javascript-booster
# POST json with curl
curl -H 'Content-Type:application/json' -H 'User-Agent:iPhone' -H 'Accept-Encoding:gzip,deflate' -d "{"key":"val","key2":",val2"}" http://~~~~~~~~~~
# 正規表現の動きがわからん
https://regexper.com
# マッチした行だけ返す
perl -ne 'print if /hogehoge/'
# git grepで前後10行を表示
git grep -C 10 ...
# git grepで続く10行を表示
git grep -A 10 ...
#
is:pr assignee:... is:merged:>=2022-10-1 -label:...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment