<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

 <title>Łukasz Wieczorek's blog</title>
 <link href="http://wieczorek1990.github.io/atom.xml" rel="self"/>
 <link href="http://wieczorek1990.github.io/"/>
 <updated>2026-04-17T08:54:42+00:00</updated>
 <id>http://wieczorek1990.github.io</id>
 <author>
   <name></name>
   <email></email>
 </author>

 
 <entry>
   <title>VIM</title>
   <link href="http://wieczorek1990.github.io/2026/04/17/vim.html"/>
   <updated>2026-04-17T00:00:00+00:00</updated>
   <id>http://wieczorek1990.github.io/2026/04/17/vim</id>
   <content type="html">&lt;p&gt;VIM is my favourite terminal editor.
I am writing this post for me to easier to switch to
&lt;a href=&quot;https://helix-editor.com&quot;&gt;Helix&lt;/a&gt;
which I will follow up with another post.&lt;/p&gt;

&lt;p&gt;Before opening:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;which -a vim
brew install vim
vim --version
vim Notes.md
vimtutor
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;To exit:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;:q
:q!
:x
:wq
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;To navigate:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;h j k l # train this with muscles
^ # home
$ # end
gg # document beginning
shift + G # document end
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In visual mode:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;i # insert
a # append
shift + i # append to the beginning of line
shift + a # append to the end of line
dd # delete line
dw # delete word
y # yank
p # paste
u # undo
ctrl + r # redo
shift + v # visual line
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In insert mode:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;esc # escape to visual mode
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>Say no!</title>
   <link href="http://wieczorek1990.github.io/2024/12/10/say-no.html"/>
   <updated>2024-12-10T00:00:00+00:00</updated>
   <id>http://wieczorek1990.github.io/2024/12/10/say-no</id>
   <content type="html">&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;say-no&lt;/code&gt; is &lt;a href=&quot;http://say-no.soiree.tech/&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I built a simple HTML, CSS, JavaScript website around the idea of saying no to things that destroy us.&lt;/p&gt;

&lt;p&gt;You can check the source code &lt;a href=&quot;https://github.com/wieczorek1990/say-no&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>brew</title>
   <link href="http://wieczorek1990.github.io/2024/11/18/brew.html"/>
   <updated>2024-11-18T00:00:00+00:00</updated>
   <id>http://wieczorek1990.github.io/2024/11/18/brew</id>
   <content type="html">&lt;p&gt;I use MacOS since 2017 and I like to sometimes grab something from the
Linux ecosystem. And there is &lt;a href=&quot;https://brew.sh&quot;&gt;brew&lt;/a&gt;.
The most basic commands for it are doctor, info, install, uninstall, and upgrade.&lt;/p&gt;

&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;brew doctor
brew info &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;package_name&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;
brew &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;package_name&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;
brew uninstall &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;package_name&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;
brew upgrade
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>Recommendations</title>
   <link href="http://wieczorek1990.github.io/2024/11/04/recommendations.html"/>
   <updated>2024-11-04T00:00:00+00:00</updated>
   <id>http://wieczorek1990.github.io/2024/11/04/recommendations</id>
   <content type="html">&lt;p&gt;Hello there!&lt;/p&gt;

&lt;p&gt;I was revieving some old projects and you could get some knowledge
about what I found on the Internet by visiting 
&lt;a href=&quot;https://wieczorek1990.github.io/recommendations/&quot;&gt;recommendations&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Somehow I had a missing image in the repository.&lt;/p&gt;

&lt;p&gt;You can find the repository &lt;a href=&quot;https://github.com/wieczorek1990/recommendations&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Sobituaries</title>
   <link href="http://wieczorek1990.github.io/2022/02/01/sobituaries.html"/>
   <updated>2022-02-01T00:00:00+00:00</updated>
   <id>http://wieczorek1990.github.io/2022/02/01/sobituaries</id>
   <content type="html">&lt;p&gt;Hi again!&lt;/p&gt;

&lt;p&gt;In the recent month I worked part time on a project of mine called internally sobituaries.&lt;/p&gt;

&lt;p&gt;The site is totally in Polish and the purpose of it is to share obituary notices.&lt;/p&gt;

&lt;p&gt;The notices cost 5.00 PLN and are paid with Stripe.&lt;/p&gt;

&lt;p&gt;The technologies used are mostly Python, Django, DRF, Javascript, jQuery.&lt;/p&gt;

