Created
April 18, 2019 12:52
-
-
Save SergioGeeK7/1c5dc668f254f4015ad44cbcff692102 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------ | |
stat file | |
ln -s | |
Control + A beginning of the line | |
Control + E end of the line | |
echo '{"a": {"b":123 } }' | jq '.a.b' | |
curl -s https://api.github.com/repos/facebook/react | jq '.stargazers_count' | |
curl -s https://api.github.com/search/repositories?q=service+worker | jq '.items[].name' | |
cat filename | |
grep pattern | |
for dep in $(jq -r '.dependencies | keys | .[]' package.json); do | |
if ! grep "require\(.*$dep.*\)" -Rq --exclude-dir="node_modules" .; then | |
echo "You can probably remove $dep" | |
fi | |
done | |
------------------ | |
> // Redirect stdout | |
$ ls 1> ls.txt | |
ls noexist 2> ls-errs.txt | |
cat < ls.txt | |
ls > ls.txt 2>&1 | |
----------------- | |
exec >> log/hooks-out.log 2>&1 | |
if git diff-tree --name-only --no-commit-id ORIG_HEAD HEAD | grep --quiet 'package.json'; then | |
echo "$(date): Running npm install because package.json changed" | |
# redirecting stdout to dev/null trashes quiets the stdout, but it's stderr will go to our log file | |
npm install > /dev/null | |
else | |
echo "$(date): No changes in package.json found" | |
fi | |
---------------- | |
case "$1" in | |
*.tar|*.tgz) tar -xzvf "$1";; | |
*.gz) gunzip -k "$1";; | |
*.zip) unzip -v "$1";; | |
*) | |
echo "Cannot extract $1" | |
exit 1 | |
;; | |
esac | |
---------------- | |
dir=${1:-$PWD} | |
Find "$dir" -type f -maxdepth 1 | wc -l | |
--------------- | |
touch script.sh | |
chmod +x !$ | |
--------------- | |
#adding something to path | |
export PATH "$PATH:~/my-scripts" | |
--------------- | |
git rebase -i [commit] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment