<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
  
  <title>Bartek Jaskulski</title>
  <subtitle>Work and writing by Bartek Jaskulski.</subtitle>
  <link href="https://bjaskulski.pl/feed.xml" rel="self" />
  <link href="https://bjaskulski.pl/" />
  <updated>2026-10-05T22:54:43Z</updated>
  <id>https://bjaskulski.pl/</id>
  <author>
    <name>Bartek Jaskulski</name>
    <email>me@bjaskulski.pl</email>
  </author>
  <entry>
    <title>Speak (in your words) when spoken to</title>
    <link href="https://bjaskulski.pl/writings/speak-when-spoken-to/" />
    <updated>2026-10-05T22:54:43Z</updated>
    <id>https://bjaskulski.pl/writings/speak-when-spoken-to/</id>
    <content type="html">&lt;p&gt;I love that more and more voices online (at least those, who I happen to read by accident on Hacker News or &lt;a href=&quot;http://Lobste.rs&quot;&gt;Lobste.rs&lt;/a&gt;) emphasize that one should not simply be human proxy meat.&lt;/p&gt;
&lt;p&gt;It truly dreads me, how on the course of few past years, with exponential degradation over less than last 12 months, people loose the ability to think critically. Actually, this seems to proceed inversly proportional to the technological advancements. I may sound like an old prick, praising the past, when everything was simpler, and scolding the rotten present. And maybe I am to some level. But I am definitely put up with reading verbatim citations from llm tools. Some stress, that if they wanted to read a language model&#39;s opinion on the matter, they would&#39;ve promted it theirselves. For me this is not the point. I feel insulted too. Yet, the real reason it itches me, is the fact that you waste my time and neither of us learns anything.&lt;/p&gt;
&lt;p&gt;Above may sound harsh, nonetheless, the AI sugarcoates everything, wastes tokens on weasel passages and forces me to dig through the mud to get to the essence. The most of us hates meetings, precisely because a poorly conducted gathering leads to inflation of words, voiding time of everyone present for a little value. You see the resemblance?&lt;/p&gt;
&lt;p&gt;The learning part is the sad one. Back in the days, when I was occasionally playing on the stage, the most efficient mnemonic technique to learn by heart a few pages of text was to rewrite it by hand. Programming tutorials for absolute begginers follow the same pattern, actively encouraging to write down mundane code blocks, execute them, experiment. This is a valid technique for infusing one&#39;s mind with the knowledge. Currently being replaced by a shortcut which doesn&#39;t even require a minimal muscle flexing. Copy-paste teaches you nothing. Reading, then pasting, while may help you feel better about yourself (at least you know what you forward, right?), doesn&#39;t teach you anything either. The minimal effort you can put, that allows the knowledge to sink into your skin, is to write the thought in your own words. You don&#39;t have to understand it perfectly, that&#39;s the entire point. You are learning after all, constantly. When rewriting, you will find yourself skipping on some lines that are a pure fluff; you will find asking yourself follow up questions, that you can feed back to the llm to deepen the knowledge; you will remember a tiny fraction of what you&#39;ve just written, then repeat it over and over, until you will grasp it and won&#39;t need an AI to express a valid point. And I won&#39;t be pissed at you.&lt;/p&gt;
&lt;p&gt;I beat myself up to this day, for over a year, for submitting a fully generated internal architecture proposal (one about  server management, when we had to decide stack to transition to). I wasn&#39;t simply asking the llm to hallucinate something barely holding the ground, just to check off my task. I really dove deep into servers&#39; architecture, trying to strike a good balance between complexity, features and ease of management, having our team&#39;s level of expertise in mind. (I was, and still am, learning about servers; at that time with help of the ai, trying to uncover every nook and cranny). And I stood by every decision presented to the CTO. He gently told me how utter shit the document was, and that I musn&#39;t simply dump llm output into the internal docs.&lt;/p&gt;
&lt;p&gt;I must admit, at first I was mostly sulking. I understood the form of the text could be better, as this one was full of obvious ai artifacts. Still, the content was something I spent 2 days of my work on and it was planned into the last detail. Or so I thought.&lt;/p&gt;
&lt;p&gt;Nevertheless, from that day on, I decided not to use the AI in communication with other people. By no means I am against AI usage. This is my daily tool, effectively enhancing my brain power, speed and understanding. But I remain responsible for the final output, and I keep my quality gates high. I cannot embarras myself, if you&#39;d like to ask me a follow up question and I&#39;d have to put you on halt to wait for my llm response.&lt;/p&gt;
&lt;p&gt;I expect the same from you. After all, I asked you a question because I want to know your opinion on the matter. You don&#39;t have to feel like you are the brightest mind in the room, especially when asked directly. It doesn&#39;t matter anymore. The AI already swept the field and can easily outsmart majority of the population (to some level). What I want is to be certain, I can rely on you, not as my stenotypist, but a person who considers available options, weigths the consequences and has the guts to call the shots.&lt;/p&gt;
&lt;p&gt;Succumbing to the path of least resistance is what I fear the most and what frustrates me about passtrough copy of the llm output, not the fact, that I could type it myself in an identical chat window, using the same model make and receiving a response close to the one you just sent.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;And if I ever use the AI, when writing to you, I&#39;ll inform you, along with an explanation on why I couldn&#39;t write it myself and &lt;strong&gt;sincerest apologies&lt;/strong&gt;.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Using AI agents from mobile</title>
    <link href="https://bjaskulski.pl/writings/mobile-agents/" />
    <updated>2026-10-02T23:06:04Z</updated>
    <id>https://bjaskulski.pl/writings/mobile-agents/</id>
    <content type="html">&lt;p&gt;This one have been tempting, I keep thinking about how cool it would be to setup an agent ready to communicate with my phone in any way, like through whatsapp, ssh, either. And I know, I must never do it. For my sanity. Having always-on access to vibe coding would be like a doom-scrolling for programmer, a doom-vibing, really. I truly fear, I would succumb to filling up every minute of my free time (even going beyond that!) to tinker with projects, come up with new ideas, never stop working. And such vision scares me.&lt;/p&gt;
&lt;p&gt;Even now, I installed github on my phone to have access to write down some of my thoughs whenever I feel like it, and here we are, 1 a.m. writing down a second post immediately.&lt;/p&gt;
&lt;p&gt;So if I limit my working to 40-50h a week, it&#39;s not because I am sloppy, lazy and cannot keep the pace of moder worlds. I choose to move at my own speed, as things need time to grow, and rushing them is not always a viable solution.&lt;/p&gt;
&lt;p&gt;I am also afraid of losing control over the code. This happens even with regular coding agents, but in terminal the loop is closer, I can easily inspect recent diff, complain about specific word choices or overall code organization. It helps with code ownership, understanding and sometimes even learning, when I set out to tackle what otherwise might be close to impossible for me. The very premise of mobile agents seems to be the opposite of that flow.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://bjaskulski.pl/tags/ai/&quot;&gt;#ai&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Fed up with dotfiles tricks</title>
    <link href="https://bjaskulski.pl/writings/dotfiles/" />
    <updated>2026-10-02T22:08:47Z</updated>
    <id>https://bjaskulski.pl/writings/dotfiles/</id>
    <content type="html">&lt;p&gt;Really, what is so great about &lt;code&gt;zsh&lt;/code&gt;, &lt;code&gt;exa&lt;/code&gt; and other &lt;em&gt;cool&lt;/em&gt; tools. I admit, I&#39;ve been swept by the idea once, mingling with my dots all the time, but it can only take you so far.&lt;/p&gt;
&lt;p&gt;Like that boasting for &lt;code&gt;zoxide&lt;/code&gt; with insanely smart and fast navigation... Did you hear of &lt;code&gt;CDPATH&lt;/code&gt;? Combined with native &lt;code&gt;fish&lt;/code&gt; features (which is superior shell) gives you superpowers in navigation and else beyond comprehension. Really, try it, type letter or two and arrow right, out of the box.&lt;/p&gt;
&lt;p&gt;What I really try to say is that I cherish my minimal config. It&#39;s really &lt;code&gt;fish&lt;/code&gt;, &lt;code&gt;fd&lt;/code&gt;, &lt;code&gt;rg&lt;/code&gt;, &lt;code&gt;neovim&lt;/code&gt;, &lt;code&gt;lf&lt;/code&gt;, some custom code living in my &lt;a href=&quot;https://github.com/bart-jaskulski/dot&quot;&gt;dotfiles&lt;/a&gt; and we&#39;re good to go. And when I &lt;code&gt;ssh&lt;/code&gt; into server, I don&#39;t miss my fancy setup, just changing suit into &lt;code&gt;bash&lt;/code&gt;, &lt;code&gt;find&lt;/code&gt;, &lt;code&gt;grep&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Focus on what can speed you up without slowdowns, and chop off unnecessary load ruthlessly.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Checking git commits based on repo content</title>
    <link href="https://bjaskulski.pl/writings/git-log-search-commits/" />
    <updated>2025-01-09T14:33:57Z</updated>
    <id>https://bjaskulski.pl/writings/git-log-search-commits/</id>
    <content type="html">&lt;p&gt;Interactive way to look for all git commits containing a string with further
examination.&lt;/p&gt;
&lt;pre class=&quot;language-sh&quot;&gt;&lt;code class=&quot;language-sh&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; log &lt;span class=&quot;token parameter variable&quot;&gt;--all&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-S&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;SubscriptionEnd&quot;&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;--oneline&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; fzf &lt;span class=&quot;token parameter variable&quot;&gt;--preview&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;git show {1} -- ./src&#39;&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;--bind&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;enter:execute(git show {1})&#39;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
</content>
  </entry>
  <entry>
    <title>Simple static page with github gist</title>
    <link href="https://bjaskulski.pl/writings/github-gist-static-page/" />
    <updated>2025-01-05T13:33:32Z</updated>
    <id>https://bjaskulski.pl/writings/github-gist-static-page/</id>
    <content type="html">&lt;p&gt;Gists allow for static html preview, which may be useful for POC or quick
prototyping. Just drop a HTML file inside (named index.html or whatever if you
have only one file).&lt;/p&gt;
&lt;p&gt;You can access such gist at &lt;code&gt;gitstpreview.github.io/?gist_id&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://gist.github.com/zlargon/9de497580ac33180e6128c187e2a93bc&quot;&gt;https://gist.github.com/zlargon/9de497580ac33180e6128c187e2a93bc&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&quot;https://bjaskulski.pl/tags/github/&quot;&gt;#github&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>WordPress REST API always jsonifies response</title>
    <link href="https://bjaskulski.pl/writings/wordpress-rest-api-json/" />
    <updated>2025-01-05T12:59:55Z</updated>
    <id>https://bjaskulski.pl/writings/wordpress-rest-api-json/</id>
    <content type="html">&lt;p&gt;Each time, you return something as &lt;code&gt;WP_REST_Response&lt;/code&gt;, content of this response
is passed through &lt;code&gt;json_encode&lt;/code&gt; function. This way it&#39;s impossible to serve any
other content, especially relying on raw string. Such value would be encoded
from &lt;code&gt;&amp;quot;string&amp;quot;&lt;/code&gt; to JSON form of &lt;code&gt;&amp;quot;&amp;quot;string&amp;quot;&amp;quot;&lt;/code&gt;. As long as we use objects and
arrays it&#39;s fine, but for scalar types (and content types other than JSON-based)
we cannot rely on WP REST API directly.&lt;/p&gt;
&lt;p&gt;To mitigate this, you can hook into &lt;code&gt;rest_pre_serve_request&lt;/code&gt; and handle REST
server response yourself.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://bjaskulski.pl/tags/wordpress/&quot;&gt;#wordpress&lt;/a&gt; &lt;a href=&quot;https://bjaskulski.pl/tags/php/&quot;&gt;#php&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Why may I suck at learning/working?</title>
    <link href="https://bjaskulski.pl/writings/overcoming-rabbit-holes/" />
    <updated>2025-01-05T12:59:55Z</updated>
    <id>https://bjaskulski.pl/writings/overcoming-rabbit-holes/</id>
    <content type="html">&lt;h2&gt;Pitfalls&lt;/h2&gt;
&lt;p&gt;I find myself often wandering into rabbit holes. E.g. spending 10h+ to
investigate the best way to organize links (bookmarks) and trying to write a
shell script for that.&lt;/p&gt;
&lt;p&gt;This time may be efficient, yet it&#39;s generally a waste because, besides brief
learning of bash scripting, I don&#39;t provide any value to myself.&lt;/p&gt;
&lt;p&gt;Any idea on overcoming &lt;strong&gt;rabbit holes&lt;/strong&gt;? At the moment, not really. Just stick
to the plan and maybe investigate whether your plan is worth pursuing in the
firsthand.&lt;/p&gt;
&lt;h2&gt;Links:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.coursera.org/learn/learning-how-to-learn&quot;&gt;https://www.coursera.org/learn/learning-how-to-learn&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;p&gt;Students often compare themselves to others who are farther along
in their coding journey or have more experience. This is a recipe
for depression and frustration.
Solution: Only compare yourself to your past self. Have your
abilities and knowledge improved from where you were last week,
last month, or last year? Be proud of the progress that you&#39;ve
made!&lt;/p&gt;
&lt;/blockquote&gt;
</content>
  </entry>
  <entry>
    <title>Removing commits from github</title>
    <link href="https://bjaskulski.pl/writings/github-removing-commits/" />
    <updated>2025-01-02T06:39:51Z</updated>
    <id>https://bjaskulski.pl/writings/github-removing-commits/</id>
    <content type="html">&lt;p&gt;In case of leaking secrets in github, the only viable way of removing commit
from web access is to nuke the repository.&lt;/p&gt;
&lt;p&gt;Removing commit with &lt;code&gt;git filter-repo&lt;/code&gt; is the first thing to do, but it only
removes it from plainly available history, still dangling and waiting to be
pruned by &lt;code&gt;git gc&lt;/code&gt;. And github is known to keep dangling commits for a long
time&lt;sup class=&quot;footnote-ref&quot;&gt;&lt;a href=&quot;https://bjaskulski.pl/writings/github-removing-commits/#fn1&quot; id=&quot;fnref1&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;. If you
don&#39;t have a time to contact github support, make repository private and/or
remove it completely (you can always recreate it later, but you will miss all
stargazers, etc.)&lt;/p&gt;
&lt;pre class=&quot;language-sh&quot;&gt;&lt;code class=&quot;language-sh&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; filter-repo &lt;span class=&quot;token parameter variable&quot;&gt;--path&lt;/span&gt; path/to/remove1 --invert-paths
&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; push &lt;span class=&quot;token parameter variable&quot;&gt;--force&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;--verbose&lt;/span&gt; --dry-run
&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; push &lt;span class=&quot;token parameter variable&quot;&gt;--force&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;https://bjaskulski.pl/tags/git/&quot;&gt;#git&lt;/a&gt;&lt;/p&gt;
&lt;hr class=&quot;footnotes-sep&quot;&gt;
&lt;section class=&quot;footnotes&quot;&gt;
&lt;ol class=&quot;footnotes-list&quot;&gt;
&lt;li id=&quot;fn1&quot; class=&quot;footnote-item&quot;&gt;&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/a/32840254&quot;&gt;https://stackoverflow.com/a/32840254&lt;/a&gt; &lt;a href=&quot;https://bjaskulski.pl/writings/github-removing-commits/#fnref1&quot; class=&quot;footnote-backref&quot;&gt;↩︎&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/section&gt;
</content>
  </entry>
  <entry>
    <title>WordPress i Cloudflare</title>
    <link href="https://bjaskulski.pl/writings/wordpress-cloudflare/" />
    <updated>2024-12-31T15:01:32Z</updated>
    <id>https://bjaskulski.pl/writings/wordpress-cloudflare/</id>
    <content type="html">&lt;p&gt;Ustawienie DNS potrafi namieszać z redirect loop w WordPressie.&lt;/p&gt;
&lt;p&gt;Szybkie rozwiązanie to&lt;/p&gt;
&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token function&quot;&gt;define&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;FORCE_SSL_ADMIN&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token constant boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Można też skorzystać z
wtyczki&lt;sup class=&quot;footnote-ref&quot;&gt;&lt;a href=&quot;https://bjaskulski.pl/writings/wordpress-cloudflare/#fn1&quot; id=&quot;fnref1&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://bjaskulski.pl/tags/wordpress/&quot;&gt;#wordpress&lt;/a&gt;&lt;/p&gt;
&lt;hr class=&quot;footnotes-sep&quot;&gt;
&lt;section class=&quot;footnotes&quot;&gt;
&lt;ol class=&quot;footnotes-list&quot;&gt;
&lt;li id=&quot;fn1&quot; class=&quot;footnote-item&quot;&gt;&lt;p&gt;&lt;a href=&quot;https://community.cloudflare.com/t/endless-redirect-with-wordpress/3914&quot;&gt;https://community.cloudflare.com/t/endless-redirect-with-wordpress/3914&lt;/a&gt; &lt;a href=&quot;https://bjaskulski.pl/writings/wordpress-cloudflare/#fnref1&quot; class=&quot;footnote-backref&quot;&gt;↩︎&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/section&gt;
</content>
  </entry>
  <entry>
    <title>removing lines with sed</title>
    <link href="https://bjaskulski.pl/writings/sed-remove-lines/" />
    <updated>2024-12-31T15:01:32Z</updated>
    <id>https://bjaskulski.pl/writings/sed-remove-lines/</id>
    <content type="html">&lt;pre class=&quot;language-sh&quot;&gt;&lt;code class=&quot;language-sh&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-i&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;&amp;lt;line_no&gt;d&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;file&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;1d&#39;&lt;/span&gt; dump.sql &lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt; no_head.sql&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;https://bjaskulski.pl/tags/linux/&quot;&gt;#linux&lt;/a&gt; &lt;a href=&quot;https://bjaskulski.pl/tags/sed/&quot;&gt;#sed&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Collation and accents in database</title>
    <link href="https://bjaskulski.pl/writings/mysql-collation-accents/" />
    <updated>2024-12-31T15:01:32Z</updated>
    <id>https://bjaskulski.pl/writings/mysql-collation-accents/</id>
    <content type="html">&lt;p&gt;It is generally recommended to use &lt;code&gt;utf8mb4_general_ci&lt;/code&gt; collation for columns,
but sometimes it may be misleading, especially in conjunction with &lt;code&gt;UNIQUE&lt;/code&gt;
constraint on &lt;code&gt;VARCHAR&lt;/code&gt; field.&lt;/p&gt;
&lt;p&gt;Some accents are cut off from general_ci, when comparing phrases and it may lead
to constraint violation even though visually strings seems different. One
example, I&#39;ve stumbled upon is Hungarian: &lt;em&gt;Kömlő&lt;/em&gt; and &lt;em&gt;Komló&lt;/em&gt;. Take under
consideration, that there are different languages, besides Hungarian in the
database, so using specialized collation is not the case.&lt;/p&gt;
&lt;p&gt;In such situation it&#39;s best to change column&#39;s collation to &lt;code&gt;utf8mb4_bin&lt;/code&gt;, which
compares characters by it&#39;s binary representation, but is unusable for any
additional features provided by collation, like correct sort order (accents come
last with &lt;code&gt;_bin&lt;/code&gt;). Furthermore:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;utf8_bin says to just compare the bytes. CHAR/TEXT utf8 with utf8_bin
validates (on INSERT) that the bytes comprise valid utf8 bytes, but does not
do
anything useful for comparisions other than exact (no case folding, etc)
equality. BINARY/BLOB should be usually be used instead CHAR+utf8; this stores
the bytes without any
checking.&lt;sup class=&quot;footnote-ref&quot;&gt;&lt;a href=&quot;https://bjaskulski.pl/writings/mysql-collation-accents/#fn1&quot; id=&quot;fnref1&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;a href=&quot;https://bjaskulski.pl/tags/db/&quot;&gt;#db&lt;/a&gt;&lt;/p&gt;
&lt;hr class=&quot;footnotes-sep&quot;&gt;
&lt;section class=&quot;footnotes&quot;&gt;
&lt;ol class=&quot;footnotes-list&quot;&gt;
&lt;li id=&quot;fn1&quot; class=&quot;footnote-item&quot;&gt;&lt;p&gt;&lt;a href=&quot;https://mysql.rjweb.org/doc.php/charcoll&quot;&gt;https://mysql.rjweb.org/doc.php/charcoll&lt;/a&gt; &lt;a href=&quot;https://bjaskulski.pl/writings/mysql-collation-accents/#fnref1&quot; class=&quot;footnote-backref&quot;&gt;↩︎&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/section&gt;
</content>
  </entry>
  <entry>
    <title>Adding existing user to a group</title>
    <link href="https://bjaskulski.pl/writings/linux-add-user-to-group/" />
    <updated>2024-12-31T15:01:32Z</updated>
    <id>https://bjaskulski.pl/writings/linux-add-user-to-group/</id>
    <content type="html">&lt;pre class=&quot;language-sh&quot;&gt;&lt;code class=&quot;language-sh&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;usermod&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-a&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-G&lt;/span&gt; groupname username&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;https://bjaskulski.pl/tags/linux/&quot;&gt;#linux&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Get all links from website</title>
    <link href="https://bjaskulski.pl/writings/js-get-all-links/" />
    <updated>2024-12-31T15:01:32Z</updated>
    <id>https://bjaskulski.pl/writings/js-get-all-links/</id>
    <content type="html">&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;...&lt;/span&gt;document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;links&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;el&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; el&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;href&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;includes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;https&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;el&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; el&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;href&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Later I can &amp;quot;Copy Object&amp;quot;, and e.g. download the files, with&lt;/p&gt;
&lt;pre class=&quot;language-sh&quot;&gt;&lt;code class=&quot;language-sh&quot;&gt;xclip &lt;span class=&quot;token parameter variable&quot;&gt;-sel&lt;/span&gt; cli &lt;span class=&quot;token parameter variable&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; jq &lt;span class=&quot;token string&quot;&gt;&#39;.[]&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;xargs&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-n1&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-P4&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;curl&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-O&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;https://bjaskulski.pl/tags/js/&quot;&gt;#js&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>gzip tl;dr</title>
    <link href="https://bjaskulski.pl/writings/gzip-tldr/" />
    <updated>2024-12-31T15:01:32Z</updated>
    <id>https://bjaskulski.pl/writings/gzip-tldr/</id>
    <content type="html">&lt;p&gt;This will remove file after compression:&lt;/p&gt;
&lt;pre class=&quot;language-sh&quot;&gt;&lt;code class=&quot;language-sh&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# Remove file after compression&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;gzip&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;file&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;# Keep file&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;gzip&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-k&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;file&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;# Decompress file, remove archive, store on fs&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;gzip&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;file&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;# Decompress file, write to stdout&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;gzip&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-dc&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;file&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;https://bjaskulski.pl/tags/linux/&quot;&gt;#linux&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>AI search</title>
    <link href="https://bjaskulski.pl/writings/ai-search-engines/" />
    <updated>2024-12-31T15:01:32Z</updated>
    <id>https://bjaskulski.pl/writings/ai-search-engines/</id>
    <content type="html">&lt;p&gt;There currently two interesting tools, when it comes to AI search engine: Phind
and Perplexity.&lt;/p&gt;
&lt;p&gt;The first one is positioned as coder&#39;s tool, and the functionality to chat with
search is great for debugging and followup questions. Unfortunately, regular
search with followup question doesn&#39;t keep a reference in memory. Additionally,
they recently became aggressive about advertising pro features (yup, still using
free version). I haven&#39;t been using it yet, but you can also add a part of
&amp;quot;system-like&amp;quot; prompt, to force model to particular tone or so.&lt;/p&gt;
&lt;p&gt;On the other hand, Perplexity is recommended by more users. At first I was
thinking of using it only for regular search, not code related, but possibly
their model surpasses Phind (although it messes with code formatting).
Perplexity has similar customization availability as Phind, for providing
user-defined rules, but there&#39;s additional feature, I&#39;ve just found out:
collections. Besides simple organization of your search, you can also add custom
prompt, which will apply to all threads started in a specific collection.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://bjaskulski.pl/tags/ai/&quot;&gt;#ai&lt;/a&gt; &lt;a href=&quot;https://bjaskulski.pl/tags/search/&quot;&gt;#search&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>WordPress repository runs basic PHP check upon plugin deploy, and it can be mischievous</title>
    <link href="https://bjaskulski.pl/writings/wordpress-org-deploy-php-check/" />
    <updated>2024-12-31T13:53:02Z</updated>
    <id>https://bjaskulski.pl/writings/wordpress-org-deploy-php-check/</id>
    <content type="html">&lt;p&gt;sometimes... Look at this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;***********************************
PHP error in: flexible-subscriptions/tags/1.0.0/vendor_prefixed/symfony/polyfill-php80/Resources/stubs/Attribute.php:
Parse error: syntax error, unexpected fully qualified name &amp;quot;&#92;class_alias&amp;quot; in Standard input code on line 40
Errors parsing Standard input code
***********************************
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Regular scoped code... I don&#39;t know which version of PHP can actually report
such parse error, although I&#39;ve been testing it with 8.0-8.3, 7.0, 7.1, and 5.6.&lt;/p&gt;
&lt;p&gt;General recommendation – never scope polyfill code, as it makes no sense.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Differences between GPT-3.5-turbo and GPT-4</title>
    <link href="https://bjaskulski.pl/writings/gpt-35-vs-gpt-4/" />
    <updated>2024-04-05T09:03:14Z</updated>
    <id>https://bjaskulski.pl/writings/gpt-35-vs-gpt-4/</id>
    <content type="html">&lt;p&gt;As GPT-3.5-turbo is worse at following instructions, the most important stuff
should be repeated in user prompt or at the end of system prompt. Any rules
included at the very beginning of a prompt are likely to be forgotten, if are
overloaded with additional context or instructions. This may be helpful when
creating prompts which runs for both models, but only one of them has to take a
specific action.&lt;/p&gt;
&lt;p&gt;On the other hand, GPT-3.5-turbo is more likely to make mistakes in negation
instructions, like &amp;quot;do not output anything except JSON&amp;quot;. Using &lt;em&gt;positive&lt;/em&gt;
messages are to be likely more successful: &amp;quot;Respond only with JSON object, avoid
any additional comments or wrappers like code fences&amp;quot;&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Executing commands within `less`</title>
    <link href="https://bjaskulski.pl/writings/less-shell-commands/" />
    <updated>2023-05-17T06:06:34Z</updated>
    <id>https://bjaskulski.pl/writings/less-shell-commands/</id>
    <content type="html">&lt;p&gt;It was known to me, that &lt;code&gt;vim&lt;/code&gt; can benefit from &lt;em&gt;filters&lt;/em&gt;, but I&#39;ve actually
read some commands description in &lt;code&gt;less&lt;/code&gt; and it brings multiple powerful
features, like executing shell commands, etc.&lt;/p&gt;
&lt;p&gt;Think of looking though &lt;code&gt;git blame&lt;/code&gt; and executing &lt;code&gt;git show&lt;/code&gt; with desired SHA. I
cannot believe, I always exit &lt;code&gt;less&lt;/code&gt; before, to span a new command, and repeat.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Ordinal numbers in PHP</title>
    <link href="https://bjaskulski.pl/writings/php-ordinal-numbers/" />
    <updated>2023-04-13T08:46:24Z</updated>
    <id>https://bjaskulski.pl/writings/php-ordinal-numbers/</id>
    <content type="html">&lt;p&gt;It&#39;s worth knowing that PHP&#39;s built-in &lt;code&gt;NumberFormatter&lt;/code&gt; can format numbers in
their ordinal form, i.e. 1st, 2nd, etc.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.php.net/manual/en/class.numberformatter.php#numberformatter.constants.ordinal&quot;&gt;https://www.php.net/manual/en/class.numberformatter.php#numberformatter.constants.ordinal&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>Adding collaborative comments to code</title>
    <link href="https://bjaskulski.pl/writings/code-collaboration-comments/" />
    <updated>2023-04-13T08:40:27Z</updated>
    <id>https://bjaskulski.pl/writings/code-collaboration-comments/</id>
    <content type="html">&lt;p&gt;I miss document editor experience, when collaborating on new git repository,
specifically adding comments to particular pieces of code. In GitHub or GitLab
it is only possible to create a new issue, referring to line or attaching a
piece of code, but for large amount of comments issues doesn&#39;t seem to be the
best method.&lt;/p&gt;
&lt;p&gt;For the time being what seems to be the best option is to create a new, empty
branch and requesting a merge into it. With such solution you create a diff
against void, and you are able to rather easily add multiple notes, when working
from scratch on some software.&lt;/p&gt;
&lt;p&gt;To create an emtpy branch:&lt;/p&gt;
&lt;pre class=&quot;language-shell&quot;&gt;&lt;code class=&quot;language-shell&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; switch &lt;span class=&quot;token parameter variable&quot;&gt;--orphan&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;new branch&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; commit --allow-empty&lt;/code&gt;&lt;/pre&gt;
</content>
  </entry>
  <entry>
    <title>Em dash in vim</title>
    <link href="https://bjaskulski.pl/writings/vim-em-dash/" />
    <updated>2023-04-02T07:00:50Z</updated>
    <id>https://bjaskulski.pl/writings/vim-em-dash/</id>
    <content type="html">&lt;p&gt;I&#39;m always frustrated about writing &lt;code&gt;--&lt;/code&gt;, instead of &lt;code&gt;–&lt;/code&gt; for en dash in vim, but
using digraphs can be bizarre. Why haven&#39;t I thought earlier about making it a
keybind, just as in most today&#39;s editors (LibreOffice, MS Office, etc)?&lt;/p&gt;
&lt;pre class=&quot;language-vim&quot;&gt;&lt;code class=&quot;language-vim&quot;&gt;inoremap &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;buffer&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;space&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt; –&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;space&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://vi.stackexchange.com/questions/2199/what-is-the-easiest-way-to-insert-en-dash-in-vim&quot;&gt;https://vi.stackexchange.com/questions/2199/what-is-the-easiest-way-to-insert-en-dash-in-vim&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>`$wpdb-&gt;prepare` gotcha with placeholders</title>
    <link href="https://bjaskulski.pl/writings/wpdb-prepare-placeholders/" />
    <updated>2023-03-23T05:07:40Z</updated>
    <id>https://bjaskulski.pl/writings/wpdb-prepare-placeholders/</id>
    <content type="html">&lt;p&gt;&lt;code&gt;$wpdb-&amp;gt;prepare&lt;/code&gt; is a function which works similarly to &lt;code&gt;sprintf&lt;/code&gt;, but is
targeted for sanitizing database query. I&#39;m putting aside the superiority of
using prepared statements.&lt;/p&gt;
&lt;p&gt;Most commonly used placeholder is &lt;code&gt;%s&lt;/code&gt; to insert a string value, but it may get
more complicated when you try to prepare values inside &lt;code&gt;WHERE IN&lt;/code&gt; statement
beforehand and later dump them as one value. Whether it&#39;s correct may be another
topic, but similar code will fail due to &lt;code&gt;%s&lt;/code&gt; always being wrapped in quotes.&lt;/p&gt;
&lt;pre class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$wpdb&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$wpdb&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;prepare&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;SELECT * FROM wp_posts WHERE ID IN (%s)&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;implode&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string single-quoted-string&quot;&gt;&#39;, &#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Result is &lt;code&gt;SELECT * FROM wp_posts WHERE ID IN (&#39;1, 2, 3&#39;)&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;You can workaround this behavior using positional placeholders, but then you
need to remember about wrapping with quote yourserf it may be needed.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Max index length in older MySQL</title>
    <link href="https://bjaskulski.pl/writings/mysql-index-limits/" />
    <updated>2023-03-22T19:18:22Z</updated>
    <id>https://bjaskulski.pl/writings/mysql-index-limits/</id>
    <content type="html">&lt;p&gt;A reminder: max index length in MySQL was 767 bytes. I learned that the hard
way, as unique constraint on BIGINT and VARCHAR (255) resulted in exhaustion of
this space. In general, anything with VARCHAR, when supporting UTF-8 is
considered will probably be too big to put a valid index on it because max size
of such column would take up to 1020 bytes (255 * 4).&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Loading vim quickfix list from grep</title>
    <link href="https://bjaskulski.pl/writings/vim-quickfix-from-grep/" />
    <updated>2023-02-17T10:11:03Z</updated>
    <id>https://bjaskulski.pl/writings/vim-quickfix-from-grep/</id>
    <content type="html">&lt;p&gt;One of things, I always forget about, but seems cool.&lt;/p&gt;
&lt;pre class=&quot;language-sh&quot;&gt;&lt;code class=&quot;language-sh&quot;&gt;&lt;span class=&quot;token function&quot;&gt;vim&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-q&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-RHn&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;query&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
</content>
  </entry>
  <entry>
    <title>Malware detection in Automattic</title>
    <link href="https://bjaskulski.pl/writings/automattic-malware-detection/" />
    <updated>2023-02-08T12:59:04Z</updated>
    <id>https://bjaskulski.pl/writings/automattic-malware-detection/</id>
    <content type="html">&lt;p&gt;Each plugin submitted to &lt;a href=&quot;http://woocommerce.com&quot;&gt;woocommerce.com&lt;/a&gt; store has to pass their malware
detection which is just &lt;code&gt;php-malware-finder&lt;/code&gt; with some custom YARA rules.&lt;/p&gt;
&lt;p&gt;You can easily check your plugin violations with following command:&lt;/p&gt;
&lt;pre class=&quot;language-sh&quot;&gt;&lt;code class=&quot;language-sh&quot;&gt;&lt;span class=&quot;token function&quot;&gt;docker&lt;/span&gt; run &lt;span class=&quot;token parameter variable&quot;&gt;--rm&lt;/span&gt; &lt;span class=&quot;token variable&quot;&gt;&lt;span class=&quot;token variable&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;pwd&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;)&lt;/span&gt;&lt;/span&gt;:/data ghcr.io/jvoisin/php-malware-finder&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Custom rules from Automattic can be found in their GitHub
repository&lt;sup class=&quot;footnote-ref&quot;&gt;&lt;a href=&quot;https://bjaskulski.pl/writings/automattic-malware-detection/#fn1&quot; id=&quot;fnref1&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
&lt;hr class=&quot;footnotes-sep&quot;&gt;
&lt;section class=&quot;footnotes&quot;&gt;
&lt;ol class=&quot;footnotes-list&quot;&gt;
&lt;li id=&quot;fn1&quot; class=&quot;footnote-item&quot;&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/Automattic/php-malware-finder&quot;&gt;https://github.com/Automattic/php-malware-finder&lt;/a&gt; &lt;a href=&quot;https://bjaskulski.pl/writings/automattic-malware-detection/#fnref1&quot; class=&quot;footnote-backref&quot;&gt;↩︎&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/section&gt;
</content>
  </entry>
  <entry>
    <title>The WordPress way of resolving update packages</title>
    <link href="https://bjaskulski.pl/writings/wordpress-update-packages/" />
    <updated>2023-02-01T06:39:32Z</updated>
    <id>https://bjaskulski.pl/writings/wordpress-update-packages/</id>
    <content type="html">&lt;p&gt;Plugin updates in WordPress can behave in rather indeterministic way, dependent