&lt;p&gt;EDIT:&lt;/p&gt;

&lt;p&gt;The project is now archived.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>I'm very tired but I live</title>
   <link href="http://wieczorek1990.github.io/2019/11/30/oy.html"/>
   <updated>2019-11-30T00:00:00+00:00</updated>
   <id>http://wieczorek1990.github.io/2019/11/30/oy</id>
   <content type="html">&lt;p&gt;Oy!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Where's the Linux kernel start?</title>
   <link href="http://wieczorek1990.github.io/2019/08/05/start-kernel.html"/>
   <updated>2019-08-05T00:00:00+00:00</updated>
   <id>http://wieczorek1990.github.io/2019/08/05/start-kernel</id>
   <content type="html">&lt;p&gt;The Linux kernel start is currently
&lt;a href=&quot;https://github.com/torvalds/linux/blob/master/init/main.c#L575&quot;&gt;here&lt;/a&gt;
in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;start_kernel&lt;/code&gt; function.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>LDAP nomenclature</title>
   <link href="http://wieczorek1990.github.io/2019/06/25/ldap.html"/>
   <updated>2019-06-25T00:00:00+00:00</updated>
   <id>http://wieczorek1990.github.io/2019/06/25/ldap</id>
   <content type="html">&lt;p&gt;Recently I had to setup a local LDAP server.&lt;/p&gt;

&lt;p&gt;It took me some time to figure out the naming used in LDAP world.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;CN = Common Name&lt;/li&gt;
  &lt;li&gt;OU = Organizational Unit&lt;/li&gt;
  &lt;li&gt;DC = Domain Component&lt;/li&gt;
  &lt;li&gt;DN = Distinguished Name&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>Keybaze mase</title>
   <link href="http://wieczorek1990.github.io/2017/05/11/keybase-maze.html"/>
   <updated>2017-05-11T00:00:00+00:00</updated>
   <id>http://wieczorek1990.github.io/2017/05/11/keybase-maze</id>
   <content type="html">&lt;p&gt;&lt;a href=&quot;https://keybase.io/docs/command_line&quot;&gt;READ ME&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Random findings</title>
   <link href="http://wieczorek1990.github.io/2017/05/04/random-findings.html"/>
   <updated>2017-05-04T00:00:00+00:00</updated>
   <id>http://wieczorek1990.github.io/2017/05/04/random-findings</id>
   <content type="html">&lt;p&gt;Secure GPG key generation using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gpg&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;gpg2 --gen-key
gpg2 --list-keys
gpg2 -K --keyid-format long --with-colons --with-fingerprint
gpg2 --export -a $ID
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Other useful GPG commands;&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;gpg2 --delete-secret-key $email
gpg2 --delete-key $email
gpg --armor --export $email &amp;gt; &quot;${email}.asc&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Long ssh key generation using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ssh-keygen&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ssh-keygen -b 16384
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Setting fedora docker directories permission using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;chcon&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo chcon -Rt svirt_sandbox_file_t /var/lib/docker/volumes/
chcon -Rt svirt_sandbox_file_t $volume_dir
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Burning Ubuntu to USB using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dd&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;lsblk -f
umount /dev/sdb1
dd if=ubuntu-16.04.2-desktop-amd64.iso of=/dev/sdb bs=4M status=progress
sync
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Ignoring changes for file in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git update-index --(no-)assume-unchanged
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Removing project containers using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docker-compse&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;docker-compose down --rmi all --remove-orphans
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Rebuilding project containers using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docker-compose&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;docker-compose up --build
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Updating all globally installed gems using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gem&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cut&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo gem update `gem list | cut -d &apos; &apos; -f 1`
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Upgrading to Fedora 26 using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;system-upgrade&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;dnf upgrade --refresh
dnf install --assumeyes dnf-plugin-system-upgrade
dnf system-upgrade download --refresh --releasever=26
dnf system-upgrade reboot
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>uWSGI maximum scoket connections</title>
   <link href="http://wieczorek1990.github.io/2016/10/12/uwsgi-maximum-scoket-connections.html"/>
   <updated>2016-10-12T00:00:00+00:00</updated>
   <id>http://wieczorek1990.github.io/2016/10/12/uwsgi-maximum-scoket-connections</id>
   <content type="html">&lt;p&gt;Were you ever wondering why are you getting HTTP 502 responses from your uWSGI on high connection count?&lt;/p&gt;

