<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Posts on </title>
    <link>https://research.cookiearena.org/posts/</link>
    <description>Recent content in Posts on </description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <copyright>cookiehanhoan</copyright>
    <lastBuildDate>Thu, 02 Feb 2023 23:23:57 +0700</lastBuildDate><atom:link href="https://research.cookiearena.org/posts/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Hello World</title>
      <link>https://research.cookiearena.org/posts/hello-world/</link>
      <pubDate>Thu, 02 Feb 2023 23:23:57 +0700</pubDate>
      
      <guid>https://research.cookiearena.org/posts/hello-world/</guid>
      <description>Hello World This is H2 This is H3 </description>
      <content>&lt;h1 id=&#34;hello-world&#34;&gt;Hello World&lt;/h1&gt;
&lt;h2 id=&#34;this-is-h2&#34;&gt;This is H2&lt;/h2&gt;
&lt;h3 id=&#34;this-is-h3&#34;&gt;This is H3&lt;/h3&gt;
</content>
    </item>
    
    <item>
      <title>DailyCookies</title>
      <link>https://research.cookiearena.org/posts/dailycookies/</link>
      <pubDate>Thu, 19 Jan 2023 14:06:09 +0700</pubDate>
      
      <guid>https://research.cookiearena.org/posts/dailycookies/</guid>
      <description>Daily cookies pdf printing solution
Pricing - Browserless
Puppeteer vs Selenium vs Playwright, a speed comparison
https://github.com/mileszs/wicked_pdf
https://github.com/transitive-bullshit/awesome-puppeteer
How to convert HTML-to-PDF with Other Documentation - DocRaptor HTML to PDF Converter
02-01-2023 External DNS across K8S clusters when installing External DNS (X-DNS) across clusters to manage same DNS zone(s)
pay attention to your owner setting external-dns/types.go at d4523be44ce53069fa8371527a4f297fd1af94a1 · kubernetes-sigs/external-dns
otherwise, all of your DNS (managed by X-DNS) in other cluster will be gone 🙂 reason: X-DNS using TXT to manage DNS records</description>
      <content>&lt;h1 id=&#34;daily-cookies&#34;&gt;Daily cookies&lt;/h1&gt;
&lt;p&gt;pdf printing solution&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.browserless.io/pricing/&#34;&gt;Pricing - Browserless&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://blog.checklyhq.com/puppeteer-vs-selenium-vs-playwright-speed-comparison/&#34;&gt;Puppeteer vs Selenium vs Playwright, a speed comparison&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/mileszs/wicked_pdf&#34;&gt;https://github.com/mileszs/wicked_pdf&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/transitive-bullshit/awesome-puppeteer&#34;&gt;https://github.com/transitive-bullshit/awesome-puppeteer&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://docraptor.com/documentation&#34;&gt;How to convert HTML-to-PDF with Other Documentation - DocRaptor HTML to PDF Converter&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;02-01-2023&#34;&gt;02-01-2023&lt;/h2&gt;
&lt;h3 id=&#34;external-dns-across-k8s-clusters&#34;&gt;External DNS across K8S clusters&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;when installing External DNS (X-DNS) across clusters to manage same DNS zone(s)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;pay attention to your &lt;code&gt;owner&lt;/code&gt; setting&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/kubernetes-sigs/external-dns/blob/d4523be44ce53069fa8371527a4f297fd1af94a1/pkg/apis/externaldns/types.go#L244&#34;&gt;external-dns/types.go at d4523be44ce53069fa8371527a4f297fd1af94a1 · kubernetes-sigs/external-dns&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;otherwise, all of your DNS (managed by X-DNS) in other cluster will be &lt;strong&gt;gone&lt;/strong&gt; 🙂&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;reason: X-DNS using TXT to manage DNS records&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;e.g. &lt;code&gt;&amp;quot;heritage=external-dns,external-dns/owner=default,external-dns/resource=ingress/default/baby-php-type-juggling-inarray-111-ingress&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;by default, &lt;code&gt;external-dns/owner&lt;/code&gt; is set to &lt;code&gt;default&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;if you leave it as-is, it will be same across clusters → DNS records will be override according to ingress / service deployed in a cluster&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;07-11-2022&#34;&gt;07-11-2022&lt;/h2&gt;
&lt;h3 id=&#34;database-change-process&#34;&gt;Database change process&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;pre-check
&lt;ul&gt;
&lt;li&gt;table size&lt;/li&gt;
&lt;li&gt;critical?&lt;/li&gt;
&lt;li&gt;current traffic&lt;/li&gt;
&lt;li&gt;lock table or not&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;if critical + high traffic
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;backup&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;tern on maintanence mode → prevent unexpected write&lt;/li&gt;
&lt;li&gt;run query&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;23-07-2022&#34;&gt;23-07-2022&lt;/h2&gt;
&lt;h3 id=&#34;linux-shm-tmpfs&#34;&gt;Linux SHM (tmpfs)&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;shared memory, backed by memory &lt;strong&gt;and swap&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;means of passing data between programs&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tmpfs&lt;/code&gt; appears as a mounted files system, but data located in memory
&lt;ul&gt;
&lt;li&gt;provide file system interface &lt;del&gt;with good performance&lt;/del&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;tmpfs&lt;/code&gt; performance is deceptive. You will find workloads that are faster on tmpfs, and this is &lt;em&gt;not&lt;/em&gt; because RAM is faster than disk: All filesystems are cached in RAM – the page cache! Rather, it is a sign that the workload is doing something that defeats the page cache. And of the worse things a process can do in this regard is syncing to disk way more often than necessary.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;a href=&#34;https://superuser.com/questions/45342/when-should-i-use-dev-shm-and-when-should-i-use-tmp&#34;&gt;When should I use /dev/shm/ and when should I use /tmp/?&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the perfomance point is deceptive because
&lt;ul&gt;
&lt;li&gt;write to fs doesn’t necessarily slower than to memory&lt;/li&gt;
&lt;li&gt;whole fs is cached (buffer)
&lt;ul&gt;
&lt;li&gt;write is async until call &lt;code&gt;fsync()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;the only time that program notice the read speed&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;if your process is I/O bound → use tmpfs for better performance&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;12-07-2022&#34;&gt;12-07-2022&lt;/h2&gt;
&lt;h3 id=&#34;gitlab---repo-checks&#34;&gt;Gitlab - repo checks&lt;/h3&gt;
&lt;h3 id=&#34;elasticsearch-realm&#34;&gt;Elasticsearch realm&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;quick note on &lt;strong&gt;authentication process&lt;/strong&gt;:
&lt;ul&gt;
&lt;li&gt;after authentication is completed, username (maybe also role name) will be added to sub-requests → for authorization&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;core of authentication process&lt;/li&gt;
&lt;li&gt;use to distinguish user authentication by the means
&lt;ul&gt;
&lt;li&gt;e.g. LDAP, Kerberos, Reserved, &lt;strong&gt;Native&lt;/strong&gt;, &lt;strong&gt;File&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;commonly used Realm
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;reserverd&lt;/code&gt;: for internal user auth - Kibana, Beats&lt;/li&gt;
&lt;li&gt;&lt;code&gt;native&lt;/code&gt;: store hash of user password in &lt;code&gt;.security&lt;/code&gt; index&lt;/li&gt;
&lt;li&gt;&lt;code&gt;file&lt;/code&gt;: same like native, but store hashed password in file
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;tips:&lt;/strong&gt; this has practical use - in case &lt;code&gt;.security&lt;/code&gt; index or external services (LDAP, Kerberos) become unavailable, &lt;strong&gt;only user with &lt;code&gt;file&lt;/code&gt; realm can authenticate with ES&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;20-06-2022&#34;&gt;20-06-2022&lt;/h2&gt;
&lt;h3 id=&#34;fastapi-return-307-redirect&#34;&gt;FastAPI return 307 redirect&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;app&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;post(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/v2/api-key/&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;note the &lt;code&gt;/&lt;/code&gt; at the end of route
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;pain&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;19-06-2022&#34;&gt;19-06-2022&lt;/h2&gt;
&lt;h3 id=&#34;https-path-is-encrypted&#34;&gt;HTTPs path is encrypted&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;The URL path and query string parameters are encrypted&lt;/strong&gt;, as are POST bodies.&lt;/li&gt;
&lt;li&gt;however, we still shouldn’t put credentials in HTTPS path
&lt;ul&gt;
&lt;li&gt;it is logged in browser history&lt;/li&gt;
&lt;li&gt;be seen by someone glancing at the screen&lt;/li&gt;
&lt;li&gt;can be leak by SNI&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;18-06-2022&#34;&gt;18-06-2022&lt;/h2&gt;
&lt;h3 id=&#34;dns---mx-record-priority&#34;&gt;DNS - MX record priority&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;increase P of mail delivery&lt;/li&gt;
&lt;li&gt;when client query mail server
&lt;ul&gt;
&lt;li&gt;return list of mail servers&lt;/li&gt;
&lt;li&gt;try the one with highest priority&lt;/li&gt;
&lt;li&gt;if it doesn’t make it&lt;/li&gt;
&lt;li&gt;try the next one&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;ptr-records&#34;&gt;PTR records&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;use for reverse DNS lookup
&lt;ul&gt;
&lt;li&gt;from IP → get domain&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dig -x 1.1.1.1
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;; &amp;lt;&amp;lt;&amp;gt;&amp;gt; DiG 9.10.6 &amp;lt;&amp;lt;&amp;gt;&amp;gt; -x 1.1.1.1
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;;; global options: +cmd
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;;; Got answer:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;;; -&amp;gt;&amp;gt;HEADER&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;lt;&amp;lt;- opco&lt;/span&gt;de: QUERY, status: NOERROR, id: &lt;span style=&#34;color:#ae81ff&#34;&gt;64277&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;;; OPT PSEUDOSECTION:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;; EDNS: version: 0, flags:; udp: &lt;span style=&#34;color:#ae81ff&#34;&gt;1232&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;;; QUESTION SECTION:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;;1.1.1.1.in-addr.arpa.		IN	PTR
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;;; ANSWER SECTION:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1.1.1.1.in-addr.arpa.	263	IN	PTR	one.one.one.one.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;;; Query time: &lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt; msec
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;;; SERVER: 192.168.1.1#53&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;192.168.1.1&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;;; WHEN: Sat Jun &lt;span style=&#34;color:#ae81ff&#34;&gt;18&lt;/span&gt; 00:30:44 +07 &lt;span style=&#34;color:#ae81ff&#34;&gt;2022&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;;; MSG SIZE  rcvd: &lt;span style=&#34;color:#ae81ff&#34;&gt;78&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;can be used to detect spam
&lt;ul&gt;
&lt;li&gt;receive different header/email from single server&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Logging:&lt;/strong&gt; System logs typically record only IP
addresses; a reverse DNS lookup can convert these into domain names for
logs that are more human-readable.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Along with this: Don&amp;rsquo;t alert on CPU/Mem/Network. Those are false flags. Alert on pending pods. Alert on deployments that are stalled. Alert on your service health metrics. Leave the management of machines to your platform vendor, and use those in diagnosis of problems with your service, but &amp;ldquo;node has high CPU usage&amp;rdquo; is not a problem. &amp;ldquo;My service is slow&amp;rdquo; is a problem - And a potential cause of that problem is high CPU usage on a node, but high cpu usage isn&amp;rsquo;t the thing you care about.&lt;/p&gt;
&lt;p&gt;Generally #2, install kube-state-metrics and monitor with prometheus. kube-state-metrics doesn&amp;rsquo;t use events to make inferences about the state of the system.&lt;/p&gt;
&lt;p&gt;Events are more of a &amp;rsquo;nice to have&amp;rsquo;, one of the core principles of Kubernetes is that events should not be actionable, i.e. you wouldn&amp;rsquo;t respond or have an operator/controller taking actions based on events. They are really only &amp;lsquo;hints&amp;rsquo; to the people trying to reason about what the state of the system is.&lt;/p&gt;
&lt;p&gt;Logs are the same, they should never be actionable. Metrics should tell you what the current state of the system is, logs are there for analysis to understand why it was in that state&lt;/p&gt;
&lt;h2 id=&#34;05-05-2022&#34;&gt;05-05-2022&lt;/h2&gt;
&lt;h3 id=&#34;k8s-secrets&#34;&gt;K8S secrets&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;by default store unencrypted in &lt;code&gt;etcd&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;similar to &lt;code&gt;configmap&lt;/code&gt;, except used for credentials (seperate for RBAC convenience)
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;note on RBAC&lt;/em&gt;: anyone has permission to create pods &lt;strong&gt;implicitly&lt;/strong&gt; has permisson to read k8s secrets&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;maximum size of single secret: &lt;strong&gt;1 MB&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;09-04-2022&#34;&gt;09-04-2022&lt;/h2&gt;
&lt;h3 id=&#34;ssl-handshake-explained-again-&#34;&gt;SSL Handshake explained (again 😎)&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Overview:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;client and server exchange &lt;code&gt;public_key&lt;/code&gt; and agree on a common &lt;code&gt;session_key&lt;/code&gt; to encrypt/decrypt data&lt;/li&gt;
&lt;li&gt;ensure who ís who&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Concepts&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;SSL Cert: contain &lt;code&gt;server_public_key&lt;/code&gt; and &lt;code&gt;server_info&lt;/code&gt;, signed by a CA or self-signed&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Steps&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;TCP Handshake&lt;/li&gt;
&lt;li&gt;ClientHello (supported protocol version, cipher, etc.)&lt;/li&gt;
&lt;li&gt;ServerHello, Cert, ServHelloDone
&lt;ul&gt;
&lt;li&gt;Cert: SSL Cert&lt;/li&gt;
&lt;li&gt;on_receive: verify cert come from server (using CA public keys)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;ClientKeyExchange
&lt;ul&gt;
&lt;li&gt;send &lt;code&gt;premaster&lt;/code&gt; (random string) to server&lt;/li&gt;
&lt;li&gt;server use client &lt;code&gt;premaster&lt;/code&gt; secret to generate session key&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;p&gt;All TLS handshakes make use of asymmetric encryption (the public and private key), but not all will use the private key in the process of generating session keys&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;img src=&#34;Daily%20cookies%20bb785df24fca4563ba9a19541fd2c647/Untitled.png&#34; alt=&#34;Untitled&#34;&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;29-03-2022&#34;&gt;29-03-2022&lt;/h2&gt;
&lt;h3 id=&#34;nginx-ingres-affinity&#34;&gt;Nginx ingres affinity&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;mode:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;persistent&lt;/code&gt;: maximum persistency - not redistribute session when scaling happens&lt;/li&gt;
&lt;li&gt;&lt;code&gt;balanced&lt;/code&gt;: &amp;gt;&amp;lt; with &lt;code&gt;persistent&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;affinity session: only support &lt;code&gt;cookie&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;e.g. &lt;code&gt;INGRESSCOOKIE: &amp;quot;d7e757e232c266bde814567294e75d4f&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;17-03-2022&#34;&gt;17-03-2022&lt;/h2&gt;
&lt;h3 id=&#34;lambda-cold-start&#34;&gt;Lambda cold start&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;lambda cold start doesn’t really matter if you run background job
&lt;ul&gt;
&lt;li&gt;1xx ms → 1s&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;it may add up your delay if you serve API
&lt;ul&gt;
&lt;li&gt;but rarely happen with prod workload, bc requests keep lambda warm
&lt;ul&gt;
&lt;li&gt;except when it’s scaling or when you deploy new code&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;AWS has a feature to help improve lambda perf called &lt;a href=&#34;https://docs.aws.amazon.com/lambda/latest/dg/provisioned-concurrency.html&#34;&gt;provisioned concurrency&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;yeah but it makes lambda less sexy (pricing issue)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;interview-lession-learned&#34;&gt;Interview lession learned&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;if you don’t know, admit that you don’t know → it’s much harder than you think !&lt;/li&gt;
&lt;li&gt;try to ask interviewer about his opinion / solution (if he is willing to answer)&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h1 id=&#34;archived&#34;&gt;Archived&lt;/h1&gt;
&lt;p&gt;18/03/2020&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;process model based on:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;resource grouping: group (separate) related resource
&lt;ul&gt;
&lt;li&gt;program text,&lt;/li&gt;
&lt;li&gt;opening files&lt;/li&gt;
&lt;li&gt;signals/signal handlers&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;thread of execution:
&lt;ul&gt;
&lt;li&gt;share process&amp;rsquo; resources&lt;/li&gt;
&lt;li&gt;have their own resource to separate them
&lt;ul&gt;
&lt;li&gt;PC&lt;/li&gt;
&lt;li&gt;register&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;preempt: thread scheduling is managed by OS&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;asyncio&lt;/code&gt; use cooperative multi tasking&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;user can make decision when/where ready to switch&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;IO-bound&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;spend most of it&amp;rsquo;s time doing IO operations&lt;/li&gt;
&lt;li&gt;usually wait for external resource
&lt;ul&gt;
&lt;li&gt;esp. something much slower than CPU&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;em&gt;speed up&lt;/em&gt;: overlapping the waiting for devices&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;CPU-bound&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;spend most of it&amp;rsquo;s time doing computation&lt;/li&gt;
&lt;li&gt;intensive computation, not read/write data from/to file, net,&amp;hellip;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;speed up&lt;/em&gt;: do more computation at one time&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;ThreadPoolExecutor = thread + pool + executor&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;manage thread if you don&amp;rsquo;t need fine-grained control&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;share data&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;must be thread-safe for data access
&lt;ul&gt;
&lt;li&gt;depend on how/when access data,&amp;hellip;&lt;/li&gt;
&lt;li&gt;queue&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;asyncio&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;core concept:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;event-loop&lt;/li&gt;
&lt;li&gt;list maintaining state,&amp;hellip; e.g. [ready, waiting]&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;never get interrupted without intentionally do it (giving control to control)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;no worry thread-safe&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;coroutine vs subroutine&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Co-routine is sub-routine but persistent
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;subroutine stack bound to calling stack&lt;/li&gt;
&lt;li&gt;coroutine stack separate (can resume/pause by any calling having access to it)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;19/03/2020&lt;/p&gt;
&lt;p&gt;terraform&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;declarative (specified what the desired states)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;client-only architecture&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;cannot rollback&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;should use implicit dependency&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;provisioner&lt;/code&gt; is run only when resource is &lt;em&gt;created&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;⇒ not replace configuration management&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;exec plan&lt;/code&gt;: do exactly what it has told&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;tainted resource (provisioner failed) ⇒ not auto destroy tainted when apply the first time
&lt;ul&gt;
&lt;li&gt;doing so against exec plan&lt;/li&gt;
&lt;li&gt;next time ⇒ destroy instance ⇒ exec provisioner&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;provisioner are the last resort&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;use alternative wherever possible&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;22/03/2020&lt;/p&gt;
&lt;p&gt;python concurrency&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;concurrency = (multiprocessing&lt;!-- raw HTML omitted --&gt;, multithreading,&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&#34;Daily%20cookies%20bb785df24fca4563ba9a19541fd2c647/Untitled%201.png&#34; alt=&#34;Daily%20cookies%20bb785df24fca4563ba9a19541fd2c647/Untitled%201.png&#34;&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;coroutines:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;have multi endpoint to start, resume function
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;diff&lt;/em&gt; with &lt;code&gt;generator&lt;/code&gt;: generator generate data, &lt;code&gt;coroutine&lt;/code&gt; can consume data&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;asyncio: the Python package that provides a foundation and API for running and managing coroutines&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Async IO:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;single threaded, single process design&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;cooperative multitasking&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;why parameterized SQL query can prevent &lt;code&gt;sql injection&lt;/code&gt;?&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;its not execute the query directly (give to special procedure&amp;hellip;)&lt;/li&gt;
&lt;li&gt;treat params as data (not query as when executed directly)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Web security&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;when get untrusted input from someone ⇒ analyze carefully
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;content standardization&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;24/03/2020&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;exp&lt;/strong&gt; to debug python error in exception block, use &lt;code&gt;raise&lt;/code&gt;, not &lt;code&gt;print&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;25/03/2020&lt;/p&gt;
&lt;p&gt;SMTP&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;Daily%20cookies%20bb785df24fca4563ba9a19541fd2c647/Untitled%202.png&#34; alt=&#34;Daily%20cookies%20bb785df24fca4563ba9a19541fd2c647/Untitled%202.png&#34;&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;SMTP user to &lt;em&gt;send&lt;/em&gt; email (push model)
&lt;ul&gt;
&lt;li&gt;POP3(pull) / IMAP ⇒ &lt;em&gt;receive&lt;/em&gt; email&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;User agent: Outlook, Mozilla,&amp;hellip;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;26/03/2020&lt;/p&gt;
&lt;p&gt;terraform&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;use &lt;code&gt;data&lt;/code&gt; source to read and query data&lt;/li&gt;
&lt;li&gt;use &lt;code&gt;lifecycle&lt;/code&gt; hook ⇒ &lt;code&gt;create_before_destroy&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;use  &lt;code&gt;provisioner&lt;/code&gt; to perform healthcheck,&amp;hellip;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;python concurrency&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;other languages had (multiple) ways to approach threading concurrency&lt;/li&gt;
&lt;li&gt;python: GIL ⇒ threads cannot run parallel in multi core
&lt;ul&gt;
&lt;li&gt;perf affacted when need to utilize threads on multiple core&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;aws&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;separate env by account (dev,staging,prod)
&lt;ul&gt;
&lt;li&gt;prod ⇒ mirror staging:&lt;/li&gt;
&lt;li&gt;staging need to have &amp;ldquo;real&amp;rdquo; data (no need to large but &lt;em&gt;real&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;code need to hitting staging often ⇒ tested every sprints,&amp;hellip;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;can use DNS as a service discovery
&lt;ul&gt;
&lt;li&gt;do not need agent, dependency,..&lt;/li&gt;
&lt;li&gt;must somehow register service to registry (client or server side)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;cloud map (aws) service discovery
&lt;ul&gt;
&lt;li&gt;can map instance ⇒ service&lt;/li&gt;
&lt;li&gt;ez to integrate with other aws service&lt;/li&gt;
&lt;li&gt;query by dns, attribute,&amp;hellip;&lt;/li&gt;
&lt;li&gt;provide health check&amp;hellip;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&#34;https://segment.com/blog/the-million-dollar-eng-problem/&#34;&gt;https://segment.com/blog/the-million-dollar-eng-problem/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;millions $ lession&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;dynamodb ⇒ hosted version of Cassandra, support 2nd index, abstract replication, partition&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;pricing model works in terms of throughput&lt;/li&gt;
&lt;li&gt;same key ⇒ same server, same partition&lt;/li&gt;
&lt;li&gt;should uniformly distribute read/write
&lt;ul&gt;
&lt;li&gt;void 1 server constantly overload, other idle&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&#34;Daily%20cookies%20bb785df24fca4563ba9a19541fd2c647/Untitled%203.png&#34; alt=&#34;Daily%20cookies%20bb785df24fca4563ba9a19541fd2c647/Untitled%203.png&#34;&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;dictates the number of partitions rather than the total throughput.&lt;/li&gt;
&lt;li&gt;h&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;PGP&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;Daily%20cookies%20bb785df24fca4563ba9a19541fd2c647/Untitled%204.png&#34; alt=&#34;pgp encryption&#34;&gt;&lt;/p&gt;
&lt;p&gt;pgp encryption&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;Daily%20cookies%20bb785df24fca4563ba9a19541fd2c647/Untitled%205.png&#34; alt=&#34;pgp decryption&#34;&gt;&lt;/p&gt;
&lt;p&gt;pgp decryption&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;speed of conventional key encrypt (use &lt;code&gt;session key&lt;/code&gt; to encrypt data)&lt;/li&gt;
&lt;li&gt;convenience of public key distribution&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Digital sig:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;RSA: instead of encrypt data using other people pub key
&lt;ul&gt;
&lt;li&gt;use your own priv key ⇒ if people can decrypt it using your pub ⇒ it&amp;rsquo;s your content&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;that may double size your data
&lt;ul&gt;
&lt;li&gt;use hash function&lt;/li&gt;
&lt;li&gt;PGP: digest(hashed plain) + private key ⇒ signature
&lt;ul&gt;
&lt;li&gt;send sig + plaintext&lt;/li&gt;
&lt;li&gt;decrypt sig using pub key&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;TODO&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;27/03/2020:&lt;/p&gt;
&lt;p&gt;python decorator&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;without args ⇒ &lt;code&gt;func = decor(func)&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;decor need to return a &lt;em&gt;wrapper&lt;/em&gt; of func&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;with args ⇒ &lt;code&gt;func = decor(*args*,***kwargs)(func)&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;decor need to return a function that &lt;code&gt;func&lt;/code&gt; is a input ⇒ return &lt;em&gt;wrapper&lt;/em&gt; of func&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;functools.wraps(f)&lt;/code&gt; helps preserve information of the origin function (not wrapper)&lt;/li&gt;
&lt;li&gt;can be useful when debug (print args, return whenever a function is call)
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;esp.&lt;/em&gt; helpful when we don&amp;rsquo;t directly call the function need to be debugged ourselves&lt;/li&gt;
&lt;li&gt;&lt;em&gt;e.g&lt;/em&gt;: &lt;em&gt;recursive&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;can use to throttle request (slow down func)&lt;/li&gt;
&lt;li&gt;it doesn&amp;rsquo;t have to wrap function
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;register&lt;/em&gt; an existing function ⇒ return it unwrapped&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;30/03/2020:&lt;/p&gt;
&lt;p&gt;flask design decision&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;explicit application object
&lt;ul&gt;
&lt;li&gt;fake multiple applications ⇒ unit testing,&amp;hellip;&lt;/li&gt;
&lt;li&gt;can create subclass
&lt;ul&gt;
&lt;li&gt;it not easy if the app object is created ahead of time&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;can init flask with the package &lt;strong&gt;&lt;code&gt;name&lt;/code&gt;&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;use to access other resource relative to the package (templates,..)&lt;/li&gt;
&lt;li&gt;can use CWD ⇒ not reliable (cuz it&amp;rsquo;s process-wide)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;explicit is better than implicit&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;micro framework&lt;/li&gt;
&lt;li&gt;thread locals
&lt;ul&gt;
&lt;li&gt;uses thread local objects for session, extra object,&amp;hellip;&lt;/li&gt;
&lt;li&gt;harder to maintain for large application&lt;/li&gt;
&lt;li&gt;flask aims for small traditional web app&lt;/li&gt;
&lt;li&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;samesite cookie&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;def:
&lt;ul&gt;
&lt;li&gt;user enter &lt;code&gt;A.com&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;[A.com](http://a.com)&lt;/code&gt; contains a cat picture which hosted on &lt;code&gt;B.com&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;cookies of in browser for &lt;code&gt;[B.com](http://b.com)&lt;/code&gt; would be sent to &lt;code&gt;B.com&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;http://b.com&#34;&gt;B.com&lt;/a&gt; maybe &lt;code&gt;vpbank.com/reset_password&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;it&amp;rsquo;s dangerous but we still need it in other situation:
&lt;ul&gt;
&lt;li&gt;page ref to fb, google,..&lt;/li&gt;
&lt;li&gt;ads,&amp;hellip;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;SameSite
&lt;ul&gt;
&lt;li&gt;Strict: never send cross-site&lt;/li&gt;
&lt;li&gt;Lax: send when user follow link, (click,&amp;hellip;) - GET request
&lt;ul&gt;
&lt;li&gt;SameSite must be Secure&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;best practice to learn React&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://www.reddit.com/r/reactjs/comments/a8c0yp/what_is_the_best_way_to_learn_react/&#34;&gt;https://www.reddit.com/r/reactjs/comments/a8c0yp/what_is_the_best_way_to_learn_react/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;That example LoginForm component is likely passed a callback as a prop that it will call when the login is successful, probably passing that callback the username and/or any profile information. This can sound complex, but it isn&amp;rsquo;t really - LoginForm ends up &amp;ldquo;dumb&amp;rdquo;, because it doesn&amp;rsquo;t know anything about the app. It knows how to login, and is given a callback to call once it has done so. &amp;ldquo;Dumb&amp;rdquo; (decoupled) means the opposite of complexity.&lt;/li&gt;
&lt;li&gt;thinking about how the UI should look at any given moment, rather than how to change it over time, eliminates a whole class of bugs.&lt;/li&gt;
&lt;li&gt;All React components must act like pure functions with respect to their props.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;03/04/2020&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;[exp]&lt;/strong&gt; evidence-based software engineering&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;empirical&lt;/li&gt;
&lt;li&gt;what technology is appropriate in &lt;em&gt;specific situation&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;asking the right question&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;&amp;ldquo;is pair programming useful?&amp;rdquo; ⇒ not detail&lt;/li&gt;
&lt;li&gt;&amp;ldquo;Does PP lead to improved code quality when practiced by professional dev?&amp;rdquo; ⇒ detailed
&lt;ul&gt;
&lt;li&gt;what intervention (PP)&lt;/li&gt;
&lt;li&gt;what population&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;09/04/2020&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;[exp]&lt;/strong&gt; aws iam policy can be error without notification&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;conditions contain invalid keys&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;14/04/2020&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;[exp]&lt;/strong&gt; presentation&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;who is targeted attendee
&lt;ul&gt;
&lt;li&gt;end users need diff information from developers&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;21/04/2020&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;[exp]&lt;/strong&gt; arch&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;should go from and focus on business viewpoint first
&lt;ul&gt;
&lt;li&gt;where/how you got that desired CCU&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;based on understanding of business
&lt;ul&gt;
&lt;li&gt;what scenarios(flow) cause what bottlenecks
&lt;ul&gt;
&lt;li&gt;it may not relevant to what customer thinks about their problem&lt;/li&gt;
&lt;li&gt;what had customer done to figure out their problem
&lt;ul&gt;
&lt;li&gt;is there anything wrong with it
&lt;ul&gt;
&lt;li&gt;the way they&amp;rsquo;re doing test,&amp;hellip;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;technology used
&lt;ul&gt;
&lt;li&gt;even &amp;ldquo;hype&amp;rdquo; techstack has its own problem&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;ops or dev need to be improved
&lt;ul&gt;
&lt;li&gt;external connection (port),&amp;hellip;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;26/04/2020&lt;/p&gt;
&lt;p&gt;service-oriented architecture and merging services&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;does separating services benefit from separated service over performance issue (hopped network,&amp;hellip;)
&lt;ul&gt;
&lt;li&gt;e.g scalability can be addressed only in one service&lt;/li&gt;
&lt;li&gt;maintain security in standalone service&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;how to implement new arch
&lt;ul&gt;
&lt;li&gt;if both services provide REST ⇒ can embed one service as the other&amp;rsquo;s local library&lt;/li&gt;
&lt;li&gt;A/B testing (ramp up)&lt;/li&gt;
&lt;li&gt;perf analysis
&lt;ul&gt;
&lt;li&gt;dark canary
&lt;ul&gt;
&lt;li&gt;replicate, multiply real read-only prod traffic ⇒ test hosts&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://sematext.com/blog/java-garbage-collection-logs/&#34;&gt;https://sematext.com/blog/java-garbage-collection-logs/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&#34;https://www.digitalocean.com/community/tutorials/understanding-database-sharding?utm_campaign=Grokking%20Newsletter&amp;amp;utm_medium=email&amp;amp;utm_source=Revue%20newsletter&#34;&gt;https://www.digitalocean.com/community/tutorials/understanding-database-sharding?utm_campaign=Grokking Newsletter&amp;amp;utm_medium=email&amp;amp;utm_source=Revue newsletter&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;30/04/2020&lt;/p&gt;
&lt;p&gt;github workflow&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;can have multiple workflows in a repo&lt;/li&gt;
&lt;li&gt;triggering
&lt;ul&gt;
&lt;li&gt;can be scheduled (POSIX)&lt;/li&gt;
&lt;li&gt;triggered by event (i.e. webhook event)
&lt;ul&gt;
&lt;li&gt;e.g create new branch, delete,&amp;hellip;&lt;/li&gt;
&lt;li&gt;issue is solved, reopened ,&amp;hellip;&lt;/li&gt;
&lt;li&gt;external event ⇒ send POST to github API&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;workflow only triggered when use &lt;code&gt;personal token&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;not by GITHUB Token ⇒ avoid recursive trigger
&lt;ul&gt;
&lt;li&gt;e.g. workflow run and make some event (push code,.._)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;can filtered by branches, tags and &lt;em&gt;paths&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;can use build matrix to test code across platform, OS, lang ver&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;runs-on&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;${{ matrix.os }}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;strategy&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;matrix&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;os&lt;/span&gt;: [&lt;span style=&#34;color:#ae81ff&#34;&gt;ubuntu-16.04, ubuntu-18.04]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;node&lt;/span&gt;: [&lt;span style=&#34;color:#ae81ff&#34;&gt;6&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;8&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;reference to actions&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;can be in pub repo (or DockerHub)&lt;/li&gt;
&lt;li&gt;if ref → private repo ⇒ workflow and action must be in same repo&lt;/li&gt;
&lt;li&gt;use &lt;code&gt;check runs&lt;/code&gt; to add status information to a commit&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&#34;https://dev.to/gr2m/github-api-how-to-retrieve-the-combined-pull-request-status-from-commit-statuses-check-runs-and-github-action-results-2cen&#34;&gt;GitHub API: How to retrieve the combined pull request status from commit statuses, check runs, and GitHub Action results&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;check runs&lt;/code&gt; can be used to add more than binary (PASS/FAIL) information ⇒ can add context, additional information
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;[exp]&lt;/strong&gt; use when have external CI tool&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;a project can have more than one CI tool when:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;developed by two or more separated teams&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;team A trigger team B CI (by put status, hook,&amp;hellip;)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;use minimum permission key. E.g:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;when deploy app to deployment server ⇒ use &lt;em&gt;deploy keys&lt;/em&gt; instead of personal secret
&lt;ul&gt;
&lt;li&gt;PK is attached to repo, not personal account each user&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;code&gt;Avoid passing secrets between processes from the command line, whenever possible&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;can be visible via &lt;code&gt;ps&lt;/code&gt; command or captured by &lt;code&gt;security audit&lt;/code&gt; event&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;secret limit&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;can have up to 100 secrets&lt;/li&gt;
&lt;li&gt;≤ 64KB in size
&lt;ul&gt;
&lt;li&gt;if larger than that: store encrypted secret in repo, save decryption passphrase at secret on Githu&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;artifact: share data btw jobs and save data after workflow completed&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;github currently not have Rest API for upload/download artifact to use btw jobs&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;use S3 or other storage&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;cache&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;use for github-hosted runner&lt;/li&gt;
&lt;li&gt;do not store secret in cache
&lt;ul&gt;
&lt;li&gt;anyone with Read perm can create PR and read cache content&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;can access the cache in workflow triggered by &lt;code&gt;pull_request&lt;/code&gt; or &lt;code&gt;push&lt;/code&gt; , except for &lt;code&gt;pull_request&lt;/code&gt; &lt;code&gt;closed&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;workflow can access cache in current branch, the base branch, and default branch&lt;/li&gt;
&lt;li&gt;only retent in 7 days and up to 5GB&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;service container&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;when need to access database, cache,&amp;hellip;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;create service for each job&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;access to service depends on where the job is run&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;in container: connect via docker network ⇒ &lt;em&gt;simple&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;on host: map docker port to container port&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;Redis Service Example&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;on&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;push&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;jobs&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#75715e&#34;&gt;# Label of the container job&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;runner-job&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;# You must use a Linux environment when using service containers or container jobs&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;runs-on&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;ubuntu-latest&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;# Service containers to run with `runner-job`&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;services&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#75715e&#34;&gt;# Label used to access the service container&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;redis&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#75715e&#34;&gt;# Docker Hub image&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;image&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;redis&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#75715e&#34;&gt;#&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;ports&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          &lt;span style=&#34;color:#75715e&#34;&gt;# Opens tcp port 6379 on the host and service container&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          - &lt;span style=&#34;color:#ae81ff&#34;&gt;6379&lt;/span&gt;:&lt;span style=&#34;color:#ae81ff&#34;&gt;6379&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;circleci&lt;/em&gt; vs &lt;em&gt;github&lt;/em&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;github both support container and runner&lt;/li&gt;
&lt;li&gt;circleci has para test grouping (github does not)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;two types of action&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Docker&lt;/li&gt;
&lt;li&gt;Javascript
&lt;ul&gt;
&lt;li&gt;simplifies action code&lt;/li&gt;
&lt;li&gt;faster than Docker container&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;security&lt;/strong&gt; with public repo on self-hosted runner&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;people can create PR and run code on the runner&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;location of action&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;if develop for other people ⇒ keep in its own repo
&lt;ul&gt;
&lt;li&gt;decouple action version from app code version&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;otherwise, &lt;code&gt;.github&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;run action in Docker container&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;github action&amp;rsquo;s metadata file can override some Dockerfile instructions&lt;/li&gt;
&lt;li&gt;&lt;code&gt;USER&lt;/code&gt;: must be default (&lt;code&gt;root&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;WORK_DIR&lt;/code&gt;: github set workdir in &lt;code&gt;GITHUB_WORKSPACE&lt;/code&gt; and mount&lt;/li&gt;
&lt;li&gt;Using the example Dockerfile above, GitHub will send the args configured in the action&amp;rsquo;s metadata file as arguments to &lt;a href=&#34;http://entrypoint.sh/&#34;&gt;entrypoint.sh&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;monitoring&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;log at &lt;code&gt;_diag&lt;/code&gt; directory&lt;/li&gt;
&lt;li&gt;journalctl log (service named with specific format)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;note &lt;code&gt;deploy keys&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;10/05/2020&lt;/p&gt;
&lt;p&gt;[k8s] statefulset&lt;/p&gt;
&lt;p&gt;headless service&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;pod of stateless application is same ⇒ can expose using &lt;code&gt;ClusterIP&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Stateful services (Kafka, db) is not
&lt;ul&gt;
&lt;li&gt;each instance do its own job&lt;/li&gt;
&lt;li&gt;each instance in cluster has stable unique identity&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;PV and PVC&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;separate to abstract: how the volume is provision VS how to &amp;ldquo;use&amp;rdquo; the volume&lt;/li&gt;
&lt;li&gt;&lt;code&gt;PV&lt;/code&gt;: lo level of representation of storage&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;06/07/2020&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;[exp]&lt;/strong&gt; ca cert problem&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;run &lt;code&gt;curl-config --ca&lt;/code&gt; and you will get something, e.g. &lt;code&gt;/etc/ssl/certs/ca-certificates.crt&lt;/code&gt;, back it up(in case you need it)&lt;/li&gt;
&lt;li&gt;go to &lt;a href=&#34;https://curl.haxx.se/docs/caextract.html&#34;&gt;caExtract.html&lt;/a&gt; download the latest &lt;code&gt;cacert.pem&lt;/code&gt;, e.g. &lt;code&gt;cacert-2017-01-18.pem&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;replace the original &amp;lsquo;ca-certificates.crt&amp;rsquo; with the latest &lt;code&gt;cacert.pem&lt;/code&gt; , e.g. &lt;code&gt;sudo mv cacert-2017-01-18.pem /etc/ssl/certs/ca-certificates.crt&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;try to &lt;code&gt;yaourt -S tor-browser-en&lt;/code&gt; again&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;ref:&lt;a href=&#34;https://bbs.archlinux.org/viewtopic.php?id=186138&#34;&gt;[SOLVED] /etc/pki/tls/certs/ca-bundle.crt not present&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;07/07/2020&lt;/p&gt;
&lt;p&gt;load avg. vs CPU utilization&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;load avg.&lt;/code&gt;:
&lt;ul&gt;
&lt;li&gt;how many tasks are in kernel waiting queue or running&lt;/li&gt;
&lt;li&gt;not just CPU, also Disk (I/O)&lt;/li&gt;
&lt;li&gt;&lt;em&gt;short-lived tasks can be missed&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;not divided by # of cores&lt;/li&gt;
&lt;li&gt;
&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;5 / core ⇒ HIGH&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;CPU utilization&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;how busy CPU are&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;high load avg. / low cpu utilization:
&lt;ul&gt;
&lt;li&gt;Lot of IO data stuck in &lt;code&gt;WAIT&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;storage issue&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;15/07/2020&lt;/p&gt;
&lt;p&gt;Building container best practice&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;pid 1 (zombie, orphan proc)
&lt;ul&gt;
&lt;li&gt;proper signal handlers for app&lt;/li&gt;
&lt;li&gt;if use script for bootstrap ⇒ &lt;code&gt;exec&lt;/code&gt; to replace pid&lt;/li&gt;
&lt;li&gt;use specialized init system
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;tini&lt;/code&gt;: minimal for container env (signal handler, reap zombie proc,..)
&lt;ul&gt;
&lt;li&gt;run &lt;code&gt;docker --init&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;install as entry point if use k8s&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;enable share process namespace (k8s) - in same pod
&lt;ul&gt;
&lt;li&gt;share file system&lt;/li&gt;
&lt;li&gt;proc is visible from other container&lt;/li&gt;
&lt;li&gt;&lt;em&gt;use&lt;/em&gt; for special case: sidecar for log,&amp;hellip;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;minimal size
&lt;ul&gt;
&lt;li&gt;do not install and remove in diff steps (overlay mechanism)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;sec
&lt;ul&gt;
&lt;li&gt;disable run-as-root&lt;/li&gt;
&lt;li&gt;enable read-only mode for fs&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;inject&lt;/strong&gt; built files to other image
&lt;ul&gt;
&lt;li&gt;build ⇒ copy from build image ⇒ &lt;code&gt;scratch&lt;/code&gt; image&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;08/06/2020&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Linux command to view proc using port&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;lsof -i :[PORT]&lt;/code&gt;: show proc &lt;em&gt;both&lt;/em&gt; listening and established on port&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ss&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;show proc with detailed info&lt;/li&gt;
&lt;li&gt;have intuitive filters
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ss -lptn &#39;dport = :443&#39;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;nestat -nalpt&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;02/02/2021&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;IaC is same with application code
&lt;ul&gt;
&lt;li&gt;have entropy, maintenance burden,&amp;hellip;&lt;/li&gt;
&lt;li&gt;keep thing simple&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;19/02/2021&lt;/p&gt;
&lt;p&gt;EFK setup:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;if you modify any &lt;code&gt;xpack.*&lt;/code&gt; setting in kibana
&lt;ul&gt;
&lt;li&gt;the perf optimization will run → can hang&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;to enable xpack without ssl:
&lt;ul&gt;
&lt;li&gt;setup ES in single-node mode&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;use configmap to put config
&lt;ul&gt;
&lt;li&gt;not env var&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;20/02/2021&lt;/p&gt;
&lt;p&gt;Kubernetes liveness vs readiness&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;liveness:
&lt;ul&gt;
&lt;li&gt;to determine when a pod need to be restarted&lt;/li&gt;
&lt;li&gt;keep beating intervally&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;readiness:
&lt;ul&gt;
&lt;li&gt;to determine use a pod as backend of a service&lt;/li&gt;
&lt;li&gt;if not ready → remove from service load balancer&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&#34;https://www.notion.so/Sharing-Docker-101-0272f2850ae840c5ab9ee1edd73b5251&#34;&gt;Sharing - Docker 101’&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.notion.so/ES-6e708e196b5149e1be7badb962f42308&#34;&gt;ES&lt;/a&gt;&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Greeting 2023</title>
      <link>https://research.cookiearena.org/posts/greeting_2023/</link>
      <pubDate>Thu, 19 Jan 2023 14:06:09 +0700</pubDate>
      
      <guid>https://research.cookiearena.org/posts/greeting_2023/</guid>
      <description>Chào đón năm 2023 với một số cú pháp mới liên quan đến markdown
content content content content </description>
      <content>&lt;p&gt;Chào đón năm 2023 với một số cú pháp mới liên quan đến markdown&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;content&lt;/li&gt;
&lt;li&gt;content&lt;/li&gt;
&lt;li&gt;content&lt;/li&gt;
&lt;li&gt;content&lt;/li&gt;
&lt;/ol&gt;
</content>
    </item>
    
  </channel>
</rss>
