<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: XD-DENG</title>
    <description>The latest articles on DEV Community by XD-DENG (@xddeng).</description>
    <link>https://dev.to/xddeng</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F253846%2Fb7f5992a-616d-43e5-9410-7546bd201526.png</url>
      <title>DEV Community: XD-DENG</title>
      <link>https://dev.to/xddeng</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/xddeng"/>
    <language>en</language>
    <item>
      <title>A Sample Project Using WebAssembly with Go</title>
      <dc:creator>XD-DENG</dc:creator>
      <pubDate>Sat, 25 Apr 2020 07:12:43 +0000</pubDate>
      <link>https://dev.to/xddeng/a-sample-project-using-webassembly-with-go-4f99</link>
      <guid>https://dev.to/xddeng/a-sample-project-using-webassembly-with-go-4f99</guid>
      <description>&lt;p&gt;Earlier I wrote a service with Go, doing stuff like hash text, generate random password, base64 encoding/decoding, interpret unix time, etc. When I shared it with my colleague, his first reaction was to ask me if these are executed in browser or at server side. My answer was "server side" and he was not really satisfied, which is totally understandable.&lt;/p&gt;

&lt;p&gt;Recently I got time to try WebAssembly, and I realise this service would be a nice example for WebAssembly: I can still write almost everything in Go, but eventually executed in client-side browser (I do understand the stuff can be done with JavaScript easily, but I simply want to try something different).&lt;/p&gt;

&lt;p&gt;Here comes the result: &lt;a href="https://handytools.xd-deng.com"&gt;https://handytools.xd-deng.com&lt;/a&gt;, and the source code on GitHub &lt;a href="https://github.com/XD-DENG/handytools-go-webassembly"&gt;https://github.com/XD-DENG/handytools-go-webassembly&lt;/a&gt;. Overall the experience was quite nice, and I do look forward to see how WebAssembly would evolve and be used more broadly in the near future.&lt;/p&gt;

&lt;p&gt;I think this project may work as a nice minimal example for folks who wonder how WebAssembly works with Go, so sharing here.&lt;/p&gt;

&lt;p&gt;Let me know how you find it :)&lt;/p&gt;

</description>
      <category>go</category>
      <category>webassembly</category>
      <category>vue</category>
    </item>
    <item>
      <title>Receive Email Notifications When There Is New Star for Your GitHub Repo</title>
      <dc:creator>XD-DENG</dc:creator>
      <pubDate>Wed, 08 Jan 2020 03:24:38 +0000</pubDate>
      <link>https://dev.to/xddeng/receive-email-notifications-when-there-is-new-star-for-your-github-repo-2o0</link>
      <guid>https://dev.to/xddeng/receive-email-notifications-when-there-is-new-star-for-your-github-repo-2o0</guid>
      <description>&lt;p&gt;I have made a new toy to send email notification when there is any new star for my GitHub repositories. It works quite fine so I have decided to list it on GitHub Marketplace and open to all to use it for free (link to GitHub Marketplace page of it: &lt;a href="https://github.com/marketplace/star-notifier"&gt;https://github.com/marketplace/star-notifier&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;The stack is mainly Python + AWS services. The application itself is very simple &amp;amp; has most minimal permission requirement (your privacy is safe).&lt;/p&gt;

&lt;p&gt;Give a try and let me know your feedback! Cheers.&lt;/p&gt;

</description>
      <category>github</category>
    </item>
    <item>
      <title>Know Your Redis Server Information/Status Simply via HTTP API</title>
      <dc:creator>XD-DENG</dc:creator>
      <pubDate>Mon, 30 Dec 2019 11:39:16 +0000</pubDate>
      <link>https://dev.to/xddeng/know-your-redis-server-information-status-simply-via-http-api-a7i</link>
      <guid>https://dev.to/xddeng/know-your-redis-server-information-status-simply-via-http-api-a7i</guid>
      <description>&lt;p&gt;Redis CLI provides a nice &lt;a href="https://redis.io/commands/info"&gt;command "INFO"&lt;/a&gt; to allow users to understand the information and statistics about the server. The information it provides include&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;general information about the Redis server&lt;/li&gt;
&lt;li&gt;client connections&lt;/li&gt;
&lt;li&gt;memory consumption&lt;/li&gt;
&lt;li&gt;CPU consumption&lt;/li&gt;
&lt;li&gt;etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now with &lt;a href="https://github.com/XD-DENG/rediseen"&gt;&lt;code&gt;Rediseen&lt;/code&gt;&lt;/a&gt; (as from version 2.1.0), you can expose &amp;amp; read these information much more conveniently, simply via HTTP API.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Rediseen&lt;/code&gt; (&lt;a href="https://github.com/XD-DENG/rediseen"&gt;https://github.com/XD-DENG/rediseen&lt;/a&gt;) is a small software written with Golang. The main feature of it is to help start a REST-like API so that clients can query records in your Redis database in a simple and secure way. As from version 2.1.0, it also allows you to expose and query the Redis database information and statistics so that you can use it as a "connector" between Redis database and any monitoring mechanism.&lt;/p&gt;

&lt;h3&gt;
  
  
  Install &amp;amp; Start the Service
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;brew &lt;span class="nb"&gt;install &lt;/span&gt;XD-DENG/rediseen/rediseen

&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;REDISEEN_REDIS_URI&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"redis://:@localhost:6379"&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;REDISEEN_DB_EXPOSED&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;REDISEEN_KEY_PATTERN_EXPOSED&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"key pattern you would like to expose"&lt;/span&gt;

rediseen start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(&lt;code&gt;REDISEEN_KEY_PATTERN_EXPOSED&lt;/code&gt; is intended to help you specify the Redis keys you expose to clients (that's what &lt;code&gt;Rediseen&lt;/code&gt; is mainly designed for). If you prefer to run &lt;code&gt;Rediseen&lt;/code&gt; ONLY for exposing results of &lt;code&gt;INFO&lt;/code&gt; command, simply put a value which doesn't match with any of your keys in Redis.)&lt;/p&gt;

&lt;h3&gt;
  
  
  Get the Redis Server Information/Statistics
&lt;/h3&gt;

&lt;p&gt;Now you're ready to go!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-s&lt;/span&gt; http://localhost:8000/info

&lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="s2"&gt;"CPU"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"used_cpu_sys"&lt;/span&gt;: &lt;span class="s2"&gt;"0.434104"&lt;/span&gt;,
    ... ...
  &lt;span class="o"&gt;}&lt;/span&gt;,
  &lt;span class="s2"&gt;"Clients"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
    ... ...
  &lt;span class="o"&gt;}&lt;/span&gt;,
  &lt;span class="s2"&gt;"Cluster"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
    ... ...
  &lt;span class="o"&gt;}&lt;/span&gt;,
  &lt;span class="s2"&gt;"Commandstats"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
    ... ...
  &lt;span class="o"&gt;}&lt;/span&gt;,
  &lt;span class="s2"&gt;"Keyspace"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
    ... ...
  &lt;span class="o"&gt;}&lt;/span&gt;,
  &lt;span class="s2"&gt;"Memory"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
    ... ...
  &lt;span class="o"&gt;}&lt;/span&gt;,
  &lt;span class="s2"&gt;"Persistence"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
    ... ...
  &lt;span class="o"&gt;}&lt;/span&gt;,
  &lt;span class="s2"&gt;"Replication"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
    ... ...
  &lt;span class="o"&gt;}&lt;/span&gt;,
  &lt;span class="s2"&gt;"Server"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"arch_bits"&lt;/span&gt;: &lt;span class="s2"&gt;"64"&lt;/span&gt;,
    &lt;span class="s2"&gt;"executable"&lt;/span&gt;: &lt;span class="s2"&gt;"/Users/XD/Downloads/redis-stable/src/./redis-server"&lt;/span&gt;,
    &lt;span class="s2"&gt;"gcc_version"&lt;/span&gt;: &lt;span class="s2"&gt;"4.2.1"&lt;/span&gt;,
    ... ...
  &lt;span class="o"&gt;}&lt;/span&gt;,
  &lt;span class="s2"&gt;"Stats"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
    ... ...
  &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also specify which exact section you want, so the network I/O will be much smaller. For example, if you are only interested in CPU consumption, you can specify "cpu" in the URL.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-s&lt;/span&gt; http://localhost:8000/info/cpu

&lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="s2"&gt;"CPU"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"used_cpu_sys"&lt;/span&gt;: &lt;span class="s2"&gt;"0.422091"&lt;/span&gt;,
    &lt;span class="s2"&gt;"used_cpu_sys_children"&lt;/span&gt;: &lt;span class="s2"&gt;"0.000000"&lt;/span&gt;,
    &lt;span class="s2"&gt;"used_cpu_user"&lt;/span&gt;: &lt;span class="s2"&gt;"0.255020"&lt;/span&gt;,
    &lt;span class="s2"&gt;"used_cpu_user_children"&lt;/span&gt;: &lt;span class="s2"&gt;"0.000000"&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Authentication
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;Rediseen&lt;/code&gt; also supports API Key authentication. Simply run the line below before your start &lt;code&gt;Rediseen&lt;/code&gt; service.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;REDISEEN_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"demo_key"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once it is set, client will have to add the API key as X-API-KEY in their HTTP header in order to access the service, otherwise 401 error (&lt;code&gt;Unauthorized&lt;/code&gt;) will be returned.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# REJECTED: No X-API-KEY is given in HTTP header&lt;/span&gt;
curl &lt;span class="nt"&gt;-s&lt;/span&gt; http://localhost:8000/info
&lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="s2"&gt;"error"&lt;/span&gt;: &lt;span class="s2"&gt;"unauthorized"&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;# REJECTED: Wrong X-API-KEY is given in HTTP header&lt;/span&gt;
curl &lt;span class="nt"&gt;-s&lt;/span&gt; &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"X-API-KEY: wrong_key"&lt;/span&gt; http://localhost:8000/info
&lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="s2"&gt;"error"&lt;/span&gt;: &lt;span class="s2"&gt;"unauthorized"&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;# ACCEPTED: Correct X-API-KEY is given in HTTP header&lt;/span&gt;
curl &lt;span class="nt"&gt;-s&lt;/span&gt; &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"X-API-KEY: demo_key"&lt;/span&gt; http://localhost:8000/info/server

&lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="s2"&gt;"Server"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"arch_bits"&lt;/span&gt;: &lt;span class="s2"&gt;"64"&lt;/span&gt;,
    &lt;span class="s2"&gt;"atomicvar_api"&lt;/span&gt;: &lt;span class="s2"&gt;"atomic-builtin"&lt;/span&gt;,
    &lt;span class="s2"&gt;"configured_hz"&lt;/span&gt;: &lt;span class="s2"&gt;"10"&lt;/span&gt;,
    &lt;span class="s2"&gt;"gcc_version"&lt;/span&gt;: &lt;span class="s2"&gt;"4.2.1"&lt;/span&gt;,
    ... ...
  &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>redis</category>
      <category>go</category>
    </item>
    <item>
      <title>Rediseen: start REST-like API service for Redis database without writing a single line of code</title>
      <dc:creator>XD-DENG</dc:creator>
      <pubDate>Sun, 20 Oct 2019 12:52:31 +0000</pubDate>
      <link>https://dev.to/xddeng/rediseen-start-rest-like-api-service-for-redis-database-without-writing-a-single-line-of-code-1fh5</link>
      <guid>https://dev.to/xddeng/rediseen-start-rest-like-api-service-for-redis-database-without-writing-a-single-line-of-code-1fh5</guid>
      <description>&lt;p&gt;Hi there,&lt;/p&gt;

&lt;p&gt;Recently I have been working on a side project using Golang. It aims to help start REST-like API service for Redis databases, without writing a single line of code.&lt;/p&gt;

&lt;p&gt;I have made it public recently (with Apache 2.0 license) at &lt;a href="https://github.com/XD-DENG/rediseen"&gt;https://github.com/XD-DENG/rediseen&lt;/a&gt;. You can install it easily via Homebrew (&lt;code&gt;brew install XD-DENG/rediseen/rediseen&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;It's as easy to use as below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Install using Homebrew
brew install XD-DENG/rediseen/rediseen

# Configuration
export REDISEEN_REDIS_URI="redis://:@localhost:6379"
export REDISEEN_DB_EXPOSED=0
export REDISEEN_KEY_PATTERN_EXPOSED="^key:([0-9a-z]+)"

# Start the service
rediseen start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you can query against your Redis database with HTTP GET call like &lt;code&gt;http://localhost:8000/0/key:1&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Give it a try and share your feedbacks please!&lt;/p&gt;

</description>
      <category>go</category>
      <category>database</category>
    </item>
  </channel>
</rss>
