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

Commit

Permalink
Add missing d3.js license info, and also add back hex2c.sh shell script
Browse files Browse the repository at this point in the history
Signed-off-by: deadprogram <[email protected]>
  • Loading branch information
deadprogram committed Jul 28, 2016
1 parent 3b11405 commit 550da29
Show file tree
Hide file tree
Showing 6 changed files with 9,819 additions and 9,603 deletions.
21 changes: 21 additions & 0 deletions docs/cpp/bin/hex2c.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

if [[ $# -ne 1 ]]; then
echo "Usage: $0 FILENAME"
exit 1
fi
file=$1

if [[ ! -f "$file" ]]; then
echo "File not found: $file"
exit 1
fi

cname=$file
cname=${cname//-/_}
cname=${cname//./_}

echo "static unsigned char $cname[] = {"
hexdump -v -e '" " 16/1 " 0x%02x, " "\n"' $file | \
sed -e '$s/0x ,//g'
echo "};"
25 changes: 18 additions & 7 deletions docs/cpp/how-to-run-the-shellscript.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
# How to Run the Shell Script

### If changes are made to your html or css you will need to follow these instructions
(Windows Users Only)
If changes are made to your html or css you will need to regenerate it by running the `hex2c.sh` shell script.

### OSX/Linux

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:

```
./docs/cpp/bin/hex2c.sh ./range-finder-scanner/cpp/html/index.html > ./range-finder-scanner/cpp/src/html.h
```

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.

### Windows

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

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

3. Download and run the exe.
3. Download and run the exe.
![](./../../images/cpp/shell-script3.png)

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

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"
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"
![](./../../images/cpp/shell-script11.png)

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

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

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

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.
![](./../../images/cpp/shell-script15.png)
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.
![](./../../images/cpp/shell-script15.png)
41 changes: 39 additions & 2 deletions range-finder-scanner/cpp/html/index.html

Large diffs are not rendered by default.

Loading

0 comments on commit 550da29

Please sign in to comment.