tag:blogger.com,1999:blog-91860364741921718942024-03-05T17:42:48.407-08:00Me And You And A Dog Named BooUnknownnoreply@blogger.comBlogger3125tag:blogger.com,1999:blog-9186036474192171894.post-29840425048534191842015-10-23T07:39:00.006-07:002016-05-27T18:25:37.031-07:00Add more language to Pebble Time voice dictation service.<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;">Just got a new Pebble Time Steel last week and found that voice dictation on it is awesome. The only annoyed thing is its voice dictation doesn't support much language including my native language (Vietnamese).</span><br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><br /></span><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;">At first thought maybe Pebble uses Google voice API but after a quick check, I got this <a href="http://www.businesswire.com/news/home/20151015005480/en/Nuance-Brings-Voice-Recognition-Capabilities-Pebble-Smartwatches">news</a> about PT voice engine and voila here is their <a href="http://developer.nuance.com/public/index.php?task=supportedLanguages">demo</a>: it supports many more languages than the Pebble App allow us to choose. Now the tweak begins.</span><br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><br /></span><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;">Having used adb shell on my Android phone, I figured out that the Pebble Time app has saved the configuration in this SQLite file /data/data/com.getpebble.android.basalt/databases/pebble, in table "preferences" and the key is "voice_language". Now we can change the language to the one which matches with this <a href="http://developer.nuance.com/public/index.php?task=supportedLanguages">document</a> ( for example "eng-USA", "vie-VNM" ) and reboot.</span><br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><br /></span><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;">Ehhmm, too much technical things? </span><span style="font-family: "arial";">To make it easier for most users I created a small Android app which you can download </span><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><a href="http://phuonglm.net/dist/pebble-voice-tweak.apk">here</a>. (<span style="color: red;">Remember, you need rooted Android phone to make this work</span>, I will public source code to Github later).</span><br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhm2xcYxslLO7x64zXNuLqkoxt_m1Mv5kVNVhPtk7FwavTv3RfEaK11C5z7KEF7yMLkXRiv8vGN0-v8lJPHa-HJrHwQL8Pp9NlKFxNW8RaQ4CuRdyqfgrLoBeTSbY0TNO5klb2_EEa_OqCz/s1600/Screenshot_2015-10-23-21-10-00.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhm2xcYxslLO7x64zXNuLqkoxt_m1Mv5kVNVhPtk7FwavTv3RfEaK11C5z7KEF7yMLkXRiv8vGN0-v8lJPHa-HJrHwQL8Pp9NlKFxNW8RaQ4CuRdyqfgrLoBeTSbY0TNO5klb2_EEa_OqCz/s320/Screenshot_2015-10-23-21-10-00.png" width="179" /></a>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7CAw6EoUNDV10IRFezK11zRFWWNNTziTIjE2Sy3ux06CZ81DkKtKd515g6iWUfZ54ybfoOWrWwHSh9u5D5zIp7qOA1OqaOokp8sm6OYnAUoYruokP0H_qdLBp2wePyLNZj1uvPLCNtBT2/s1600/Screenshot_2015-10-23-21-09-49.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7CAw6EoUNDV10IRFezK11zRFWWNNTziTIjE2Sy3ux06CZ81DkKtKd515g6iWUfZ54ybfoOWrWwHSh9u5D5zIp7qOA1OqaOokp8sm6OYnAUoYruokP0H_qdLBp2wePyLNZj1uvPLCNtBT2/s320/Screenshot_2015-10-23-21-09-49.png" width="179" /></a>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQDEliWRu7t579pc6CQySer7Wt_C4r87yEk5JlO1SqFa3wVWWj_c-eB84t4j8dTTfiDqN6PeRP4hm9qarlbU0QpP6xeqmsSdFPvcsQnrjqOdXXLVJmkWgNNfbbcgoGrOou3dHa867X7Vii/s1600/20151023_212741.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQDEliWRu7t579pc6CQySer7Wt_C4r87yEk5JlO1SqFa3wVWWj_c-eB84t4j8dTTfiDqN6PeRP4hm9qarlbU0QpP6xeqmsSdFPvcsQnrjqOdXXLVJmkWgNNfbbcgoGrOou3dHa867X7Vii/s320/20151023_212741.jpg" width="179" /></a>
</div>
<div class="separator" style="clear: both; text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;">Note: <strike>When you use custom voice language and open Pebble Time app --> Settings, It will crash because it doesn't understand that language. All you need to do is use my app and change back to English, everything will be normal again. After that you can select back to your language with my app.</strike> New Pebble app version now worked ok with this tweak.</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;">Cheers.</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;">Update:</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;">2016/05/29: I updated my tweak app to support MarshMallow and environment doesn't have busybox.</span></div>
Unknownnoreply@blogger.com13tag:blogger.com,1999:blog-9186036474192171894.post-59532229310014715122014-07-07T10:29:00.001-07:002016-06-17T01:49:34.333-07:00Nginx dynamic reverse proxy<div class="separator" style="clear: both; text-align: center;">
<a href="https://www.nginx.com/wp-content/themes/nginx-theme/assets/img/logo.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="73" src="https://www.nginx.com/wp-content/themes/nginx-theme/assets/img/logo.png" width="320" /></a></div>
About four years ago, i was knew <a href="http://nginx.org/">Nginx</a> when try to fight with slowloris attack on my Apache server. Since that day I was fell in love with Nginx and it never <span class="short_text" id="result_box" lang="en"><span class="hps alt-edited">cease to amaze me about what it can do. I now i decice to collect about some part of my use case and solution with Nginx to share.</span></span><br />
<span class="short_text" id="result_box" lang="en"><span class="hps alt-edited"><br /></span></span>
<span class="short_text" id="result_box" lang="en"><span class="hps alt-edited">Our team have one line of internet and one public IP which have to handle many kind of web application behind it some of web application very simple and doesn't care about virtual domain, URL</span></span> rewirte, authentication resource optimization. So it really need a front web-server who fill the gap and make the manage process more easy and secured. That where Nginx coming and give me a greate favour. Here is what Nginx currently do in my server:<br />
<br />
<ul>
<li>Forward request base on domain and url to the right web application behind </li>
<li>Support https, SPDY to make web application faster and more secure.</li>
<li>Caching and optimizing the response of web application's static resource.</li>
<li>Authentication and authorization base on domain and URL.</li>
<li>Rewrite the URL and add more information to request to help the web application understand more about user. </li>
<li>Limited request rate and bandwidth, deny request base on IP and country to protect web application from abuse by bad visitor.</li>
</ul>
<div>
The Case 1:</div>
<div>
We have a IP range in our local network which reserve for 4 virtual machine which run our demo product and can be managed directly by developer when they need to show case to our customer. </div>
<div>
<br /></div>
<div>
Problem is every time they want allow outside access to their demo product i have to add new record to Nginx or router to forward the request to demo server and now i go tired with that task. I want nginx to extract the forward destination by reading the domain information and forward request to that. For example, when user request http://acceptance01.8080.example.net/index.php Nginx will forward lookup local DNS for computer name acceptance01 and forward to that computer on port 8080 with file index.php. If request failed some how Nginx will handle the bad situation by display a nice error message.</div>
<div>
<br />
Here is some quick and dirty config from my /etc/nginx/sites-available/vm.example.com</div>
<div>
<pre class="brush: js">server {
listen 80;
server_name *.vm.example.com;
# Point this to you DNS server which client get DHCP from
# for example: a virtual machine with host name "abc" request DHCP with your router
# the DNS name will remember the IP address of "abc" in memory that why we can use
# hostname with style of abc.vm.example.com
resolver 192.168.1.1;
set $realservername "";
set $realport "80";
if ($http_host ~ ^([a-z0-9\-]*)\.(vm\.example\.com)$) {
set $realservername $1;
}
if ($http_host ~ ^([a-z0-9\-]*)\.(\d*)\.(vm\.example\.com)$) {
set $realservername $1;
set $realport $2;
}
location / {
# Block client if client not from my country
# if ($geoip_country_code !~ (VN|^$) ) {
# return 403;
# }
# uncomment this if you want to limit the name list of server name
# if ($realservername !~ (name1|name2|name3) ) {
# return 403;
# }
proxy_connect_timeout 10s;
proxy_read_timeout 20m;
proxy_send_timeout 20m;
proxy_pass http://$realservername:$realport;
# needed to forward user's IP address to rails
proxy_set_header X-Real-IP $remote_addr;
# needed for HTTPS
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_max_temp_file_size 0;
}
}
</pre>
</div>
<br />
You will also need a wildcard DNS for *.vm.example.com point to your server. I using <a href="http://cloudflare.com/">Cloudflare</a> free service which support wildcard DNS. Check with your DNS provider to make sure it support.Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-9186036474192171894.post-24105102297583554982014-02-27T01:40:00.000-08:002016-06-17T01:48:38.866-07:00Access free network with tiny DNS packet<div class="separator" style="clear: both; text-align: center;">
<a href="https://www.sandvine.com/images/uploads/solutions/network-security/dns-tunneling.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="138" src="https://www.sandvine.com/images/uploads/solutions/network-security/dns-tunneling.png" width="320" /></a></div>
<br />
Wondering when you're on the airport or Internet cafe with non-free wireless provider, they always redirect you to a page and force you to sign-up and buy their package for wireless access. WOW so disappointed!!!<br />
<br />
Luckily on some network like that they are still allow DNS service to have some free to run. So I decide to search some solution about transfer data over tiny over DNS query.<br />
<br />
Let Google with "DNS tunneling" and I choiced the most common solution depend on the limited of the network provider.<br />
<ul>
<li>First is using OpenVPN and configurate it listen on DNS service (UDP port 53) and connect VPN over that. The problem is some secured ISP force us to use their DNS system - they redirect all packet that connect to DNS service to thier server instead of allow it pass the Internet gateway - however this method provide more robust solution for all OS and device ( Ubuntu, Android, Windows ... ) and better performance.</li>
<li>The second solution is iodine, a portable-small-tiny and easy to configure DNS tunnel server. However Idoine speed quite limited, but in case of emergency it will help. I found myself that iodine more easy for me than OpenVPN and it can pass almost filter of ISP than OpenVPN tooooo. If you need tunnel for Android device use the Magic tunnel - the folk of Idoin.</li>
</ul>
Reference <br />
OpenVPN: <a href="http://openvpn.net/howto.html">Big Long howto</a><br />
Iodine: <a href="http://www.putdispenserhere.com/bypassing-captive-portalsairport-pay-restrictions-with-iodine-on-a-debian-vps-guide/">Quick install guide</a> , <a href="http://www.magictunnel.net/index.php">Magic tunnel</a> <br />
<ul>
</ul>
Unknownnoreply@blogger.com0