Skip to content

Instantly share code, notes, and snippets.

View secvalve's full-sized avatar

Catherine (Kate) Pearce secvalve

View GitHub Profile
@secvalve
secvalve / parabaxel.sh
Last active May 25, 2016 02:30
A bash script that uses CURL to get a file in parts, ala axel. Paralellised version of baxel https://gist.github.com/secvalve/fbe41b7cc45812e386c6c8ea95075d3c. Usage: parabaxel numparts url eg ./parabaxel 3 http://www.google.com/robots.txt robots.txt
#!/bin/bash
#$1 numparts, #$2 url, #$3 outfile
#Get total length
TL=$(curl -sI $2 | grep Content-Length | awk '{printf "%d", $2}')
echo "$s is $TL Bytes Long"
let CHUNKSIZE=$(( TL / $1 ));
parallel -k curl -s -r {} $2 ::: $(for i in `seq -f "%.0f" 0 $CHUNKSIZE $(( $TL - $CHUNKSIZE ))`; do echo "$i-`expr $i + $CHUNKSIZE`"; done) #> $3
@secvalve
secvalve / baxel.sh
Created May 25, 2016 00:34
A bash script that uses CURL to get a file in parts, ala axel. Usage: baxel numparts url eg ./baxel 3 http://www.google.com/robots.txt
#!/bin/bash
#$1 numparts, #$2 url
#Get length
TL=$(curl -sI $2 | grep Content-Length | awk '{printf "%d", $2}')
echo "$s is $TL Bytes Long”
#GetChunks
for i in `seq 0 $(( $1 - 1 ))`;
do