optimize scripts

This commit is contained in:
idea4good
2021-02-23 21:22:57 +08:00
parent af67132479
commit 7b161d332d
6 changed files with 58 additions and 51 deletions
+5 -6
View File
@@ -30,11 +30,11 @@
- Supported languages: C/C++, Swift, Java, Javascript, C#, Golang...
- Supported 3rd party libraries: Qt, MFC, Winforms, CoCoa...
## Useful features
## Hero features
- ☁️Cloud + IoT Solution: master your IoT business all over the world
- 🔣Multi-language, supports UTF-8;📀Playback Video
- 🔨[Toolkit](https://github.com/idea4good/GuiLiteToolkit) for building font/image resources
- 📐[Layout GUI WYSIWYG](https://github.com/idea4good/GuiLitePreviewer)
- ☁️Cloud + IoT Solution
- 📊Code Telemetry and Analysis in real time(*remove .sh/.bat files if dislike to share*)
- 📦Supports 3D and [Web](https://github.com/idea4good/GuiLiteWeb)
- 🐋Run in docker with a single command: `sudo docker run -it --privileged -v /dev:/dev-share idea4good/gui-lite:latest bash /run.sh`
@@ -142,9 +142,8 @@ Thanks for the help from the community, you all make GuiLite better! And welcome
- QQ group code:
<table>
<tr>
<td align="center"><a href="https://jq.qq.com/?_wv=1027&k=qfvGGAa7"><img src="documents/qq.group-1.jpg" width="240px;"/><br /><sub><b>超级群🥇527251257</b></sub></a>
<td align="center"><a href="https://jq.qq.com/?_wv=1027&k=yKnUJj1B"><img src="documents/qq.group-2.jpg" width="240px;"/><br /><sub><b>超级群🥈841031761</b></sub></a>
<td align="center"><a href="https://jq.qq.com/?_wv=1027&k=5hc3qwj"><img src="documents/qq.group-3.jpg" width="240px;"/><br /><sub><b>免费群🥉717471210</b></sub></a>
<td align="center"><a href="https://jq.qq.com/?_wv=1027&k=qfvGGAa7"><img src="documents/qq.group-1.jpg" width="240px;"/><br /><sub><b>专家群💎527251257</b></sub></a>
<td align="center"><a href="https://jq.qq.com/?_wv=1027&k=yKnUJj1B"><img src="documents/qq.group-2.jpg" width="240px;"/><br /><sub><b>专家群💎841031761</b></sub></a>
<td align="center"><a href="https://jq.qq.com/?_wv=1027&k=5hc3qwj"><img src="documents/qq.group-3.jpg" width="240px;"/><br /><sub><b>免费群🔑717471210</b></sub></a>
</tr>
</table>
欢迎有条件的同学加入“超级群”🚄⏪⏪⏪,一同打造全球最强Lite GUI👑
+4 -5
View File
@@ -29,10 +29,10 @@
- 支持的第3方库:Qt, MFC, Winforms, CoCoa...
## 实用的功能
- ☁️完美的“云” + “物联网”解决方案:让你轻松驾驭全球IoT业务
- 🔣支持多语言,采用 UTF-8 编码;📀支持视频播放
- 🔨[资源制作工具](https://github.com/idea4good/GuiLiteToolkit)为你定制自己的字体/图片资源
- 📐[所见即所得的GUI布局工具](https://github.com/idea4good/GuiLitePreviewer)
- ☁️完美的“云” + “物联网”解决方案
- 📊编译活跃度统计,及实时分析
- 📦支持3D & [Web](https://github.com/idea4good/GuiLiteWeb)
- 🐋支持Docker,一条命令启动Docker: `sudo docker run -it --privileged -v /dev:/dev-share idea4good/gui-lite:latest bash /run.sh`
@@ -139,9 +139,8 @@
- GuiLite开发者QQ群:
<table>
<tr>
<td align="center"><a href="https://jq.qq.com/?_wv=1027&k=qfvGGAa7"><img src="documents/qq.group-1.jpg" width="240px;"/><br /><sub><b>超级群🥇527251257</b></sub></a>
<td align="center"><a href="https://jq.qq.com/?_wv=1027&k=yKnUJj1B"><img src="documents/qq.group-2.jpg" width="240px;"/><br /><sub><b>超级群🥈841031761</b></sub></a>
<td align="center"><a href="https://jq.qq.com/?_wv=1027&k=5hc3qwj"><img src="documents/qq.group-3.jpg" width="240px;"/><br /><sub><b>免费群🥉717471210</b></sub></a>
<td align="center"><a href="https://jq.qq.com/?_wv=1027&k=qfvGGAa7"><img src="documents/qq.group-1.jpg" width="240px;"/><br /><sub><b>专家群💎527251257</b></sub></a>
<td align="center"><a href="https://jq.qq.com/?_wv=1027&k=yKnUJj1B"><img src="documents/qq.group-2.jpg" width="240px;"/><br /><sub><b>专家群💎841031761</b></sub></a>
<td align="center"><a href="https://jq.qq.com/?_wv=1027&k=5hc3qwj"><img src="documents/qq.group-3.jpg" width="240px;"/><br /><sub><b>免费群🔑717471210</b></sub></a>
</tr>
</table>
欢迎有条件的同学加入“超级群”🚄⏪⏪⏪,一同打造全球最强Lite GUI👑
-2
View File
@@ -71,9 +71,7 @@ widgets:
| core 重要程度/文件名称 | 代码简介 | 推荐学习时间 |
| --- | --- | --- |
| ★★★ wnd.cpp | UI元素的基本类,定义所有的UI元素信息、绘制及管理办法 | 1.5小时 |
| ★★ cmd_target.cpp | 映射UI消息及用户自定义的消息 | 0.5小时 |
| ★★ display.cpp | 生成显示设备,设定surface的数目,一个surface对应一个滑动页面 | 0.5小时 |
| ★★ surface.cpp| 实现像素点的绘制,并对各个图层(layer)进行管理 | 0.5小时 |
| word.cpp | 显示文字 | < 1小时 |
| bitmap.cpp | 绘制位图,支持16 bits和32 bits | < 0.5小时 |
| rect.cpp | UI元素的位置信息 | < 0.5小时 |
-2
View File
@@ -72,9 +72,7 @@ Rendering include rendering method and graphic management.
| core Importance/File name | Introduction | Time cost |
| --- | --- | --- |
| ★★★ wnd.cpp | Basic class for widgets; connect/disconnect widgets; response user on_touch, on_key action | 1.5 hour |
| ★★ cmd_target.cpp | map/dispatch GUI/user custom message | 0.5 hour |
| ★★ display.cpp | Initialize display device, create surface, | 0.5 hour |
| ★★ surface.cpp| Draw piexel/line/rect, and multi-layer management | 0.5 hour |
| word.cpp | Draw text | < 1 hour |
| bitmap.cpp | Draw bitmap | < 0.5 hour |
| rect.cpp | Rect for basic use(e.g, widgets location) | < 0.5 hour |
+22 -16
View File
@@ -5,25 +5,33 @@ fi
url="https://api.powerbi.com/beta/72f988bf-86f1-41af-91ab-2d7cd011db47/datasets/2ff1e8a8-2f6f-4d73-a75d-86829e3f4574/rows?key=8f5xLp1gP8%2FzSee4vCUBcyjR65I9zZ6nb%2B%2F7bbzex%2FSctLX3ntIlAR0sxWpDdguuYyDtLdHK%2Fxbxj%2FrSBkX7eQ%3D%3D"
build_time=`date +%Y-%m-%dT%H:%M:%S.000%z`
device_info="Linux-unknown"
device_info=`uname -s -n -m`
#--------------- Geo info ----------------#
curl ipinfo.io > ip_info.txt # get IP info
if [ ! -f "/tmp/ip_info.tmp" ]; then
curl ipinfo.io > /tmp/ip_info.tmp # get IP info
fi
grep city ip_info.txt > ip_city.txt # filter city
sed -i 's/"city"://g' ip_city.txt #remove property name
sed -i 's/"//g' ip_city.txt #remove double quotes
city=`sed 's/,//g' ip_city.txt` #remove comma
if [ ! -f "/tmp/ip_city.tmp" ]; then
grep city /tmp/ip_info.tmp > /tmp/ip_city.tmp # filter city
sed -i 's/"city"://g' /tmp/ip_city.tmp #remove property name
sed -i 's/"//g' /tmp/ip_city.tmp #remove double quotes
fi
city=`sed 's/,//g' /tmp/ip_city.tmp` #remove comma
grep country ip_info.txt > ip_country.txt # filter country
sed -i 's/"country"://g' ip_country.txt #remove property name
sed -i 's/"//g' ip_country.txt #remove double quotes
country=`sed 's/,//g' ip_country.txt` #remove comma
if [ ! -f "/tmp/ip_country.tmp" ]; then
grep country /tmp/ip_info.tmp > /tmp/ip_country.tmp # filter country
sed -i 's/"country"://g' /tmp/ip_country.tmp #remove property name
sed -i 's/"//g' /tmp/ip_country.tmp #remove double quotes
fi
country=`sed 's/,//g' /tmp/ip_country.tmp` #remove comma
grep org ip_info.txt > ip_org.txt # filter org
sed -i 's/"org"://g' ip_org.txt #remove property name
sed -i 's/"//g' ip_org.txt #remove double quotes
org=`sed 's/,//g' ip_org.txt` #remove comma
if [ ! -f "/tmp/ip_org.tmp" ]; then
grep org /tmp/ip_info.tmp > /tmp/ip_org.tmp # filter org
sed -i 's/"org"://g' /tmp/ip_org.tmp #remove property name
sed -i 's/"//g' /tmp/ip_org.tmp #remove double quotes
fi
org=`sed 's/,//g' /tmp/ip_org.tmp` #remove comma
curl --include --request POST --header "Content-Type: application/json" --data-binary "[{
\"device_info\" :\"$device_info\",
@@ -34,5 +42,3 @@ curl --include --request POST --header "Content-Type: application/json" --data-b
\"city\" :\"$city\",
\"org\" :\"$org\"
}]" $url > /dev/null
rm ip_*
+27 -20
View File
@@ -16,29 +16,38 @@ if not "%YY%" == "20" (rem For Chinese date format
for /f "tokens=1-3 delims=/ " %%a in ("%date%") do (set YYYY=%%a& set MM=%%b& set DD=%%c))
set datetime=%YYYY%-%MM%-%DD%T%time: =0%0+0800
set devie_info=Win-unknown
set devie_info=Win-%USERNAME%
rem ----------------- for GEO info -----------------
curl.exe ipinfo.io > ip_info.txt
findstr.exe country ip_info.txt > ip_country.txt
findstr.exe city ip_info.txt > ip_city.txt
findstr.exe org ip_info.txt > ip_org.txt
set tmpPath=%userprofile%\AppData\Local\Temp\
if not exist "%tmpPath%ip_info.tmp" (
curl.exe ipinfo.io > %tmpPath%ip_info.tmp
)
powershell -Command "(gc ip_country.txt) -replace '\"country\":', '' | Out-File -encoding ASCII ip_country.txt"
powershell -Command "(gc ip_country.txt) -replace '""' , '' | Out-File -encoding ASCII ip_country.txt"
powershell -Command "(gc ip_country.txt) -replace ',' , '' | Out-File -encoding ASCII ip_country.txt"
if not exist "%tmpPath%ip_country.tmp" (
findstr.exe country %tmpPath%ip_info.tmp > %tmpPath%ip_country.tmp
powershell -Command "(gc %tmpPath%ip_country.tmp) -replace '\"country\":', '' | Out-File -encoding ASCII %tmpPath%ip_country.tmp"
powershell -Command "(gc %tmpPath%ip_country.tmp) -replace '""' , '' | Out-File -encoding ASCII %tmpPath%ip_country.tmp"
powershell -Command "(gc %tmpPath%ip_country.tmp) -replace ',' , '' | Out-File -encoding ASCII %tmpPath%ip_country.tmp"
)
powershell -Command "(gc ip_city.txt) -replace '\"city\":', '' | Out-File -encoding ASCII ip_city.txt"
powershell -Command "(gc ip_city.txt) -replace '""' , '' | Out-File -encoding ASCII ip_city.txt"
powershell -Command "(gc ip_city.txt) -replace ',' , '' | Out-File -encoding ASCII ip_city.txt"
if not exist "%tmpPath%ip_city.tmp" (
findstr.exe city %tmpPath%ip_info.tmp > %tmpPath%ip_city.tmp
powershell -Command "(gc %tmpPath%ip_city.tmp) -replace '\"city\":', '' | Out-File -encoding ASCII %tmpPath%ip_city.tmp"
powershell -Command "(gc %tmpPath%ip_city.tmp) -replace '""' , '' | Out-File -encoding ASCII %tmpPath%ip_city.tmp"
powershell -Command "(gc %tmpPath%ip_city.tmp) -replace ',' , '' | Out-File -encoding ASCII %tmpPath%ip_city.tmp"
)
powershell -Command "(gc ip_org.txt) -replace '\"org\":', '' | Out-File -encoding ASCII ip_org.txt"
powershell -Command "(gc ip_org.txt) -replace '""' , '' | Out-File -encoding ASCII ip_org.txt"
powershell -Command "(gc ip_org.txt) -replace ',' , '' | Out-File -encoding ASCII ip_org.txt"
if not exist "%tmpPath%ip_org.tmp" (
findstr.exe org %tmpPath%ip_info.tmp > %tmpPath%ip_org.tmp
powershell -Command "(gc %tmpPath%ip_org.tmp) -replace '\"org\":', '' | Out-File -encoding ASCII %tmpPath%ip_org.tmp"
powershell -Command "(gc %tmpPath%ip_org.tmp) -replace '""' , '' | Out-File -encoding ASCII %tmpPath%ip_org.tmp"
powershell -Command "(gc %tmpPath%ip_org.tmp) -replace ',' , '' | Out-File -encoding ASCII %tmpPath%ip_org.tmp"
)
set /p country=<ip_country.txt
set /p city=<ip_city.txt
set /p org=<ip_org.txt
set /p country=<%tmpPath%ip_country.tmp
set /p city=<%tmpPath%ip_city.tmp
set /p org=<%tmpPath%ip_org.tmp
set raw_data=[{^
\"device_info\" :\"%devie_info%\",^
\"project_info\" :\"%1\",^
@@ -49,8 +58,6 @@ set raw_data=[{^
\"org\" :\"%org%\"^
}]
curl.exe --include --request POST --header "Content-Type: application/json" --data-binary^
"%raw_data%" "%url%"
curl.exe --include --request POST --header "Content-Type: application/json" --data-binary "%raw_data%" "%url%"
del ip_*
exit /B 0