on the way, plugin is archived and the source it comes from.&lt;/p&gt;
&lt;p&gt;To begin with distribution package, as plugin author you have two possibilities
to pack your plugin:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Inside single parent directory, which then becomes target name for plugin&lt;/li&gt;
&lt;li&gt;Use &lt;em&gt;flat&lt;/em&gt; directories architecture, i.e. after unpacking, your files lie in
top-level directory&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I used to thought that name of your zip package matters (e.g. &lt;code&gt;my-plugin.zip&lt;/code&gt;),
but in the first case cases it&#39;s not the truth.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ unzip -l my-plugin.zip
Archive: /home/user/my-plugin.zip
awesome-plugin/awesome-plugin.php
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In such case, WordPress will infer top-level folder name (&lt;code&gt;awesome-plugin&lt;/code&gt;),
making it my plugin slug, thus target update folder. Simple as that.&lt;/p&gt;
&lt;p&gt;And in most cases it&#39;s preferable method of packing a plugin, as &lt;strong&gt;the only
reliable and predictable&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Although, second method (flat-package) &lt;em&gt;may&lt;/em&gt; lead to manipulation of plugin slug
and deactivation. It only may because it depends on update method and differs
between direct plugin upload and fetching remote package.&lt;/p&gt;
&lt;p&gt;Following case will influence our plugin slug by zip package name -- slug
becomes &lt;code&gt;my-plugin&lt;/code&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ unzip -l my-plugin.zip
Archive: /home/user/my-plugin.zip
awesome-plugin.php
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Yet, this is only true while you upload your plugin directly to WordPress, e.g.
through admin panel (or any package which is local to server).&lt;/p&gt;
&lt;p&gt;When we deal with remote fetch of plugin package (and we deal with that 90% of
time), package is saved on our server as temporary file, which later has great
implications, as our zip is stored with 6 random chars suffix. You can imagine
by this far, what will happen when we try to unzip such file.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ unzip -l my-plugin-yUi4dk.zip
Archive: /home/user/my-plugin-yUi4dk.zip
awesome-plugin.php
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Once again, WordPress grabs our destination plugin&#39;s slug from zip file name,
and our slug becomes &lt;code&gt;my-plugin-yUi4dk&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Additionally, during the upgrade there&#39;s a cleanup process which deletes old
plugin. The flow goes like:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Click update plugin button.&lt;/li&gt;
&lt;li&gt;New plugin release is downloaded and extracted as &lt;code&gt;my-plugin-yUi4dk&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Previous plugin release is discarded.&lt;/li&gt;
&lt;li&gt;WordPress cannot execute non-existing &lt;code&gt;my-plugin/awesome-plugin.php&lt;/code&gt;, thus
deactivates plugin.&lt;/li&gt;
&lt;li&gt;Updated &lt;code&gt;my-plugin-yUi4dk/awesome-plugin.php&lt;/code&gt; doesn&#39;t fit it&#39;s predecessor
name, so it&#39;s considered separate plugin, but it&#39;s never been requested to
activate it.&lt;/li&gt;
&lt;li&gt;You end up with inactive plugin after update.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;There&#39;s more to that when you consider private, paid plugins which authenticates
through some API key, usually bond with plugin slug (as you should safely
expect, this value will never be changed). When client tries to reactivate
plugin, the API key is gone because what client activated is not our original
plugin anymore.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Avoid saving not-string data to WordPress database</title>
    <link href="https://bjaskulski.pl/writings/wordpress-db-types/" />
    <updated>2023-01-18T19:18:43Z</updated>
    <id>https://bjaskulski.pl/writings/wordpress-db-types/</id>
    <content type="html">&lt;p&gt;Saving data to options (&lt;code&gt;update_option&lt;/code&gt;) or post meta (&lt;code&gt;update_post_meta&lt;/code&gt;) may
