summaryrefslogtreecommitdiff
path: root/encode_html.sh
blob: 0672c5666e2ee2b44815cf615a1d22b6ed84c9a9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh

page=index

[ -n "${1}" ] && page=${1}

[ ! -f "${page}.html" ] && exit 1

# Copy HTML to a web server....
scp ${page}.html prometheus.ethernal.org:public_html/arduino.html

# Fetch HTML with appropriate Accept-Encoding: header -> save to raw file
/bin/echo -ne "GET /~mjb/arduino.html HTTP/1.0\nAccept-Encoding: gzip\n\n" | nc www.ethernal.org 80  > ${page}_gzip.raw

# Process Raw file - delete headers and blank line -> save to raw gzip dat file
sed -e '0,/^\r$/d' ${page}_gzip.raw                                                                  > ${page}_gzip.dat

# Process raw gzip dat file into hex array for inclusion in program
od -A n -t x1 ${page}_gzip.dat | sed -e 's/ \(..\)/0x\1, /g' -e 's/^/      /'                        > ${page}_gzip.txt

ls -l ${page}_gzip.*