-
Notifications
You must be signed in to change notification settings - Fork 3
/
curl
86 lines (63 loc) · 3.52 KB
/
curl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Download a single file
curl http://path.to.the/file
# Download a file and specify a new filename
curl http://example.com/file.zip -o new_file.zip
# Download multiple files
curl -O URLOfFirstFile -O URLOfSecondFile
# Download all sequentially numbered files (1-24)
curl http://example.com/pic[1-24].jpg
# 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
# Get an FTP directory listing
curl ftp://username:password@example.com
# Resume a previously failed download
curl -C - -o partial_file.zip http://example.com/file.zip
# 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
# Limit the rate of a download
curl --limit-rate 1000B -O http://path.to.the/file
# query gerrit rest api
curl -X GET --digest --user username:http-password 'http://192.168.65.19:8080/a/changes/?q=status:open'
# alertover
curl -s \
--form-string "source=s-138cdc2f-8624-461c-8cdf-3ebf5931" \
--form-string "receiver=g-364ec0e4-5c27-4fbb-a899-040eea16" \
--form-string "content=hello world" \
--form-string "title=hello" \
https://api.alertover.com/v1/alert
# query file size
$ curl -sI https://mirrors.tuna.tsinghua.edu.cn/aosp-monthly/aosp-latest.tar | grep Content-Length | awk '{print $2}'
21279242240
# download by split it into 3 part
$ curl --range 0-9999999999 aosp-latest.tar.part1 https://mirrors.tuna.tsinghua.edu.cn/aosp-monthly/aosp-latest.tar
$ curl --range 10000000000-19999999999 aosp-latest.tar.part1 https://mirrors.tuna.tsinghua.edu.cn/aosp-monthly/aosp-latest.tar
$ curl --range 20000000000- aosp-latest.tar.part1 https://mirrors.tuna.tsinghua.edu.cn/aosp-monthly/aosp-latest.tar
# owncloud upload and download
## create folder
curl -u user:pass -X MKCOL "http://example.org/owncloud/remote.php/webdav/$(date '+%d-%b-%Y')"
## upload
curl -u 'user':'password' -T target_file "http://192.168.67.50/remote.php/webdav/public/""target_file"
## move file
curl -u user:pass -X MOVE --header 'Destination: http://example.org/owncloud/remote.php/webdav/target.jpg' http://example.org/owncloud/remote.php/webdav/source.jpg
## webdav get file
curl --digest --user username:password https://store-12345.mybigcommerce.com/dav/exports/products-2012-10-05.csv --output products-2012-10-05.csv
## process cookie
curl -X POST -c ${temp_dir}/cookie_gerrit.txt \
--data-urlencode "username=${GERRIT_HTTP_USER}" \
--data-urlencode "password=${GERRIT_HTTP_PASSWORD}" \
"${GERRIT_HTTP_BASE_URL}/login/"
curl -X GET -b ${temp_dir}/cookie_gerrit.txt "${GERRIT_HTTP_BASE_URL}/plugins/gitiles/${project}/+log/${old_sha1}..${new_sha1}?format=JSON" | sed '1d'
## get all qcom projects
curl https://source.codeaurora.org/ | hxselect 'td.sublevel-repo a' | sed '1i<xml>' | sed '$a</xml>' | xmlstarlet sel -t -m "/xml/a" -v "concat(@href, ' ')" | xargs -n 1 | sed -E 's#^([^/]*)/#\1#g; s#/([^/]*)$#\1#g'
# get all aosp projects
export https_proxy=http://ldap:username@proxy
curl https://android.googlesource.com/ | hxnormalize -x | hxselect 'body div.RepoList a.RepoList-item' | sed '1i<xml>' | sed '$a</xml>' | xmlstarlet sel -t -m "/xml/a" -v "concat(@href, ' ')" | xargs -n 1 | sed -E 's#^([^/]*)/#\1#g; s#/([^/]*)$#\1#g'
# oneline install
curl -s "https://get.sdkman.io" | bash
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -