<?xml version="1.0" encoding="utf-8" ?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:tt="http://teletype.in/" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"><title>Sviat</title><author><name>Sviat</name></author><id>https://teletype.in/atom/sviat</id><link rel="self" type="application/atom+xml" href="https://teletype.in/atom/sviat?offset=0"></link><link rel="alternate" type="text/html" href="https://teletype.in/@sviat?utm_source=teletype&amp;utm_medium=feed_atom&amp;utm_campaign=sviat"></link><link rel="next" type="application/rss+xml" href="https://teletype.in/atom/sviat?offset=10"></link><link rel="search" type="application/opensearchdescription+xml" title="Teletype" href="https://teletype.in/opensearch.xml"></link><updated>2026-04-11T14:47:53.532Z</updated><entry><id>sviat:install-docker-k8s</id><link rel="alternate" type="text/html" href="https://teletype.in/@sviat/install-docker-k8s?utm_source=teletype&amp;utm_medium=feed_atom&amp;utm_campaign=sviat"></link><title>Install docker &amp; k8s</title><published>2020-11-24T08:55:28.610Z</published><updated>2020-11-28T16:21:37.573Z</updated><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://teletype.in/files/0b/95/0b9538e5-5891-40d9-89e1-bf443b5a0d5e.png"></media:thumbnail><summary type="html">&lt;img src=&quot;https://teletype.in/files/21/30/2130dbd8-5549-4e65-ab82-bd030e9ed2b6.png&quot;&gt;</summary><content type="html">
  &lt;figure class=&quot;m_column&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/21/30/2130dbd8-5549-4e65-ab82-bd030e9ed2b6.png&quot; width=&quot;787&quot; /&gt;
  &lt;/figure&gt;
  &lt;pre&gt;sudo su
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
echo &amp;quot;deb http://apt.kubernetes.io kubernetes-xenial main&amp;quot; &amp;gt;&amp;gt; /etc/apt/sources.list.d/kubernetes.list
add-apt-repository &amp;quot;deb https://download.docker.com/linux/$(. /etc/os-release; echo &amp;quot;$ID&amp;quot;) $(lsb_release -cs) stable&amp;quot;
apt-get update
apt-get install -y docker-ce kubelet kubeadm kubectl
swapoff -a
sed -i &amp;#x27;/ swap / s/^/#/&amp;#x27; /etc/fstab&lt;/pre&gt;

</content></entry><entry><id>sviat:lxzZ0ACjy</id><link rel="alternate" type="text/html" href="https://teletype.in/@sviat/lxzZ0ACjy?utm_source=teletype&amp;utm_medium=feed_atom&amp;utm_campaign=sviat"></link><title>Bash tips</title><published>2020-10-20T13:04:11.444Z</published><updated>2020-10-30T13:36:19.709Z</updated><summary type="html">sudo kill $(sudo lsof -ti:port)</summary><content type="html">
  &lt;h2&gt;General&lt;/h2&gt;
  &lt;h3&gt;kill procces by port&lt;/h3&gt;
  &lt;p&gt;&lt;code&gt;sudo kill $(sudo lsof -ti:port)&lt;/code&gt;&lt;/p&gt;
  &lt;h3&gt;create symlink&lt;br /&gt;&lt;code&gt;ln -sf /path/to/file /path/to/symlink&lt;/code&gt;&lt;/h3&gt;
  &lt;h3&gt;open url from bash&lt;/h3&gt;
  &lt;p&gt;&lt;code&gt;xdg-open http://google.com&lt;/code&gt;&lt;/p&gt;
  &lt;h3&gt;bash loop&lt;/h3&gt;
  &lt;p&gt;&lt;code&gt;for (;;); do command; command-2; done&lt;/code&gt;&lt;/p&gt;
  &lt;h3&gt;output timestamps&lt;/h3&gt;
  &lt;pre&gt;ts # timestamp
ts -i # each output duration
ts -s # time taken from start&lt;/pre&gt;
  &lt;h3&gt;find &amp;amp; replace in all files in folder &amp;amp; subfolders&lt;/h3&gt;
  &lt;pre&gt;sudo kill $(sudo lsof -ti:port)
ack -l &amp;#x27;pattern&amp;#x27; | xargs perl -pi -E &amp;#x27;s/pattern/replacement/g&amp;#x27;&lt;/pre&gt;
  &lt;h3&gt;visualize git repo development&lt;/h3&gt;
  &lt;p&gt;&lt;code&gt;gource --stop-at-end --hide filenames,usernames,dirnames -1920x1080 -s 0.5 -o - | ffmpeg -y -r 30 -f image2pipe -vcodec ppm -i - -vcodec libx264 -preset ultrafast -pix_fmt yuv420p -threads 0 -bf 0 gource.mp4 -crf 0&lt;/code&gt;&lt;/p&gt;
  &lt;h3&gt;list opened ports and its process names&lt;/h3&gt;
  &lt;p&gt;&lt;code&gt;netstat -nlpt&lt;/code&gt;&lt;/p&gt;
  &lt;h2&gt;postgres&lt;/h2&gt;
  &lt;h3&gt;install psql&lt;/h3&gt;
  &lt;p&gt;&lt;code&gt;sudo apt install postgresql postgresql-contrib&lt;/code&gt;&lt;/p&gt;
  &lt;h3&gt;drop connections for dbname&lt;/h3&gt;
  &lt;pre&gt;SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity
WHERE pg_stat_activity.datname = &amp;#x27;dbname&amp;#x27; AND pid &amp;lt;&amp;gt; pg_backend_pid();&lt;/pre&gt;
  &lt;h3&gt;create full duplicate of dbname named dbname_copy with db_user owner&lt;/h3&gt;
  &lt;p&gt;&lt;code&gt;create database dbname_copy WITH TEMPLATE dbname OWNER owner;&lt;/code&gt;&lt;/p&gt;
  &lt;h3&gt;check postgres certificates&lt;/h3&gt;
  &lt;pre&gt;curl https://raw.githubusercontent.com/thusoy/postgres-mitm/master/postgres_get_server_cert.py | python3 - host:port | openssl x509 -noout -dates&lt;/pre&gt;

</content></entry><entry><id>sviat:async-bash</id><link rel="alternate" type="text/html" href="https://teletype.in/@sviat/async-bash?utm_source=teletype&amp;utm_medium=feed_atom&amp;utm_campaign=sviat"></link><title>Aync execution for bash</title><published>2020-09-11T08:12:07.626Z</published><updated>2020-09-22T15:16:34.745Z</updated><summary type="html">Easy way to manage scripts in the background</summary><content type="html">
  &lt;p&gt;Easy way to manage scripts in the background&lt;/p&gt;
  &lt;pre&gt;# in order to use in bash scripts add &amp;quot;set -m&amp;quot; to enable job control

echo &amp;gt; job-status
command1 || echo false &amp;gt; job-status &amp;amp;
command2 || echo false &amp;gt; job-status &amp;amp;
# repeat as much as needed
while [[ $(jobs) ]]; do fg; done
[[ $(cat job-status) != &amp;quot;false&amp;quot; ]]&lt;/pre&gt;

</content></entry><entry><id>sviat:resizing-partition</id><link rel="alternate" type="text/html" href="https://teletype.in/@sviat/resizing-partition?utm_source=teletype&amp;utm_medium=feed_atom&amp;utm_campaign=sviat"></link><title>Resize partition on running Linux instance</title><published>2020-08-18T09:17:00.439Z</published><updated>2020-08-18T09:36:49.574Z</updated><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://teletype.in/files/14/17/1417d32c-c798-4cda-b2f8-e0f4d85f4b58.png"></media:thumbnail><summary type="html">&lt;img src=&quot;https://teletype.in/files/40/51/4051521e-3b4f-45fd-b320-04131fe61e78.png&quot;&gt;As an example, we'll pick AWS and will add 5GB(60-&gt;65 GB).</summary><content type="html">
  &lt;figure class=&quot;m_column&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/40/51/4051521e-3b4f-45fd-b320-04131fe61e78.png&quot; width=&quot;616&quot; /&gt;
  &lt;/figure&gt;
  &lt;h3&gt;Step 1: Add storage&lt;/h3&gt;
  &lt;p&gt;As an example, we&amp;#x27;ll pick AWS and will add 5GB(60-&amp;gt;65 GB).&lt;/p&gt;
  &lt;figure class=&quot;m_custom&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/e3/36/e336d4f7-9450-460d-8daa-2d87d7e235a0.png&quot; width=&quot;1329&quot; /&gt;
  &lt;/figure&gt;
  &lt;figure class=&quot;m_column&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/34/8b/348b8bec-582b-490c-806d-9056f20e6f83.png&quot; width=&quot;494&quot; /&gt;
    &lt;figcaption&gt;Used space&lt;/figcaption&gt;
  &lt;/figure&gt;
  &lt;h3&gt;Step 2: Resize physical partition&lt;/h3&gt;
  &lt;p&gt;Use &lt;code&gt;lsblk | grep -v loop&lt;/code&gt; to list all available disks and partitions&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/b4/6c/b46c4fd1-e2ef-474e-85db-450a351eb33f.png&quot; width=&quot;427&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;&lt;code&gt;sudo growpart /dev/{device_label} {index}&lt;/code&gt; to resize partition&lt;/p&gt;
  &lt;figure class=&quot;m_column&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/f4/4c/f44ca886-835d-4970-9716-354a4590e7bc.png&quot; width=&quot;1000&quot; /&gt;
  &lt;/figure&gt;
  &lt;h3&gt;Step 3: Tell the system to use newly available space&lt;/h3&gt;
  &lt;p&gt;&lt;code&gt;sudo resize2fs /dev/{partition_label}&lt;/code&gt;&lt;/p&gt;
  &lt;figure class=&quot;m_column&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/03/78/03782fb7-2a10-4397-9e16-ea5c78eeb1b4.png&quot; width=&quot;678&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;&lt;code&gt;df -h /&lt;/code&gt; to check results&lt;/p&gt;
  &lt;figure class=&quot;m_column&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/86/6f/866f452c-2692-4f67-83e8-4c295b8199aa.png&quot; width=&quot;491&quot; /&gt;
  &lt;/figure&gt;

</content></entry></feed>