be unpredictable at first when using &lt;code&gt;booleans&lt;/code&gt; or &lt;code&gt;integers&lt;/code&gt;, especially when
you rely on data type.&lt;/p&gt;
&lt;p&gt;WordPress supposedly serializes data before saving to database but that&#39;s not
the case for scalar types, which are just casted to string.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Serialized &lt;code&gt;false&lt;/code&gt; produces &lt;code&gt;b:0&lt;/code&gt;, but casted to string is &lt;code&gt;&#39;&#39;&lt;/code&gt; (empty string)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Getting such data from a database with standard functions (&lt;code&gt;get_option&lt;/code&gt;,
&lt;code&gt;get_post_meta&lt;/code&gt;) returns any value as &lt;code&gt;string&lt;/code&gt;. Don&#39;t you even think about
strict type comparison!&lt;/p&gt;
&lt;p&gt;When you try to save bunch of connected data values (e.g. plugin global
settings) it may be the best to group those elements and save it as one option
after &lt;code&gt;json_encode&lt;/code&gt;.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Vim quickfix list on current word</title>
    <link href="https://bjaskulski.pl/writings/vim-quickfix-cword/" />
    <updated>2023-01-18T19:10:16Z</updated>
    <id>https://bjaskulski.pl/writings/vim-quickfix-cword/</id>
    <content type="html">&lt;p&gt;&lt;code&gt;:vim &amp;lt;cword&amp;gt; **/*.php&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;cword&amp;gt;&lt;/code&gt; works just as intended!&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Remove interval within called callback</title>
    <link href="https://bjaskulski.pl/writings/js-remove-interval-in-callback/" />
    <updated>2023-01-18T19:08:47Z</updated>
    <id>https://bjaskulski.pl/writings/js-remove-interval-in-callback/</id>
    <content type="html">&lt;p&gt;Due to JavaScript&#39;s way of passing variables to closures you are able to remove
interval or timeout created with native function within it&#39;s callback.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; i &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;setInterval&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;clearInterval&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;i&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token number&quot;&gt;1000&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;https://bjaskulski.pl/tags/js/&quot;&gt;#js&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>JSON in SQL (mysql)</title>
    <link href="https://bjaskulski.pl/writings/mysql-json-type/" />
    <updated>2023-01-18T19:01:58Z</updated>
    <id>https://bjaskulski.pl/writings/mysql-json-type/</id>
    <content type="html">&lt;p&gt;Since &lt;code&gt;mysql&lt;/code&gt; 5.7 (it&#39;s important, I mostly use 5.6, eh... WordPress) tables can
have &lt;code&gt;JSON&lt;/code&gt; data type. It&#39;s convenient instead of serializing data to string.
Also comes with a bunch of functions (didn&#39;t care about performance yet),
capable of querying JSON data inside column.&lt;/p&gt;
&lt;h1&gt;ID | json_column&lt;/h1&gt;
&lt;p&gt;1 | {query: &amp;quot;my query&amp;quot;} 2 | {query: &amp;quot;not query&amp;quot;}&lt;/p&gt;
&lt;pre class=&quot;language-sql&quot;&gt;&lt;code class=&quot;language-sql&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt; JSON_EXTRACT&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;json_column&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &quot;$&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;query&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;my query&#39;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
</content>
  </entry>
  <entry>
    <title>Run SQL query in one line CLI command</title>
    <link href="https://bjaskulski.pl/writings/mysql-cli-one-liner/" />
    <updated>2023-01-18T18:44:01Z</updated>
    <id>https://bjaskulski.pl/writings/mysql-cli-one-liner/</id>
    <content type="html">&lt;pre class=&quot;language-sh&quot;&gt;&lt;code class=&quot;language-sh&quot;&gt;mysql &lt;span class=&quot;token parameter variable&quot;&gt;-uuser&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-ppass&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;SELECT 1;&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;-e&lt;/code&gt; runs query provided as argument.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Create new user in Unix</title>
    <link href="https://bjaskulski.pl/writings/unix-create-user/" />
    <updated>2023-01-18T18:36:02Z</updated>
    <id>https://bjaskulski.pl/writings/unix-create-user/</id>
    <content type="html">&lt;pre class=&quot;language-sh&quot;&gt;&lt;code class=&quot;language-sh&quot;&gt;&lt;span class=&quot;token function&quot;&gt;useradd&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;username&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;-m&lt;/code&gt; option creates home folder for new user.&lt;/p&gt;
&lt;p&gt;Afterwards it&#39;s needed to set up password&lt;/p&gt;
&lt;pre class=&quot;language-sh&quot;&gt;&lt;code class=&quot;language-sh&quot;&gt;&lt;span class=&quot;token function&quot;&gt;passwd&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;username&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
</content>
  </entry>
  <entry>
    <title>Why or why not to write a blog</title>
    <link href="https://bjaskulski.pl/writings/why-or-why-not-to-write-blog/" />
    <updated>2021-03-19T22:00:19Z</updated>
    <id>https://bjaskulski.pl/writings/why-or-why-not-to-write-blog/</id>
    <content type="html">&lt;p&gt;Thought about starting a blog keeps me itching and bugging for some time, but I always procrastinated execution. I&#39;ve been finding many reasons to do so, yet now I want to surpass them.&lt;/p&gt;
&lt;h2&gt;10 reasons why not to start a blog...&lt;/h2&gt;
&lt;p&gt;It&#39;s in fashion to create appealing posts which put something into the quantified matter. That&#39;s just easier for us, humans to perceive something in a limited scope, I think.
Then, play a game and list some reasons against writing a personal blog.&lt;/p&gt;
&lt;h3&gt;You certainly don&#39;t have a time&lt;/h3&gt;
&lt;p&gt;Who does actually, when we all are running for betterness (at work, in life). There&#39;s just not much time to sit down and write some thoughts. Oh, maybe there would be a minute or two to write a tutorial, but definitely not something demanding deeper thinking.&lt;/p&gt;
&lt;h3&gt;You aren&#39;t good enough&lt;/h3&gt;
&lt;p&gt;There are many blogs around, yours wouldn&#39;t make a difference, so why bother? Especially when you don&#39;t have the skills to write about technical stuff or something that could bring peoples&#39; attention. Leave it to experts.&lt;/p&gt;
&lt;h3&gt;You can&#39;t plan ahead&lt;/h3&gt;
&lt;p&gt;Seriously, even that post came straight from the head, without an outline or at least the slightest intention about a conveyed message, just free-fall. I guess it is obvious when looking at those short sentences.&lt;/p&gt;
&lt;h3&gt;You don&#39;t speak your voice&lt;/h3&gt;
&lt;p&gt;Everything you know is just someone&#39;s knowledge which you &#39;borrowed&#39;, and any idea you came up with is just another instance on the same matter, without freshness.&lt;/p&gt;
&lt;h2&gt;Cut the bullshit&lt;/h2&gt;
&lt;p&gt;Those few points (not 10 apparently) may seem harsh, but imposter syndrome, the flood of alike blogs, and many various reasons can keep you (it keeps me) from writing and producing your content. Well, I guess I can&#39;t focus on my gains, though I can list those too.
Some of the great reasons for starting a blog would be:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;improving language skills (I&#39;m not native in English)&lt;/li&gt;
&lt;li&gt;improving programming skills (after all, that&#39;s why I&#39;m here)&lt;/li&gt;
&lt;li&gt;contribute to the community (who knows, maybe I will come up with some useful tutorial or thought about programming)&lt;/li&gt;
&lt;li&gt;have something to show in front of a potential employer&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Fall for it&lt;/h3&gt;
&lt;p&gt;I think there&#39;s one message to myself (but not only myself): to fall freely into writing, especially when I feel, that&#39;s something not for me. It&#39;s great in many ways beyond short post can cover and one day it may become something meaningful, at least to myself.&lt;/p&gt;
&lt;p&gt;And stop comparing yourself to ones, who are now on top, it took them many years to get there and they definitely earned it. If you follow, you would too.&lt;/p&gt;
&lt;p&gt;&lt;small&gt;Right now idea about writing a blog itches me even more with a variety of post ideas. We&#39;ll see if I follow them.&lt;/small&gt;&lt;/p&gt;
</content>
  </entry>
</feed>