&lt;p&gt;Setting &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;net.core.somaxconn&lt;/code&gt; might help.&lt;/p&gt;

&lt;p&gt;Temporarily:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ cat /proc/sys/net/core/somaxconn
# echo 4096 &amp;gt; /proc/sys/net/core/somaxconn
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Temporarily with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sysctl&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# sysctl -w net.core.somaxconn=1024
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# echo &apos;net.core.somaxconn=1024&apos; &amp;gt;&amp;gt; /etc/sysctl.conf
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Reload kernel parameters after changes:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# sysctl -p
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Change uWSGI settings for vassal:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cat /etc/uwsgi/vassals/vassal.ini
echo &apos;listen = 1024&apos; &amp;gt;&amp;gt; /etc/uwsgi/vassals/vassal.ini
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Restart uwsgi:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;service uwsgi restart
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>Debugging Django code</title>
   <link href="http://wieczorek1990.github.io/2016/10/12/debugging-django-code.html"/>
   <updated>2016-10-12T00:00:00+00:00</updated>
   <id>http://wieczorek1990.github.io/2016/10/12/debugging-django-code</id>
   <content type="html">&lt;p&gt;Ever tried debugging Django code in the CLI offered by &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;manage.py&lt;/code&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;shell&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;shell_plus&lt;/code&gt;?&lt;/p&gt;

&lt;p&gt;It gets nasty when you need to write more than few lines of code to run something.&lt;/p&gt;

&lt;p&gt;Here’s what you can do instead:&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;os&lt;/span&gt;

&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;django&lt;/span&gt;


&lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;environ&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;DJANGO_SETTINGS_MODULE&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&apos;project.settings&apos;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;django&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;setup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;


&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;():&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&apos;Hello world!&apos;&lt;/span&gt;


&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;__name__&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&apos;__main__&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>Cleaning up old remote branches in Git</title>
   <link href="http://wieczorek1990.github.io/2016/10/12/cleaning-up-old-remote-branches-in-git.html"/>
   <updated>2016-10-12T00:00:00+00:00</updated>
   <id>http://wieczorek1990.github.io/2016/10/12/cleaning-up-old-remote-branches-in-git</id>
   <content type="html">&lt;p&gt;This time in fish.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-fish&quot;&gt;git fetch origin --prune
