Merge branch 'master' of https://github.com/Ashernor/cheat into Ashernor-master

* 'master' of https://github.com/Ashernor/cheat:
  Adding wget and curl cheats and updating git cheat

Conflicts:
	cheatsheets/curl
This commit is contained in:
Chris Lane 2013-10-23 22:04:31 -04:00
commit fb5721f887
3 changed files with 38 additions and 9 deletions

View File

@ -1,24 +1,35 @@
# Download a file preserving the filename. # Download a single file
curl http://example.com/file.zip -O curl http://path.to.the/file
# Download a file and specify a new filename. # Download a file and specify a new filename
curl http://example.com/file.zip -o new_file.zip curl http://example.com/file.zip -o new_file.zip
# Fetch only the HTTP headers from a response. # Download multiple files
curl -I http://example.com curl -O URLOfFirstFile -O URLOfSecondFile
# Download all sequentially numbered files (1-24) # Download all sequentially numbered files (1-24)
curl http://example.com/pic[1-24].jpg curl http://example.com/pic[1-24].jpg
# Download a file from FTP. # Download a file and pass HTTP Authentication
curl -u username:password URL
# Download a file with a Proxy
curl -x proxysever.server.com:PORT http://addressiwantto.access
# Download a file from FTP
curl -u username:password -O ftp://example.com/pub/file.zip curl -u username:password -O ftp://example.com/pub/file.zip
# Get an FTP directory listing. # Get an FTP directory listing
curl ftp://username:password@example.com curl ftp://username:password@example.com
# Resume a previously failed download. # Resume a previously failed download
curl -C - -o partial_file.zip http://example.com/file.zip curl -C - -o partial_file.zip http://example.com/file.zip
# Fetch your external IP and network info. as JSON. # Fetch only the HTTP headers from a response
curl -I http://example.com
# Fetch your external IP and network info as JSON
curl http://ifconfig.me/all/json curl http://ifconfig.me/all/json
# Limit the rate of a download
curl --limit-rate 1000B -O http://path.to.the/file

View File

@ -25,6 +25,7 @@ git remote add upstream git@github.com:name/repo.git # Set a new repo
git remote -v # Confirm new remote repo git remote -v # Confirm new remote repo
git fetch upstream # Get branches git fetch upstream # Get branches
git branch -va # List local - remote branches git branch -va # List local - remote branches
git branch -D branch_name # Delete the branch branch_name
git checkout master # Checkout local master branch git checkout master # Checkout local master branch
git checkout -b branch # Create and checkout a new branch git checkout -b branch # Create and checkout a new branch
git merge upstream/master # Merge remote into local repo git merge upstream/master # Merge remote into local repo

17
cheatsheets/wget Normal file
View File

@ -0,0 +1,17 @@
# To download a single file
wget http://path.to.the/file
# To download a file and change its name
wget http://path.to.the/file -o newname
# To download multiples files with multiple URLs
wget URL1 URL2
# To parse a file that contains a list of URLs to fetch each one
wget -i url_list.txt
# To download files according to a pattern
wget http://www.myserver.com/files-{1..15}.tar.bz2
# To download all the files in a directory with a specific extension if directory indexing is enabled
wget -r -l1 -A.extension http://myserver.com/directory