Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.

Commit 550da29

Browse files
committed
Add missing d3.js license info, and also add back hex2c.sh shell script
Signed-off-by: deadprogram <[email protected]>
1 parent 3b11405 commit 550da29

File tree

6 files changed

+9819
-9603
lines changed

6 files changed

+9819
-9603
lines changed

docs/cpp/bin/hex2c.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
if [[ $# -ne 1 ]]; then
4+
echo "Usage: $0 FILENAME"
5+
exit 1
6+
fi
7+
file=$1
8+
9+
if [[ ! -f "$file" ]]; then
10+
echo "File not found: $file"
11+
exit 1
12+
fi
13+
14+
cname=$file
15+
cname=${cname//-/_}
16+
cname=${cname//./_}
17+
18+
echo "static unsigned char $cname[] = {"
19+
hexdump -v -e '" " 16/1 " 0x%02x, " "\n"' $file | \
20+
sed -e '$s/0x ,//g'
21+
echo "};"

docs/cpp/how-to-run-the-shellscript.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
11
# How to Run the Shell Script
22

3-
### If changes are made to your html or css you will need to follow these instructions
4-
(Windows Users Only)
3+
If changes are made to your html or css you will need to regenerate it by running the `hex2c.sh` shell script.
4+
5+
### OSX/Linux
6+
7+
Just run the command on the file you want to regenerate, piping the output to the destination file. For example, to regenerate the range finder scanner's `index.html` file, you would run the following command:
8+
9+
```
10+
./docs/cpp/bin/hex2c.sh ./range-finder-scanner/cpp/html/index.html > ./range-finder-scanner/cpp/src/html.h
11+
```
12+
13+
The resulting `html.h` contains the hex encoded version of the `index.html` as a C header file. This allows a single file executable with all assets included in the file itself, hence no external dependencies.
14+
15+
### Windows
516

617
1. Go to https://cygwin.com/
718
![](./../../images/cpp/shell-script.png)
819

920
2. Go to the downloads section.
1021
![](./../../images/cpp/shell-script2.png)
1122

12-
3. Download and run the exe.
23+
3. Download and run the exe.
1324
![](./../../images/cpp/shell-script3.png)
1425

1526
4. Only use default install!!! Download will be several gigabytes if you install all.
@@ -33,17 +44,17 @@
3344
10. Open your windows command promt.
3445
![](./../../images/cpp/shell-script10.png)
3546

36-
11. Find the directory the your shell script command is as well as your html and css files. For ease of use I put them in the same folder on my desktop. Now type "hex2c.sh index.html"
47+
11. Find the directory the your shell script command is as well as your html and css files. For ease of use I put them in the same folder on my desktop. Now type "hex2c.sh index.html"
3748
![](./../../images/cpp/shell-script11.png)
3849

3950
12. You may have to change the height and wisth of your command prompt for everything to fit.
4051
![](./../../images/cpp/shell-script12.png)
4152

42-
13. Copy the hex code completly. Right click at the top bar of the command promt. Click edit -> mark.
53+
13. Copy the hex code completly. Right click at the top bar of the command promt. Click edit -> mark.
4354
![](./../../images/cpp/shell-script13.png)
4455

4556
14. You can now hightlight the whole file. Press enter to copy.
4657
![](./../../images/cpp/shell-script14.png)
4758

48-
15. Finally open a new text document and paste the code inside. Then rename the document html.h and you now have the file you need if you modified your html or css.
49-
![](./../../images/cpp/shell-script15.png)
59+
15. Finally open a new text document and paste the code inside. Then rename the document html.h and you now have the file you need if you modified your html or css.
60+
![](./../../images/cpp/shell-script15.png)

range-finder-scanner/cpp/html/index.html

Lines changed: 39 additions & 2 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)