git fetch --all
for branch in (git branch --remote | egrep -v &apos;develop|master|\*&apos; | tr -d &apos; &apos; | sed &apos;s/origin\///&apos;); git push origin &quot;:$branch&quot;; end
&lt;/code&gt;&lt;/pre&gt;
</content>
 </entry>
 
 <entry>
   <title>Restoring default directories</title>
   <link href="http://wieczorek1990.github.io/2016/09/18/restoring-default-directories.html"/>
   <updated>2016-09-18T00:00:00+00:00</updated>
   <id>http://wieczorek1990.github.io/2016/09/18/restoring-default-directories</id>
   <content type="html">&lt;p&gt;If you are using GNOME or similar desktop environment you might want sometimes delete default directories if you do not use them. Later on you figure out it would be cool to have them back, but when you create a new directory it does not have the good looking icon on it.&lt;/p&gt;

&lt;p&gt;You can fix it with the below two commands which will regenerate the default directories.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;rm ~/.config/user-dirs.dirs
xdg-user-dirs-update
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>Checking file encoding</title>
   <link href="http://wieczorek1990.github.io/2016/09/14/checking-file-encoding.html"/>
   <updated>2016-09-14T00:00:00+00:00</updated>
   <id>http://wieczorek1990.github.io/2016/09/14/checking-file-encoding</id>
   <content type="html">&lt;h1 id=&quot;example&quot;&gt;Example&lt;/h1&gt;

&lt;p&gt;Tired of checking file encodings?&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cd $directory
for file in *; echo &quot;$file — &quot;(uchardet $file); end
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;packages&quot;&gt;Packages&lt;/h1&gt;
&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;uchardet&lt;/code&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Warmup</title>
   <link href="http://wieczorek1990.github.io/2016/09/11/warmup.html"/>
   <updated>2016-09-11T00:00:00+00:00</updated>
   <id>http://wieczorek1990.github.io/2016/09/11/warmup</id>
   <content type="html">&lt;h1 id=&quot;intro&quot;&gt;Intro&lt;/h1&gt;

&lt;p&gt;I decided to use this blog as a place were I share things I discover when working as a software engineer.&lt;/p&gt;

&lt;p&gt;Starting with shell commands!&lt;/p&gt;

&lt;p&gt;I am using Debian and Bash or Fish (you might want to ask which operator has higher precedence here).&lt;/p&gt;

&lt;h2 id=&quot;line-endings&quot;&gt;Line endings&lt;/h2&gt;

&lt;p&gt;Ever thought how to convert those &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;^M&lt;/code&gt; characters in VIM that represent Windows line endings (CRLF) to Unix line endings (LF)?&lt;/p&gt;

&lt;p&gt;You can do it with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tr&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dos2unix&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;tr -d &apos;\015&apos; &amp;lt; $input &amp;gt; $output
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;or&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;dos2unix $input
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If you need to convert all files in a directory use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;find&lt;/code&gt; with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;exec&lt;/code&gt; flag:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;find $directory -type f -exec dos2unix {} \;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;finding-packages&quot;&gt;Finding packages&lt;/h2&gt;

&lt;p&gt;Now how do I know what package has the dos2unix executable?&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;dpkg -S $executable
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;there is also another program which does the same:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;dlocate $executable
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;and another:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;apt-file update
apt-file search $executable
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Notice that this produces lots of output if you give it just the name, try with full path instead.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;whereis $executable
which $executable
apt-file search $full_executable_path
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;secure-data-erasure&quot;&gt;Secure data erasure&lt;/h2&gt;

&lt;p&gt;You sometimes do not want others to recover your files, say for example, with passwords right?&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;wipe $file
wpie -r $directory
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;git-history-start-rewrite&quot;&gt;Git history start rewrite&lt;/h2&gt;

&lt;p&gt;You work with Git, right? How do you rebase the initial commit then?&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git rebase --interactive --root
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;in-place-file-modification&quot;&gt;In-place file modification&lt;/h2&gt;

&lt;p&gt;You probably tried:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;tr &apos;a&apos; &apos;z&apos; &amp;lt; $input &amp;gt; $input
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;somewhere in time and it did not work, leaving you with empty file.&lt;/p&gt;

&lt;p&gt;Well you cannot read and write at the same time from and to the same file because it is being processed.&lt;/p&gt;

&lt;p&gt;Think of it as changing the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;for&lt;/code&gt; loop index while in the loop.&lt;/p&gt;

&lt;p&gt;But you probably just want to do the operation in place, and there is a way.&lt;/p&gt;

&lt;p&gt;Ta da, da da dam: SPONGE!&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;tr &apos;a&apos; &apos;z&apos; &amp;lt; $input | sponge $input
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;outro&quot;&gt;Outro&lt;/h1&gt;

&lt;h2 id=&quot;please-please-please&quot;&gt;Please, please, please&lt;/h2&gt;

&lt;p&gt;Please share the post if you liked it.&lt;/p&gt;

&lt;p&gt;Thanks!&lt;/p&gt;

&lt;h2 id=&quot;appendix&quot;&gt;Appendix&lt;/h2&gt;

&lt;p&gt;Packages:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;coreutils&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dos2unix&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;findutils&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dpkg&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dlocate&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;apt-file&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;debianutils&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wipe&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;moreutils&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Credits:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;VonC&quot;&gt;http://stackoverflow.com/questions/2613800/how-to-convert-dos-windows-newline-crlf-to-unix-newline-n-in-bash-script&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;Andy&quot;&gt;http://stackoverflow.com/questions/7068179/convert-line-endlings-for-whole-directory-tree-git&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;Takkat&quot;&gt;http://askubuntu.com/questions/57572/how-to-delete-files-in-secure-manner&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;ecdpalma&quot;&gt;http://stackoverflow.com/questions/2246208/change-first-commit-of-project-with-git&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>First post with TinyPress!</title>
   <link href="http://wieczorek1990.github.io/2016/03/07/first-post-with-tinypress.html"/>
   <updated>2016-03-07T00:00:00+00:00</updated>
   <id>http://wieczorek1990.github.io/2016/03/07/first-post-with-tinypress</id>
   <content type="html">&lt;p&gt;I love simple and minimal design, therefore the decision to use TinyPress as my blogging platform is obvious!&lt;/p&gt;
</content>
 </entry>
 

</feed>
