Created
September 7, 2012 02:07
-
-
Save japboy/3662565 to your computer and use it in GitHub Desktop.
Useful commands that I can easily forget :P
This file contains 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
#!/bin/sh | |
# Change file permission recursively | |
find /path/to/dir -type f | xargs chmod 644 | |
# Or this is also same as above | |
find /path/to/dir -type f -exec chmod 644 {} \; | |
# Or change file and directory permission recursively and appropriately | |
# 644 for files, and 755 for directories | |
chmod -R u=rwX,g=rX,o=rX /path/to/dir |
This file contains 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
#!/bin/sh | |
# Transcode files recursively | |
for f in *.MTS; do ffmpeg -i ${f} -vcodec copy -acodec copy ${f}.MP4; done |
This file contains 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
#!/bin/sh | |
# Snapshot all the files from the specified revision | |
git archive --format=tar HEAD | tar xf - -C /path/to | |
# Remove all of globally installed node modules | |
git submodule update --init | |
# Update a specific branch to include content from specific directory | |
BRANCH='gh-pages' | |
DIRECTORY='gh-pages' | |
BRANCH_SHA=$(git show-ref -s refs/heads/${BRANCH}) | |
DIRECTORY_SHA=$(git ls-tree -d HEAD ${DIRECTORY} | awk '{print $3}') | |
COMMIT=$(echo 'Auto-update.' | git commit-tree ${DIRECTORY_SHA} -p ${BRANCH_SHA}) | |
git update-ref refs/heads/${BRANCH} ${COMMIT} |
This file contains 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
#!/bin/sh | |
# Remove all of globally installed node modules | |
npm -g ls | grep -v 'npm@' | awk '/@/ {print $2}' | awk -F@ '{print $1}' | xargs npm -g rm |
This file contains 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
#!/bin/sh | |
# Generate a set of self-signed SSL certificate | |
# Secret key | |
openssl genrsa -out spdy-key.pem 1024 | |
# Public key | |
openssl req -new -key spdy-key.pem -out spdy-csr.pem | |
# Certificate | |
openssl x509 -req -in spdy-csr.pem -signkey spdy-key.pem -out spdy-cert.pem |
This file contains 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
#!/bin/sh | |
# Remove only files recursively | |
find . -type f -exec rm -f {} \; |
This file contains 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
#!/bin/sh | |
# Remove all of installed gems | |
gem list | cut -d" " -f1 | xargs gem uninstall -aIx | |
This file contains 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
#!/bin/sh | |
# Display HTTP requests and responses in ASCII format | |
tcpdump -A -tttt host example.com port 80 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment