<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Yazdan Mohammadi on Medium]]></title>
        <description><![CDATA[Stories by Yazdan Mohammadi on Medium]]></description>
        <link>https://medium.com/@yzdann?source=rss-153f76dfe4c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*tMGUxBZww2h62hBdVbC3wA.jpeg</url>
            <title>Stories by Yazdan Mohammadi on Medium</title>
            <link>https://medium.com/@yzdann?source=rss-153f76dfe4c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 03:09:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yzdann/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[TIL-05-SEP-2021]]></title>
            <link>https://medium.com/@yzdann/til-05-sep-2021-139b5f4a3d73?source=rss-153f76dfe4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/139b5f4a3d73</guid>
            <dc:creator><![CDATA[Yazdan Mohammadi]]></dc:creator>
            <pubDate>Tue, 05 Oct 2021 10:11:49 GMT</pubDate>
            <atom:updated>2021-10-05T10:11:49.104Z</atom:updated>
            <content:encoded><![CDATA[<h3>TIL-20-SEP-2021</h3><p><a href="https://www.youtube.com/watch?v=2zL9DymXi1E">https://www.youtube.com/watch?v=2zL9DymXi1E</a></p><p>constantly firing, flapping<br>diffcult to distinguish severity<br>leading to alert fatigue<br>low quality, unactionable<br> — — -<br>low recall<br>user based alerting</p><p>— — — <br>alerts that dont fire because the condition isn’t met and alerts that dont fire</p><p>— -<br>broken dash</p><p>— — <br>the source of thruth<br>app metrics, prom alerting and recording rules, grafana</p><p>— -<br>key metrics, improve quality of our alerting, configure alerts and dash from a single config</p><p>— — <br>latency, traffic, errors, saturation</p><p>ARES<br>apdex % -&gt; latency<br>errors % -&gt; req fail with error<br>requests psecs -&gt; the rate qps<br>saturation % -&gt; constrained resource? how close to 100% sat</p><p>— — <br>apdex<br>satitsfactory<br>tolerated<br>every else</p><p>avg apdex score over time<br>per endpoint, per service<br> — -<br>Apdex, Error rate -&gt; symptom based =&gt; eng should investigate</p><p>bad user x<br> — -<br>Req rate , sat above -&gt; cause based</p><p>— — <br>tricky metrics<br>+ the double dipper (delayed firiing) -&gt; up and down spike<br>+ the lurker (never fiers) -&gt; just near slo thershold<br>+ falppy bird -&gt; fires over and over -&gt; a little over</p><p>mutli burn — multi window<br> — -<br>related dash<br>tool tip in dashboard<br>mermaid diagram</p><p>======<br>key metrics for each<br>symptom based alerting<br>metrics catalog as SSOT<br>multi burn rate, multi window</p><p>— -<br>canary , prod label</p><p>— -<br>service graph row by row and scroll to findout where is the problem<br>frontend graph panel<br>distributer graph panel<br>ingster graph panel</p><p>— -<br>avg<br>latency are not sum <br>- one service high latency <br>one of them below have one high avg</p><p>- sanity check<br> — —</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=139b5f4a3d73" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TIL-1-SEP-2021]]></title>
            <link>https://medium.com/@yzdann/til-1-sep-2021-66ffdc925ba0?source=rss-153f76dfe4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/66ffdc925ba0</guid>
            <dc:creator><![CDATA[Yazdan Mohammadi]]></dc:creator>
            <pubDate>Wed, 01 Sep 2021 19:00:35 GMT</pubDate>
            <atom:updated>2021-09-01T19:00:35.169Z</atom:updated>
            <content:encoded><![CDATA[<p>DNS TCP: TCP 53 is used mainly for Zone Transfers (see explanation below) and also when the query exceeds 512 bytes. This is valid when DNSSEC is used which adds extra overhead to the DNS query (cryptographic keys, signatures etc). Also, now with IPv6, the query reply packets can also get bigger than 512 bytes.</p><p>What are Zone Transfers: A Zone Transfer is replication of DNS records from one DNS server to another. This communication uses TCP port 53. Basically it is a fast way to replicate the DNS database of one server across to other servers. The DNS query type used for zone transfer is AXFR.</p><p>— — —</p><p><a href="https://martinfowler.com/bliki/CircuitBreaker.html">bliki: Circuit Breaker</a></p><p>— — —</p><p>The dead-letter queue: The purpose of the dead-letter queue is to hold messages that can’t be delivered to any receiver, or messages that couldn’t be processed</p><p>— — —</p><p>Link list vs array mem compare</p><p>As the elements in an array store in one contiguous block of memory, so array is of fixed size</p><p>x bytes for data and x bytes for pointer variable.</p><p>— — —</p><p>heapdump</p><p><a href="https://www.golinuxcloud.com/how-to-find-memory-leaks/">https://www.golinuxcloud.com/how-to-find-memory-leaks/</a></p><p>—</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66ffdc925ba0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TIL-1-MAY-2020]]></title>
            <link>https://medium.com/@yzdann/til-1-may-2020-c666fae1b39b?source=rss-153f76dfe4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c666fae1b39b</guid>
            <dc:creator><![CDATA[Yazdan Mohammadi]]></dc:creator>
            <pubDate>Fri, 01 May 2020 15:42:29 GMT</pubDate>
            <atom:updated>2020-05-01T15:42:29.792Z</atom:updated>
            <content:encoded><![CDATA[<p>.</p><h4><a href="https://www.datadoghq.com/blog/go-logging/">go-logging datadog</a></h4><p>1- Write your logs to a file : you can leave these jobs to specialized software like the Datadog Agent.</p><p>2- Implement a standard logging interface: enforce standardization is to create an interface between your application code and the logging library</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/847/0*1PaJsHscewpgJI8w" /></figure><p>3- Track Golang logs across microservices : trace ID in the x-trace header, generating one if it doesn’t exist. Downstream microservices use the x-span headers of incoming requests to specify the parents of the spans they generate, and send that information as the x-parent header to the next microservice in the chain. <a href="https://github.com/opentracing/opentracing-go">opentracing-go</a></p><p>—</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c666fae1b39b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TIL-16-MAR-2020]]></title>
            <link>https://medium.com/@yzdann/til-16-mar-2020-9fac11e77f73?source=rss-153f76dfe4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/9fac11e77f73</guid>
            <dc:creator><![CDATA[Yazdan Mohammadi]]></dc:creator>
            <pubDate>Mon, 16 Mar 2020 19:56:46 GMT</pubDate>
            <atom:updated>2020-03-16T19:56:46.285Z</atom:updated>
            <content:encoded><![CDATA[<p>.</p><pre># find lines 2 files have in common <br>comm</pre><pre># pipe viewer gives you stats on data going through<br>pv</pre><pre># formats input into columns<br>column</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9fac11e77f73" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TIL-13-MAR-2020]]></title>
            <link>https://medium.com/@yzdann/til-13-mar-2020-408dc78712a4?source=rss-153f76dfe4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/408dc78712a4</guid>
            <dc:creator><![CDATA[Yazdan Mohammadi]]></dc:creator>
            <pubDate>Fri, 13 Mar 2020 14:53:20 GMT</pubDate>
            <atom:updated>2020-03-13T14:53:20.312Z</atom:updated>
            <content:encoded><![CDATA[<p>Notes from Pragmatic Thinking</p><p>As with most people, I am a novice when it comes to doing my<br>taxes. I have little experience; despite having filed taxes for more<br>than twenty-five years, I haven’t learned anything or changed my<br>thinking about it.</p><p>Rules can get you started, but they won’t carry you further.</p><p>If you tried to force the<br>larger context on an advanced beginner, they would probably dis-<br>miss it as irrelevant.</p><p>They have the experience<br>and the judgment to understand what this maxim means in con-<br>text. And context</p><p>Charles Darwin pegged it when he said, “Ignorance more<br>frequently begets confidence than does knowledge.”<br>The converse seems to be true as well; once you truly<br>become an expert, you become painfully aware of just<br>how little you really know.</p><p>Practices can never be completely objectified or formalized<br>because they must ever be worked out anew in particu-<br>lar relationships and in real time.”</p><p>Use rules for novices, intuition for experts.</p><p>Rules -&gt; Intution, Consider Everything -&gt; Relevant Focus, <br>Detach Observer -&gt; Part of system</p><p>Expert != Teacher</p><p>Intuition and pattern<br>matching replace explicit knowledge.</p><p>• You need a well-defined task.<br>• The task needs to be appropriately<br>difficult — challenging but doable.<br>• The environment needs to supply informative<br>feedback that you can act on.<br>• It should also provide opportunities for repetition and<br>correction of errors</p><p>Learn by watching and imitating.</p><p>• Imitate<br>• Assimilate<br>• Innovate</p><p>Shu Ha Ri<br>Shu phase, the student copies the techniques as taught — <br>from a single instructor — without modifications<br>Ha stage,<br>the student must reflect on the meaning and purpose and come to<br>a deeper understanding<br>Ri means to go beyond or transcend; no<br>longer a student, the practitioner now offers original thought.</p><p>The question isn’t the position they play, or even their<br>years of experience; the question is, what is the value they bring to<br>the organization?</p><p>Keep practicing in order to remain expert.</p><p>Although these tools(uml/…) and models have their<br>place and can be useful in the right environments, none of them<br>has become the hoped-for universal panacea. Worse yet, the misap-<br>plication of these approaches has probably done far more damage<br>than good.</p><p>model is a tool, not a mirror</p><p>Spelling out the particulars in too much detail can be over-<br>whelming. This leads to a problem called infinite regress: as<br>soon as you make one set of assumptions explicit, you’ve<br>exposed the next level of assumptions that you must now<br>address. And so on, and so on.</p><p>The same standard may not always apply equally in all situ-<br>ations.If Bob and Alice are hugely productive with<br>Eclipse, it might wreck Carol and Ted. They prefer IntelliJ or<br>TextMate or vi.</p><p>Avoid formal methods if you need creativity, intuition, or<br>inventiveness.</p><p>all those critical details that the<br>expert knows to look for, while ignoring the irrelevant details.<br>Context matters</p><p>beware of decontextualized objectivity.</p><p>“I want to open this locked<br>door” really isn’t sufficient. What’s the context? Why does the door<br>need to be opened? Is it appropriate to use an axe, a chainsaw, or<br>lock-picking tools, or can we just go around back and use the other<br>door?</p><p>you need some people to worry about the trees while everyone is pondering the forest.</p><p>Capture Insight 24x7<br>R-mode is unpredictable at best, and you need to be prepared for<br>that. Answers and insights pop up independently of your conscious<br>activities, and not always at a convenient time.</p><p>If you don’t keep track of great ideas, you will stop noticing you<br>have them.</p><p>The corollary is also true — once you start keeping track of ideas,<br>you’ll get more of them. Your brain will stop supplying you with<br>stuff if you aren’t using it</p><p>— — — — — — <br> / pull it of \<br> — — — — — — — — <br> / act \<br> — — — — — — — — — — <br> / keep track of them \<br> — — — — — — — — — — — — <br> / have great idea \<br> — — — — — — — — — — — — — -</p><p>Don’t Dissect the Frog, Build It [Neg94] that to really learn about a frog, tra-<br>ditional dissection is not the way to go. The better way to learn<br>about a frog is to build one</p><p>Learn by synthesis as well as by analysis.</p><p>Design is not making beauty; beauty emerges<br>from selection, affinities, integration, love</p><p>Creativity comes from the selection and assembly of just the right<br>components in just the right presentation to create the work. And<br>selection — knowing what to select and in what context — comes<br>from pattern matching.</p><p>This experiment seems to amplify the fact that if you’re looking<br>for global, holistic patterns, you need R-mode. If you need to ana-<br>lyze parts and look into the detail, then you need a more L-mode<br>approach.</p><p>Immerse yourself in it</p><p>we tend to dismiss unusual or uncomfortable thoughts — and that’s a bad thing.</p><p>Thinking back on it, this instructor really did the correct<br>thing: he provided us with a safe environment in which to explore<br>(remember, he made sure everyone’s safety gear was correctly fitted<br>and adjusted before turning us loose).</p><p>write drunk; revise sober.</p><p>learning can be impeded by trying to memorize minor facts<br>when you don’t yet grasp the whole</p><p>Don’t be in such a hurry. When prob-<br>lem solving, learn to be comfortable with uncertainty</p><p>Perfectionism is the voice of the oppressor, the enemy<br>of the people. It will keep you cramped and insane your<br>whole life, and it is the main obstacle between you and a<br>shitty first draft. I think perfectionism is based on the obses-<br>sive belief that if you run carefully enough, hitting each<br>stepping-stone just right, you won’t have to die. The truth<br>is that you will die anyway and that a lot of people who<br>aren’t even looking at their feet are going to do a whole<br>lot better than you, and have a lot more fun while they’re<br>doing it.</p><p>use random juxaposition to create metaphore.<br>two random concept ! -&gt;<br>For example, cigarette and traffic light might meld<br>into the concept of using a red band on the cigarette as a stop-<br>smoking aid.</p><p>you don’t plan ahead to gather these particular stones for that wall.<br>You just walk around and pick up a few good-looking stones for<br>the future and make a pile.Then when you get around to building<br>the wall, you look into the stone pile and find a nice match for the<br>section you’re working on at the moment.</p><p>Have you ever noticed that great ideas or insights may come to you<br>at the oddest times? Perhaps while taking a shower, mowing the<br>yard, doing the dishes, or doing some other menial task.<br>That happens because the L-mode sort of gets bored with the rou-<br>tine, mundane task and tunes out — leaving the R-mode free to<br>present its findings.</p><p>Step away from the keyboard to solve hard problems.</p><p>Many times it’s hard to see things that are<br>right in front of you, because you get used <br>to seeing patterns in a certain way. <br>easy to get stuck in a rut — to get stuck in.<br>certain thought patterns and accustomed</p><p>The key to creativity and problem solving lies in finding different<br>ways of looking at a problem</p><p>very powerful technique. You<br>around.<br>can use that when debugging: instead of<br>trying to prevent a difficult-to-find bug, try coming up with three<br>to four ways to deliberately cause it.</p><p>Most problems have mul-<br>tiple solutions or multiple “right answers.” The one-right-answer<br>idea probably was true only for grade-school arithmetic.</p><p>Cognitive biases: How your thinking can be led astray<br>Generational affinity: How your peers influence you<br>Personality tendencies: How your personality influences your<br>thoughts<br>Hardware bugs: How older portions of your brain can override<br>the smarter portions</p><p>Bias:<br>- Anchoring<br>- Fundamental attribution error : We tend to ascribe other people’s behavior to their person-<br>ality, instead of looking at the situation and the context<br>in which their behavior occurs.<br>- Self-serving bias<br>- Need for closure<br>- Confirmation bias<br>- Exposure effects: We tend to prefer things just because they are familiar.<br>- Hawthorne effect: the spotlight moves away, and everyone slides inexorably back to previous<br>behaviors.<br>- False memory: every read is a write.Your memories are constantly rewritten in light of your current context<br>- Symbolic reduction fallacy: oversimplification<br>- Nominal fallacy: labeling a thing means you can explain it or understand<br>- Failure to Predict</p><p>because we’re focused on Unexpected events<br>the wrong thing or are asking the wrong change the game.</p><p>Just because two variables are correlated does not mean that either causes the other<br>Just because you “think so” doesn’t make it right.<br>Watch the outliers: “rarely” doesn’t mean “never.”<br>Be comfortable with uncertainty.</p><p>Extravert (E) vs. Introvert (I)<br>Sensing (S) vs. Intuition (N)<br>Thinking (T) vs. Feeling (F)<br>Judging (J) vs. Perceiving (P)</p><p>Trust intuition, but verify.<br>It could be your expert intuition at work, or maybe it’s just a cog-<br>nitive bias or other bug. You need to get some feedback: create a<br>prototype, run some unit tests, and chart some benchmarks. Do<br>what you need to do to prove that your idea is a good one, because<br>your intuition may have been wrong.</p><p>When you are dead solid convinced of something, ask yourself why.</p><p>It’s all a trade-off.<br>It is by logic we prove; it is by intuition we discover.</p><p>SMART stands for Specific, Measurable, Achievable,<br>Relevant, and Time-boxed</p><p>An objective is something you do to get you closer to that goal.</p><p>Specific<br>“I want to learn Erlang.” Narrow that down to something concrete,<br>such as “I want to be able to write a web server in Erlang that<br>dynamically generates content.”</p><p>If you think you can’t measure your objective, <br>then it’s probably not specific enough.</p><p>A goal or objective that you cannot attain is not a target; it’s just a<br>maddening, soul-sucking frustration</p><p>Make each next objective attainable from where you are now.</p><p>It needs to matter and be something that you have control over.</p><p>Without deadlines, a goal will languish and be<br>perpetually pushed aside by the more pressing exigencies of the<br>day. It will never happen.</p><p>Dropping ten<br>pounds in a week is attainable in a local sense but unwise to<br>the whole system because of overall, long-term health concerns.</p><p>writing documentation for documentation’s sake is a<br>waste of time.</p><p>the investment in cre ating any documentation is really worth the effort</p><p>Learn from similarities; unlearn from differences.</p><p>Not all mistakes arise from things you do; others come from things you didn’t do but should have done.</p><p>a live and unsuspecting patient is not the<br>right context for experimentation</p><p>Freedom to experiment<br>Ability to backtrack to a stable state<br>Reproduce any work product as of any time<br>Ability to demonstrate progress</p><p>we learn better by discovery, not instruction</p><p>don’t just do something; stand there<br>Trying fails, awareness cures.</p><p>Always be the worst guy in every band<br>you’re in. If you’re the best guy there, you need to be in a different<br>band. And I think that works for almost everything that’s out there<br>as well.”</p><p>mirror neurons that help: watching someone else’s behavior triggers<br>an equivalence for you to do the same</p><p>the overabundance of information has resulted in a<br>poverty of knowledge and attention.</p><p>you can spend all the CPU cycles coordinating<br>tasks with all the other CPUs and not actually get any work done.</p><p>procrastination: an unrelated, unproductive activity that blocks the real work you need to do.<br>If the task is something you really just don’t want to do, then<br>it’s likely that any diversions are simply procrastination.</p><p>Your own book collection, your notes, and even your favorite IDE<br>and programming language all form part of your exocortex, which is<br>any mental memory or processing component that resides outside<br>your physical brain</p><p>context switch: it takes 20 mins to reload context.</p><p>Context blown.</p><p>interruption lag / resumption lag<br>The time it takes you to get back up to speed is the resumption lag.</p><p>Optimize your personal workflow to maximize context.</p><p>Writing: TextMate, Dict, OmniGraffle<br>Coding: …<br>Communications: Email, Todo, Slack</p><p>Remember the danger doesn’t lie in doing something wrong; it<br>lies in doing nothing at all. Don’t be afraid to make mistakes.</p><p>People look without seeing, hear without listening, eat with-<br>out awareness of taste, touch without feeling, and talk without<br>thinking</p><p>Grab the wheel. You can’t steer on autopilot.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=408dc78712a4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TIL-8-MAR-2020]]></title>
            <link>https://medium.com/@yzdann/til-8-mar-2020-1ae189369b4d?source=rss-153f76dfe4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/1ae189369b4d</guid>
            <dc:creator><![CDATA[Yazdan Mohammadi]]></dc:creator>
            <pubDate>Sat, 07 Mar 2020 22:50:36 GMT</pubDate>
            <atom:updated>2020-03-07T22:50:36.893Z</atom:updated>
            <content:encoded><![CDATA[<p>.</p><h4><a href="https://hakibenita.com/django-group-by-sql">django group by sql</a></h4><pre>####<br># group by distinct<br>unique_names=Count(&#39;last_name&#39;, distinct=True)</pre><pre>####<br># aggregate field<br>.annotate(pct_unique_names=(<br>    Cast(&#39;unique_names&#39;, FloatField())<br>    / Cast(&#39;total&#39;, FloatField())</pre><pre>####<br># group by across realtion<br>(User.objects<br>.values(&#39;user_profile__type&#39;)<br>.annotate(total=Count(&#39;id&#39;)))</pre><p>—</p><h4><a href="https://towardsdatascience.com/tour-of-python-itertools-2af84db18a5e">itertools</a></h4><p>—</p><p><a href="https://github.com/c4urself/bump2version/">https://github.com/c4urself/bump2version/</a></p><p><a href="https://github.com/hynek/structlog/blob/master/setup.py">https://github.com/hynek/structlog/blob/master/setup.py</a></p><p><a href="https://github.com/pypa/setuptools_scm/">https://github.com/pypa/setuptools_scm/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1ae189369b4d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TIL-12-FEB-2020]]></title>
            <link>https://medium.com/@yzdann/til-12-feb-2020-f3fbc32d7aec?source=rss-153f76dfe4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/f3fbc32d7aec</guid>
            <dc:creator><![CDATA[Yazdan Mohammadi]]></dc:creator>
            <pubDate>Wed, 12 Feb 2020 21:17:03 GMT</pubDate>
            <atom:updated>2020-02-12T21:17:03.235Z</atom:updated>
            <content:encoded><![CDATA[<p>.</p><h4><a href="https://skerritt.blog/">Algorithm Design</a></h4><p><strong>Divide and Conquer</strong></p><ul><li>Problem — Divide — Conquer — Merge.</li><li>The recurrence always starts with a base case.</li><li>If we have an algorithm that takes a list and does something with each element of the list, it might be able to use divide and conquer.</li><li>Once you’ve identified how to break a problem down into many smaller pieces, you can use concurrent programming to execute these pieces at the same time (on different threads) speeding up the whole algorithm.</li></ul><p><strong>Dynamic Programming</strong></p><ul><li>each sub-problem is only calculated once</li><li>Memoisation (not memorisation) is the act of storing a solution.’</li><li>When we see terms like: ”shortest/longest, minimized/maximized, least/most, fewest/greatest, biggest/smallest”</li><li>realize what we’re optimising for, we have to decide how easy it is to perform that<br>optimisation.</li><li>think about what the brute force solution might look like</li><li>If we can identify sub-problems, we can probably use Dynamic Programming</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*f0f_oebeJGwt2OUpB5VLww.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f3fbc32d7aec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TIL-11-FEB-2020]]></title>
            <link>https://medium.com/@yzdann/til-11-feb-2020-f438abcac535?source=rss-153f76dfe4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/f438abcac535</guid>
            <dc:creator><![CDATA[Yazdan Mohammadi]]></dc:creator>
            <pubDate>Tue, 11 Feb 2020 08:32:05 GMT</pubDate>
            <atom:updated>2020-02-11T20:02:51.314Z</atom:updated>
            <content:encoded><![CDATA[<p>.</p><h4><a href="https://binaroid.com/blog/django-centralised-logging-using-elasticsearch-logstash-kibana-elk-filebeat">elk-django</a></h4><p>—</p><h4><a href="https://blog.pragmaticengineer.com/software-architecture-is-overrated/">software-architecture-is-overrated</a></h4><ul><li>Good software design and good architecture are all about making the right tradeoffs. No design choice is good or bad by itself: it all depends on the context and the goals.</li><li>However, you will rarely hear anyone suggesting to start with applying the <a href="https://en.wikipedia.org/wiki/Design_Patterns">Gang of four design patterns</a> to your code. Clean code starts with things like single responsibility, clear naming, and easy to understand.</li><li>Similarly, knowing about common architecture patterns is a good thing: it helps shorten discussions with people, who understand them the same way as you do. But architecture patterns are not the goal, and they won’t substitute for simpler system designs. When designing a system, you might find yourself having accidentally applied a well-known pattern: and this is a good thing. Later, you can reference your approach easier. But the last thing you want to do is taking one or more architecture pattern, using it as a hammer, looking for nails to use it on.</li><li>As an engineer, your goal should be more about solving solutions and learning through them rather than picking a shiny architecture pattern, in hopes that that will solve your problem.</li><li>Design it two different ways and contrast the two designs. When most people design an architecture, they go with one approach: the one popping in their head. However, architecture is not black-and-white. Come up with a second design that could also work. Contrast the two, explaining why one is better than the other. List the second design briefly as an alternative considered, arguing why it was decided against.</li></ul><p>—</p><h4><a href="https://realpython.com/python-async-features/">getting started with async</a></h4><ul><li>The polling parent: the parent would periodically break away from the current task and check to see if any other tasks need attention.</li><li>time.sleep(delay) and yield statements, and replacing them with await asyncio.sleep(delay). This creates a non-blocking delay that will perform a context switch back to the caller main().</li></ul><p>—</p><h4><a href="https://orbifold.xyz/zen-of-python.html">Zen of python</a></h4><ul><li>Errors should never pass silently… : return victorious, or not at all.</li><li>Unless explicitly silenced.</li><li>There should be one — and preferably only one — obvious way to do it there is no reason to intentionally provide multiple, redundant ways to achieve the same thing. There is a sense in which some solutions are “better” or “more Pythonic.”</li><li>If the implementation is hard to explain, it’s a bad idea.</li></ul><p>—</p><h4><a href="https://pythonspeed.com/articles/custom-python-profiler/">python-speed</a></h4><pre>import os<br>import psutil</pre><pre>def not_cpu_time():<br>    times = os.times()<br>    return times.elapsed - (times.system + times.use</pre><pre><br>_current_process = psutil.Process()<br>def profile_voluntary_switches(f, *args, **kwargs):<br>    prof = cProfile.Profile(<br>        lambda: _current_process.num_ctx_switches().voluntary)<br>    prof.runcall(f, *args, **kwargs)<br>    result = pstats.Stats(prof)<br>    result.sort_stats(&quot;time&quot;)<br>    result.print_stats()</pre><p>—</p><h4><a href="https://strangemachines.io/articles/performant-python">performant-python</a></h4><ul><li>Tuples take a bit less memory than lists.</li><li>Tuple to dict</li></ul><pre>t = ((&#39;company&#39;, &#39;Strangemachines&#39;), (&#39;city&#39;, &#39;Amsterdam&#39;))<br>dict(t) # {&#39;company&#39;: &#39;Strangemachines&#39;, &#39;city&#39;: &#39;Amsterdam&#39;}</pre><ul><li>Generators are smaller than large tuples, but bigger than small tuples.</li><li>slotted classes&lt; namedtuple &lt; regular class.</li><li>Iterating lists is slightly faster than tuples.</li><li>Iterating generators is much faster than lists</li><li>Map is faster than for, but only if the map is not converted to a list.</li><li>Filter is faster than for.</li><li>List comprehensions are slower than map and filter and using generators instead of list comprehension. Even with a lambda function, map is faster</li><li>Dictionary comprehensions are slower than map and filter as well</li></ul><p>—</p><h4><a href="https://skerritt.blog/">Algorithm Design</a></h4><h4>Greedy:</h4><ul><li>At that exact moment in time, what is the optimal choice to make?</li><li>The greedy algorithm starts from the highest denomination and works backwards</li><li>It is optimal locally, but sometimes it isn’t optimal globally.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f438abcac535" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TIL-07-JAN-2020]]></title>
            <link>https://medium.com/@yzdann/til-07-jan-2020-e7eed9c0ed84?source=rss-153f76dfe4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7eed9c0ed84</guid>
            <dc:creator><![CDATA[Yazdan Mohammadi]]></dc:creator>
            <pubDate>Tue, 07 Jan 2020 19:41:31 GMT</pubDate>
            <atom:updated>2020-01-07T20:23:55.633Z</atom:updated>
            <content:encoded><![CDATA[<p>.</p><h4><a href="https://martinheinz.dev/blog/13">Making Py fast</a></h4><pre>time python3.8 slow_program.py</pre><pre># using cProfile but too much info :)</pre><pre>python3.8 -m cProfile -s time slow_program.py</pre><pre># using decorator</pre><pre>def timeit_wrapper(func):<br>    @wraps(func)<br>    def wrapper(*args, **kwargs):<br>        start = time.perf_counter()  # Alternatively, you can use time.process_time()<br>        func_return_val = func(*args, **kwargs)<br>        end = time.perf_counter()<br>        print(&#39;{0:&lt;10}.{1:&lt;8} : {2:&lt;8}&#39;.format(func.__module__, func.__name__, end - start))<br>        return func_return_val<br>    return wrapper</pre><ul><li>Caching/Memoization with lru_cache</li><li>use local vars</li></ul><pre>#  Example #1<br>class FastClass:<br><br>    def do_stuff(self):<br>        temp = self.value  # this speeds up lookup in loop<br>        for i in range(10000):<br>            ...  # Do something with `temp` here<br><br>#  Example #2<br>import random<br><br>def fast_function():<br>    r = random.random<br>    for i in range(10000):<br>        print(r())  # calling `r()` here, is faster than global random.random()</pre><ul><li>Another thing that might slow down your programs is <em>dot operator</em> (.) which is used when accessing object attributes. This operator triggers dictionary lookup using __getattribute__, which creates extra overhead in your code. So, how can we actually avoid (limit) using it?</li></ul><p>—</p><p>Some tips from martin</p><ul><li>Naming a Slice Using slice Function</li></ul><pre>ID = slice(0, 8)<br>customer_id = f&quot;{line_record[ID].strip()}-sth-else&quot;</pre><ul><li>import difflib</li><li>Defining Multiple Constructors in a Class</li></ul><pre>class Date:<br>    def __init__(self, year, month, day):<br>        self.year = year<br>        self.month = month<br>        self.day = day<br><br>    @classmethod<br>    def today(cls):<br>        t = datetime.datetime.now()<br>        return cls(t.year, t.month, t.day)</pre><ul><li>from collections import Counter</li></ul><p>—</p><h4>Pragmatic Thinking</h4><ul><li>As with most people, I am a novice when it comes to doing my<br>taxes. I have little experience; despite having filed taxes for more<br>than twenty-five years, I haven’t learned anything or changed my<br>thinking about it.</li><li>Rules can get you started, but they won’t carry you further.</li><li>If you tried to force the<br>larger context on an advanced beginner, they would probably dis-<br>miss it as irrelevant.</li><li>They have the experience<br>and the judgment to understand what this maxim means in con-<br>text. And context</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7eed9c0ed84" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TIL-29-DEC-2019]]></title>
            <link>https://medium.com/@yzdann/til-29-dec-2019-59594319ab46?source=rss-153f76dfe4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/59594319ab46</guid>
            <dc:creator><![CDATA[Yazdan Mohammadi]]></dc:creator>
            <pubDate>Sun, 29 Dec 2019 17:30:18 GMT</pubDate>
            <atom:updated>2019-12-29T17:30:18.784Z</atom:updated>
            <content:encoded><![CDATA[<p>.</p><ul><li>Divorcing data from meaning.</li><li>Diff btwn human readable and human understandable.</li><li>On Debugging concentrate on fixing problem not the blame.</li><li>Don’t Assume it — Prove it.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59594319ab46" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>