<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
    <channel>
      <title>Lybekk</title>
      <link>https://lybekk.tech</link>
      <description>Personal&#x2F;Portfolio site.</description>
      <generator>Zola</generator>
      <language>en</language>
      <atom:link href="https://lybekk.tech/rss.xml" rel="self" type="application/rss+xml"/>
      <lastBuildDate>Tue, 07 Jul 2026 00:00:00 +0000</lastBuildDate>
      <item>
          <title>UUID Generator</title>
          <pubDate>Tue, 07 Jul 2026 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/uuid-generator/</link>
          <guid>https://lybekk.tech/uuid-generator/</guid>
          <description xml:base="https://lybekk.tech/uuid-generator/">&lt;p&gt;Generate random version 4 (random) UUIDs. Everything runs in your browser using
the Web Crypto API. Nothing is sent anywhere.&lt;&#x2F;p&gt;
&lt;section class=&quot;tool&quot; id=&quot;uuid-tool&quot;&gt;
  &lt;p&gt;&lt;label&gt;How many (1&amp;ndash;100)&lt;br&gt;&lt;input type=&quot;number&quot; id=&quot;uuid-count&quot; min=&quot;1&quot; max=&quot;100&quot; value=&quot;5&quot; inputmode=&quot;numeric&quot;&gt;&lt;&#x2F;label&gt;&lt;&#x2F;p&gt;
  &lt;p&gt;&lt;button type=&quot;button&quot; id=&quot;uuid-generate&quot;&gt;Generate&lt;&#x2F;button&gt;&lt;button type=&quot;button&quot; id=&quot;uuid-copy&quot;&gt;Copy&lt;&#x2F;button&gt;&lt;&#x2F;p&gt;
  &lt;p&gt;&lt;textarea id=&quot;uuid-output&quot; rows=&quot;6&quot; readonly aria-label=&quot;Generated UUIDs&quot;&gt;&lt;&#x2F;textarea&gt;&lt;&#x2F;p&gt;
  &lt;p id=&quot;uuid-status&quot; role=&quot;status&quot; aria-live=&quot;polite&quot;&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;section&gt;
&lt;script src=&quot;&#x2F;uuid-generator.js&quot; defer&gt;&lt;&#x2F;script&gt;
</description>
      </item>
      <item>
          <title>Termux: Install Google Cloud CLI</title>
          <pubDate>Sat, 16 Jan 2021 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/guide/termux-install-google-cloud-cli/</link>
          <guid>https://lybekk.tech/guide/termux-install-google-cloud-cli/</guid>
          <description xml:base="https://lybekk.tech/guide/termux-install-google-cloud-cli/">&lt;blockquote&gt;
&lt;p&gt;These instructions specifically targets the following error during installation:
&lt;samp class=&quot;error&quot; style=&quot;display: inline-block;&quot;&gt;ERROR: (gcloud.components.update) The following components are unknown [anthoscli, kuberun].&lt;&#x2F;samp&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;ol&gt;
&lt;li&gt;First: Run
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;curl https:&#x2F;&#x2F;sdk.cloud.google.com | bash&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Note: This will fail when trying to install components. Ignore this.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Then &lt;code&gt;~&#x2F;google-cloud-sdk&#x2F;install.sh --override-components&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;(without specifying components)&lt;&#x2F;li&gt;
&lt;li&gt;Will add gcloud to $PATH&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;And then &lt;code&gt;gcloud components install gsutil&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Finally &lt;code&gt;gcloud init&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Google cloud&#x27;s shell can finally be accessed with &lt;code&gt;gcloud cloud-shell ssh&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
</description>
      </item>
      <item>
          <title>MySQL</title>
          <pubDate>Sun, 20 Dec 2020 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/cheatsheet/mysql/</link>
          <guid>https://lybekk.tech/cheatsheet/mysql/</guid>
          <description xml:base="https://lybekk.tech/cheatsheet/mysql/">&lt;h2 id=&quot;linux-stop-mysql-server-from-running-at-boot&quot;&gt;(Linux) Stop MySQL Server from running at boot&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;sudo systemctl disable mysql
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
</description>
      </item>
      <item>
          <title>React cheatsheet</title>
          <pubDate>Tue, 27 Oct 2020 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/cheatsheet/react/</link>
          <guid>https://lybekk.tech/cheatsheet/react/</guid>
          <description xml:base="https://lybekk.tech/cheatsheet/react/">&lt;h2 id=&quot;run-function-on-component-render&quot;&gt;Run function on component render&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;javascript&quot;&gt;import React, { useEffect } from &amp;quot;react&amp;quot;

useEffect(() =&amp;gt; {
    console.log(&amp;#39;This runs on every render&amp;#39;)
})

&#x2F;&#x2F; add and empty array as a callback to run once, instead of on every render
useEffect(() =&amp;gt; {
    console.log(&amp;#39;This runs exactly once&amp;#39;)
}, [])
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
</description>
      </item>
      <item>
          <title>Dart cheatsheet</title>
          <pubDate>Sun, 25 Oct 2020 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/cheatsheet/dart/</link>
          <guid>https://lybekk.tech/cheatsheet/dart/</guid>
          <description xml:base="https://lybekk.tech/cheatsheet/dart/">&lt;h2 id=&quot;useful-libraries&quot;&gt;Useful libraries&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;standard-library&quot;&gt;Standard library&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;dart:async - Enables async&#x2F;await functions&lt;&#x2F;li&gt;
&lt;li&gt;dart:io - For read&#x2F;write operations on the local filesystem
&lt;ul&gt;
&lt;li&gt;https:&#x2F;&#x2F;api.dart.dev&#x2F;stable&#x2F;2.10.2&#x2F;dart-io&#x2F;Directory-class.html&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;dart:convert - Used for, among other things, JSON encoding and decoding&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;print&quot;&gt;Print&lt;&#x2F;h2&gt;
&lt;p&gt;print(&#x27;Hello, World!&#x27;);&lt;&#x2F;p&gt;
&lt;h2 id=&quot;basic-function&quot;&gt;Basic function&lt;&#x2F;h2&gt;
&lt;p&gt;void main() {
print(&#x27;Hello, World!&#x27;);
}&lt;&#x2F;p&gt;
&lt;h2 id=&quot;run-dart-script-from-the-command-line&quot;&gt;Run Dart script from the command line&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;dart &#x2F;path&#x2F;to&#x2F;script.dart&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;directory&quot;&gt;Directory&lt;&#x2F;h2&gt;
&lt;p&gt;var myDir = new Directory(&#x27;&#x2F;home&#x2F;user&#x2F;dir&#x2F;&#x27;);&lt;&#x2F;p&gt;
&lt;h3 id=&quot;list-files-in-a-directory&quot;&gt;List files in a directory&lt;&#x2F;h3&gt;
&lt;pre&gt;&lt;code data-lang=&quot;dart&quot;&gt;var myDir = new Directory(&amp;#39;&#x2F;home&#x2F;user&#x2F;dir&#x2F;&amp;#39;);

void checkDir(theDir) {
  theDir.exists().then((isThere) {
    isThere ? print(&amp;#39;exists&amp;#39;) : print(&amp;#39;non-existent&amp;#39;);
    listDir(theDir);
  });
}

void listDir(theDir) {
    theDir.list(recursive: true, followLinks: false)
    .listen((FileSystemEntity entity) {
        print(entity.path);
    });
}

checkDir(myDir);
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;handy-resources-from-around-the-web&quot;&gt;Handy resources from around the web&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;codingwithjoe.com&#x2F;dart-fundamentals-working-with-json-in-dart-and-flutter&#x2F;&quot;&gt;Working with JSON&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;flutter.dev&#x2F;docs&#x2F;development&#x2F;data-and-backend&#x2F;json#manual-encoding&quot;&gt;JSON and serialization
&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;flutter.dev&#x2F;docs&#x2F;cookbook&#x2F;persistence&#x2F;reading-writing-files&quot;&gt;Reading and writing files&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</description>
      </item>
      <item>
          <title>PowerShell</title>
          <pubDate>Wed, 14 Oct 2020 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/cheatsheet/powershell/</link>
          <guid>https://lybekk.tech/cheatsheet/powershell/</guid>
          <description xml:base="https://lybekk.tech/cheatsheet/powershell/">&lt;h2 id=&quot;find-content-in-files&quot;&gt;Find content in files&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;Get-Content .\file.txt | Select-String &#x27;String To Find&#x27;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
</description>
      </item>
      <item>
          <title>Regex</title>
          <pubDate>Wed, 14 Oct 2020 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/cheatsheet/regex/</link>
          <guid>https://lybekk.tech/cheatsheet/regex/</guid>
          <description xml:base="https://lybekk.tech/cheatsheet/regex/">&lt;h2 id=&quot;use-in-text-editors&quot;&gt;Use in text editors&lt;&#x2F;h2&gt;
&lt;p&gt;Regular expressions can be used for lookups on text editors.&lt;&#x2F;p&gt;
&lt;p&gt;Find and highlight the entire line&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;.*something.*&lt;&#x2F;code&gt;
Works in KWrite, Kate, Notepad++, Atom, and more.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
</description>
      </item>
      <item>
          <title>Windows CMD</title>
          <pubDate>Wed, 14 Oct 2020 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/cheatsheet/windows-cmd/</link>
          <guid>https://lybekk.tech/cheatsheet/windows-cmd/</guid>
          <description xml:base="https://lybekk.tech/cheatsheet/windows-cmd/">&lt;h2 id=&quot;findstr&quot;&gt;FINDSTR&lt;&#x2F;h2&gt;
&lt;p&gt;GREP equivalent for Windows CMD.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Syntax: &lt;code&gt;findstr pattern  filename&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;To search for a string in all the files in the current directory:
&lt;code&gt;findstr &#x2F;I  &quot;text to find&quot; *&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
</description>
      </item>
      <item>
          <title>How to: Rip audio from YouTube with Python</title>
          <pubDate>Wed, 14 Oct 2020 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/guide/rip-audio-from-youtube-with-python/</link>
          <guid>https://lybekk.tech/guide/rip-audio-from-youtube-with-python/</guid>
          <description xml:base="https://lybekk.tech/guide/rip-audio-from-youtube-with-python/">&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Disclaimer&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Ripping audio from copyrighted music videos is, in most cases, not legal.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;prerequites&quot;&gt;Prerequites&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;pip3 install youtube_dl&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;script&quot;&gt;Script&lt;&#x2F;h2&gt;
&lt;p&gt;Save this to a file and run it with a python interpreter.
(&lt;code&gt;python3 this_script.py&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;python&quot;&gt;import youtube_dl
from pathlib import Path

options = {
  &amp;#39;format&amp;#39;: &amp;#39;bestaudio&#x2F;best&amp;#39;,
  &amp;#39;extractaudio&amp;#39; : True,  # only keep the audio
  &amp;#39;audioformat&amp;#39; : &amp;quot;mp3&amp;quot;,  # convert to mp3 
  &amp;#39;noplaylist&amp;#39; : True,    # only download single song, not playlist
}

options[&amp;quot;artist&amp;quot;] = input(&amp;quot;Artist:&amp;quot;)
options[&amp;quot;track&amp;quot;] = input(&amp;quot;Track:&amp;quot;)
options[&amp;quot;genre&amp;quot;] = input(&amp;quot;Genre:&amp;quot;)

print(&amp;quot;Youtube video URL:&amp;quot;)
url = input()

filename = f&amp;#39;{options[&amp;quot;artist&amp;quot;]} - {options[&amp;quot;track&amp;quot;]}.mp3&amp;#39;

h = Path.home()
f = &amp;#39;Downloads&amp;#39;
path = h.joinpath(f)
if not path.exists():
    path = h.joinpath(f.lower())
path = path.joinpath(filename)

options[&amp;quot;outtmpl&amp;quot;] = str(path)

with youtube_dl.YoutubeDL(options) as ydl:
    ydl.download([url])
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
</description>
      </item>
      <item>
          <title>CouchDB cheatsheet</title>
          <pubDate>Sat, 19 Sep 2020 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/cheatsheet/couchdb/</link>
          <guid>https://lybekk.tech/cheatsheet/couchdb/</guid>
          <description xml:base="https://lybekk.tech/cheatsheet/couchdb/">&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Assumptions for this article&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Server is available locally on &lt;code&gt;http:&#x2F;&#x2F;localhost:5984&#x2F;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Database name is &lt;code&gt;mydb&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;fetch-all-documents-using-curl&quot;&gt;Fetch all documents using CURL&lt;&#x2F;h2&gt;
&lt;p&gt;syntax&#x2F;structure
http:&#x2F;&#x2F;localhost:5984&#x2F;mydb&#x2F;_all_docs?include_docs=true&lt;&#x2F;p&gt;
&lt;p&gt;Example&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;curl -X GET http:&#x2F;&#x2F;localhost:5984&#x2F;mydb&#x2F;_all_docs?include_docs=true

# If authentication is required
curl -X GET http:&#x2F;&#x2F;admin:password@localhost:5984&#x2F;mydb&#x2F;_all_docs?include_docs=true
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
</description>
      </item>
      <item>
          <title>KDE</title>
          <pubDate>Thu, 10 Sep 2020 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/cheatsheet/kde/</link>
          <guid>https://lybekk.tech/cheatsheet/kde/</guid>
          <description xml:base="https://lybekk.tech/cheatsheet/kde/">&lt;h2 id=&quot;performance-tips&quot;&gt;Performance tips&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;disable-baloo-file-indexer&quot;&gt;Disable Baloo File Indexer&lt;&#x2F;h3&gt;
&lt;p&gt;Navigate to &lt;code&gt;System settings -&amp;gt; Search -&amp;gt; File Search&lt;&#x2F;code&gt;.
Untick &lt;strong&gt;&quot;Enable file search&quot;&lt;&#x2F;strong&gt; to stop Baloo from spending system resources on continuous file indexing.
Especially useful if you&#x27;re low on RAM&#x2F;memory.&lt;&#x2F;p&gt;
</description>
      </item>
      <item>
          <title>Linux cheatsheet</title>
          <pubDate>Mon, 07 Sep 2020 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/cheatsheet/linux/</link>
          <guid>https://lybekk.tech/cheatsheet/linux/</guid>
          <description xml:base="https://lybekk.tech/cheatsheet/linux/">&lt;h2 id=&quot;split-cut-extract-clip-from-a-video-file&quot;&gt;Split&#x2F;cut&#x2F;extract clip from a video file&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;ffmpeg -ss 00:00:46 -t 00:00:30 -i input_file.mp4 -vcodec copy -acodec copy output_file.mp4
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;pre&gt;&lt;code&gt;Command explanation:

ffmpeg -ss &amp;lt;start-time&amp;gt; -t &amp;lt;target clip duration&amp;gt; -i &amp;lt;input_file.mp4&amp;gt; -vcodec copy -acodec copy &amp;lt;output_file.mp4&amp;gt;
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
</description>
      </item>
      <item>
          <title>Kotlin cheatsheet</title>
          <pubDate>Sat, 22 Aug 2020 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/cheatsheet/kotlin/</link>
          <guid>https://lybekk.tech/cheatsheet/kotlin/</guid>
          <description xml:base="https://lybekk.tech/cheatsheet/kotlin/">&lt;h2 id=&quot;create-a-function&quot;&gt;Create a function&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;kotlin&quot;&gt;fun main() {                        &#x2F;&#x2F; 2
    println(&amp;quot;Hello, World!&amp;quot;)        &#x2F;&#x2F; 3
}
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;print-to-console&quot;&gt;Print to console&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;kotlin&quot;&gt;&#x2F;&#x2F; Print with newline, I.E. move cursor to new line.
println(&amp;quot;Hello Werldz!&amp;quot;)
&#x2F;&#x2F; Print without adding newline
print(&amp;quot;Enter text: &amp;quot;)
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;prompt-for-input-and-print-to-console&quot;&gt;Prompt for input and print to console&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;kotlin&quot;&gt;print(&amp;quot;Enter text: &amp;quot;)
val stringInput = readLine()!!
println(&amp;quot;You entered: $stringInput&amp;quot;)
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
</description>
      </item>
      <item>
          <title>SSH cheatsheet</title>
          <pubDate>Wed, 29 Jul 2020 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/cheatsheet/ssh/</link>
          <guid>https://lybekk.tech/cheatsheet/ssh/</guid>
          <description xml:base="https://lybekk.tech/cheatsheet/ssh/">&lt;p&gt;&lt;em&gt;SSH - Secure Shell&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;forward-a-port-from-a-remote-source-i-e-a-vps-to-specific-port-on-localhost&quot;&gt;Forward a port from a remote source (I.E. a VPS) to specific port on localhost&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;ssh -L 65432:localhost:80 user@111.222.333.444 -p 54321 -i .ssh&#x2F;id_rsa_selected_key
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;Command breakdown&lt;&#x2F;em&gt;
&lt;code&gt;ssh&lt;&#x2F;code&gt; No explanation needed (?)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;-L 65432:localhost:80&lt;&#x2F;code&gt; The forwarding part of the command. 65432 is the port you want to forward to on the target&#x2F;receiver&#x2F;local device. localhost:80 is the port om the remote.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;user@111.222.333.444 -p 54321&lt;&#x2F;code&gt; The remote&#x27;s user, IP-address and SSH port (if port is not specifiec in remote&#x27;s settings, defaults to 22)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;-i .ssh&#x2F;id_rsa_selected_key&lt;&#x2F;code&gt; &#x27;-i&#x27; is used when a specific SSH key is needed&lt;&#x2F;p&gt;
&lt;h2 id=&quot;creating-a-key&quot;&gt;Creating a key&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;ssh-keygen -t rsa -C &amp;quot;some.identifier@name.com&amp;quot;
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
</description>
      </item>
      <item>
          <title>How to: Get Netlify Bandwith Usage Programatically For Free</title>
          <pubDate>Mon, 27 Jul 2020 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/guide/get-netlify-bandwidth-usage/</link>
          <guid>https://lybekk.tech/guide/get-netlify-bandwidth-usage/</guid>
          <description xml:base="https://lybekk.tech/guide/get-netlify-bandwidth-usage/">&lt;p&gt;Netlify&#x27;s Analytics feature, at the time of writing, costs 9$. This may be a bit steep if all you need is to measure your site&#x27;s traffic. This is an attempt on a livable compromise.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;using-python&quot;&gt;Using Python&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;explanation&quot;&gt;Explanation&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;em&gt;In the script below, replace the following variable&#x27;s values&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;dl&gt;
    &lt;dt style=&quot;font-weight: bold;&quot;&gt;ACCOUNT_NAME&lt;&#x2F;dt&gt;
    &lt;dd&gt;The account name associated with the account.&lt;&#x2F;dd&gt;
    &lt;dt style=&quot;font-weight: bold;&quot;&gt;SITE_NAME&lt;&#x2F;dt&gt;
    &lt;dd&gt;The site name can be found in &#x27;Site information&#x27; in the project&#x27;s settings, or at the top in the overview.&lt;&#x2F;dd&gt;
    &lt;dt style=&quot;font-weight: bold;&quot;&gt;EMAIL&lt;&#x2F;dt&gt;
    &lt;dd&gt;The email used during account registration.&lt;&#x2F;dd&gt;
    &lt;dt style=&quot;font-weight: bold;&quot;&gt;PERSONAL_ACCESS_TOKEN&lt;&#x2F;dt&gt;
    &lt;dd&gt;Created at https:&#x2F;&#x2F;app.netlify.com&#x2F;user&#x2F;applications&lt;&#x2F;dd&gt;        
&lt;&#x2F;dl&gt;
&lt;h3 id=&quot;full-python-script&quot;&gt;Full Python script&lt;&#x2F;h3&gt;
&lt;pre&gt;&lt;code data-lang=&quot;python&quot;&gt;import requests

# Edit these
ACCOUNT_NAME = &amp;#39;youraccountname&amp;#39;
SITE_NAME = &amp;#39;projectsitename&amp;#39;
EMAIL = &amp;#39;name@example.com&amp;#39;
PERSONAL_ACCESS_TOKEN = &amp;quot;&amp;lt;your Netlify personal access token&amp;gt;&amp;quot;

# Leave the rest
bandwidth_api_url = &amp;#39;https:&#x2F;&#x2F;api.netlify.com&#x2F;api&#x2F;v1&#x2F;accounts&#x2F;{}&#x2F;bandwidth&amp;#39;.format(ACCOUNT_NAME)

auth_string = &amp;quot;Bearer &amp;quot; + PERSONAL_ACCESS_TOKEN

response = requests.get(bandwidth_api_url, headers = {
    &amp;#39;User-Agent&amp;#39;: &amp;#39;{0} ({1})&amp;#39;.format(SITE_NAME, EMAIL),
    &amp;quot;Authorization&amp;quot;: auth_string
})
response = response.json()

# Optional printing to console. Can be removed
print(&amp;#39;Raw response: &amp;#39;, response)

def calculate(key):
    return int(response[key]) &#x2F; 1000000

print_list = {
    &amp;quot;Included in plan&amp;quot;: calculate(&amp;quot;included&amp;quot;),
    &amp;quot;Used&amp;quot;: calculate(&amp;quot;used&amp;quot;),
    &amp;quot;Remaining&amp;quot;:  calculate(&amp;quot;included&amp;quot;) - calculate(&amp;quot;used&amp;quot;),
}
print(&amp;#39;Human readable:&amp;#39;)
for item in print_list.items():
    print(item[0], &amp;#39;: &amp;#39;, round(item[1], 2), &amp;#39; MB&amp;#39;)
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;Note: The returned usage will be a bit higher than how Netlify calculates it.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;netlify-bandwidth-checker-tool&quot;&gt;Netlify Bandwidth Checker Tool&lt;&#x2F;h2&gt;
&lt;p&gt;If you are comfortable pasting your &lt;strong&gt;Personal Access Token&lt;&#x2F;strong&gt; in a web form, try this tool, which does the same as the Python script, only in JavaScript.
One way to mitigate risk is to create a token, and revoke it just after using this tool.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note: The script is executed client-side. No information is exchanged with lybekk.tech&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;section class=&quot;tool&quot; id=&quot;netlify-bandwidth&quot;&gt;
  &lt;form id=&quot;netlify-bandwidth-form&quot;&gt;
    &lt;p&gt;&lt;label&gt;Personal access token&lt;br&gt;&lt;input type=&quot;password&quot; name=&quot;pat&quot; autocomplete=&quot;off&quot;&gt;&lt;&#x2F;label&gt;&lt;&#x2F;p&gt;
    &lt;p&gt;&lt;label&gt;Site name&lt;br&gt;&lt;input type=&quot;text&quot; name=&quot;siteName&quot; autocomplete=&quot;off&quot;&gt;&lt;&#x2F;label&gt;&lt;&#x2F;p&gt;
    &lt;p&gt;&lt;label&gt;Account name&lt;br&gt;&lt;input type=&quot;text&quot; name=&quot;accName&quot; autocomplete=&quot;off&quot;&gt;&lt;&#x2F;label&gt;&lt;&#x2F;p&gt;
    &lt;p&gt;&lt;label&gt;Account email&lt;br&gt;&lt;input type=&quot;text&quot; name=&quot;accEmail&quot; autocomplete=&quot;off&quot;&gt;&lt;&#x2F;label&gt;&lt;&#x2F;p&gt;
    &lt;p&gt;&lt;button type=&quot;submit&quot;&gt;Get&lt;&#x2F;button&gt;&lt;&#x2F;p&gt;
  &lt;&#x2F;form&gt;
  &lt;p&gt;&lt;label&gt;&lt;input type=&quot;checkbox&quot; id=&quot;netlify-save&quot;&gt; Save credentials for next time&lt;&#x2F;label&gt;&lt;&#x2F;p&gt;
  &lt;p&gt;&lt;small&gt;* Uses localStorage in your browser. Credentials are never sent to lybekk.tech.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
  &lt;table id=&quot;netlify-bandwidth-results&quot;&gt;&lt;&#x2F;table&gt;
&lt;&#x2F;section&gt;
&lt;script src=&quot;&#x2F;netlify-bandwidth.js&quot; defer&gt;&lt;&#x2F;script&gt;
</description>
      </item>
      <item>
          <title>How To: Use Fluent UI Icons in Gatsby</title>
          <pubDate>Sun, 26 Jul 2020 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/guide/use-fluentui-icons-in-gatsby/</link>
          <guid>https://lybekk.tech/guide/use-fluentui-icons-in-gatsby/</guid>
          <description xml:base="https://lybekk.tech/guide/use-fluentui-icons-in-gatsby/">&lt;h2 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;A running Gatsby development environment with Fluent UI&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;first-initialize-icons&quot;&gt;First - Initialize icons&lt;&#x2F;h2&gt;
&lt;p&gt;Fluent UI React&#x27;s official documentation instructs you to include the below lines in the root entry file.&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;javascript&quot;&gt;import { initializeIcons } from &amp;#39;@uifabric&#x2F;icons&amp;#39;;
initializeIcons();
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In &lt;strong&gt;Gatsby&lt;&#x2F;strong&gt;, an easier and more straightforward way is to include these lines in &lt;code&gt;index.js&lt;&#x2F;code&gt; or a layout component (I.E. &lt;code&gt;Layout.js&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Another possible solution may be to put them in one of Gatsby&#x27;s API files.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;By default, when a user visits the deployed Gatsby app, all icons will be downloaded from one of Microsoft servers.&lt;&#x2F;p&gt;
&lt;p&gt;To &lt;strong&gt;avoid&lt;&#x2F;strong&gt; this behaviour, do a couple of small adjustments.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Copy the icons from &lt;code&gt;your_project\node_modules\@uifabric\icons\fonts&lt;&#x2F;code&gt; to a subdirectory in your projects &#x27;static&#x27; folder.&lt;&#x2F;li&gt;
&lt;li&gt;Modify the lines from earlier slightly, as below, where the parameter for &lt;code&gt;initializeIcons()&lt;&#x2F;code&gt; is the path to where the icons are.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre&gt;&lt;code data-lang=&quot;javascript&quot;&gt;import { initializeIcons } from &amp;#39;@uifabric&#x2F;icons&amp;#39;;
initializeIcons(&amp;#39;https:&#x2F;&#x2F;lybekk.tech&#x2F;fluenticons&#x2F;&amp;#39;);
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;The slash &#x27;&#x2F;&#x27; at the end is important&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Now Gatsby will load the icons with the same performance and guarantees as the other files, ensuring correct rendering.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;See an example of Fluent UI running on Gatsby here:
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;lybekk.tech&#x2F;tools&#x2F;uuidgenerator&#x2F;&quot;&gt;Lybekk Tech - UUID Generator&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;hr &#x2F;&gt;
&lt;p&gt;Further documentation on using
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;fluentui&#x2F;wiki&#x2F;using-icons&quot;&gt;icons with Microsoft&#x27;s Fluent UI&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;As an added bonus, a way to use Font Awesome instead of Fluent UI icons.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;javascript&quot;&gt;import { registerIcons } from &amp;#39;@uifabric&#x2F;styling&amp;#39;;
import { FontAwesomeIcon } from &amp;#39;@fortawesome&#x2F;react-fontawesome&amp;#39;;
import { faCode } from &amp;#39;@fortawesome&#x2F;free-solid-svg-icons&amp;#39;;

registerIcons({
  icons: {
    Filter: &amp;lt;FontAwesomeIcon icon={faCode} &#x2F;&amp;gt;
  }
});
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
</description>
      </item>
      <item>
          <title>Run a simple Python CGI on Apache Web Server</title>
          <pubDate>Mon, 20 Jul 2020 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/guide/python-cgi-on-apache-web-server/</link>
          <guid>https://lybekk.tech/guide/python-cgi-on-apache-web-server/</guid>
          <description xml:base="https://lybekk.tech/guide/python-cgi-on-apache-web-server/">&lt;h2 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Python 3.x&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;first-things-first&quot;&gt;First things first&lt;&#x2F;h2&gt;
&lt;p&gt;First, save the script below to a file.&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;python&quot;&gt;#!&#x2F;usr&#x2F;bin&#x2F;env python3
import cgi
from string import Template

# enable debugging
import cgitb
cgitb.enable()

print(&amp;#39;Content-Type: text&#x2F;html; charset=utf-8\n&amp;#39;)
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;then&quot;&gt;Then&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;Configure Apache&#x27;s configuration file
&lt;ol&gt;
&lt;li&gt;Open the config file in any editor. Usually exists in &lt;code&gt;&#x2F;etc&#x2F;apache2&#x2F;apache2.conf&lt;&#x2F;code&gt;. Example: &lt;code&gt;sudo nano &#x2F;etc&#x2F;apache2&#x2F;apache2.conf&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Put this in at the end: &lt;code&gt;ScriptAlias &#x2F;myscript&#x2F; &quot;&#x2F;var&#x2F;www&#x2F;html&#x2F;cgi-bin&#x2F;your_script.py&quot;&lt;&#x2F;code&gt;. &#x27;myscript&#x27; is the URL you want the script at.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Put the Python script in cgi-bin (usually &lt;code&gt;&#x2F;var&#x2F;www&#x2F;html&#x2F;cgi-bin&#x2F;&lt;&#x2F;code&gt;)
&lt;ol&gt;
&lt;li&gt;Example: &lt;code&gt;sudo cp &#x2F;path&#x2F;to&#x2F;script&#x2F;your_script.py &#x2F;var&#x2F;www&#x2F;html&#x2F;cgi-bin&#x2F;your_script.py&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Make sure Apache has permission to execute the file &lt;code&gt;chmod +x your_script.py&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
</description>
      </item>
      <item>
          <title>CSS cheatsheet</title>
          <pubDate>Mon, 13 Jul 2020 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/cheatsheet/css/</link>
          <guid>https://lybekk.tech/cheatsheet/css/</guid>
          <description xml:base="https://lybekk.tech/cheatsheet/css/">&lt;h2 id=&quot;centering-items&quot;&gt;Centering items&lt;&#x2F;h2&gt;
&lt;p&gt;Easily center items both horizontally and vertically.&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;css&quot;&gt;div {
    display: grid;
    place-items: center;
}

&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
</description>
      </item>
      <item>
          <title>Git cheatsheet</title>
          <pubDate>Mon, 13 Jul 2020 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/cheatsheet/git/</link>
          <guid>https://lybekk.tech/cheatsheet/git/</guid>
          <description xml:base="https://lybekk.tech/cheatsheet/git/">&lt;h2 id=&quot;commands&quot;&gt;Commands&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Command&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;git init&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Initializes&#x2F;creates a new repository&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;git clone&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Clone a repository into current working directory&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;git status&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;View changes since last commit&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;git status -u&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;View untracked files, expanding subdirectories&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;git add &amp;lt;filename&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Add file to commit&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;git commit -m &quot;message describing commit&quot;&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Skip editor, directly adding commit message&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;git commit -a&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Commit all edits&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;git push origin master&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;send master branch to remote repository&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;git pull&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Update local repository with master branch&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
</description>
      </item>
      <item>
          <title>JavaScript cheatsheet</title>
          <pubDate>Mon, 13 Jul 2020 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/cheatsheet/javascript/</link>
          <guid>https://lybekk.tech/cheatsheet/javascript/</guid>
          <description xml:base="https://lybekk.tech/cheatsheet/javascript/">&lt;h2 id=&quot;generate-uuid-v4&quot;&gt;Generate UUID (v4)&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;javascript&quot;&gt;function uuidv4() {
    return &amp;quot;xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx&amp;quot;.replace(&#x2F;[xy]&#x2F;g, function(c) {
    var r = Math.random() * 16 | 0, v = c == &amp;quot;x&amp;quot; ? r : (r &amp;amp; 0x3 | 0x8);
    return v.toString(16);
    });
}
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;styling&quot;&gt;Styling&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;javascript&quot;&gt;let element = document.querySelector(&amp;quot;#navbar-foo&amp;quot;);

&#x2F;* Remove or add a CSS class depending on if it exists or not *&#x2F;
element.classList.toggle(&amp;quot;is-active&amp;quot;);

&#x2F;* Add multiple CSS classes in one go *&#x2F;
element.classList.add(&amp;quot;navbar-item&amp;quot;, &amp;quot;is-capitalized&amp;quot;);

&#x2F;* Style the HTML element directly *&#x2F;
element.style.display = &amp;quot;block&amp;quot;;

&#x2F;* Set multiple Style Object Properties Using the generic setAttribute method *&#x2F;
element.setAttribute(&amp;quot;style&amp;quot;, &amp;quot;position: fixed; bottom: 0; width: 50vw; left: 25%;&amp;quot;);

&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;send-and-retrieve-data-using-fetch-api&quot;&gt;Send and retrieve data using Fetch API&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;em&gt;All examples demonstrates Async fetch. Fetch API is also available using promises&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;(PUT) Update a JSON resource at an endpoint&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;javascript&quot;&gt;async function update_document(doc) {
    const url = &amp;#39;https:&#x2F;&#x2F;example.com&#x2F;json_endpoint&amp;#39;;
    try {
        const response = await fetch(url, {
            method: &amp;quot;PUT&amp;quot;,
            body: JSON.stringify(doc), 
            headers: {
                &amp;quot;Content-Type&amp;quot;: &amp;quot;application&#x2F;json&amp;quot;
            }
        });
        const result = await response.json();
        return await result;
    } catch (error) {
        console.log(error);
    }
}

const doc = {
    foo: &amp;quot;bar&amp;quot;,
    test: true
};

update_document(doc);
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;create-html-elements&quot;&gt;Create HTML elements&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;javascript&quot;&gt;const list = document.querySelector(&amp;quot;#list&amp;quot;);

let element = document.createElement(&amp;quot;LI&amp;quot;);

&#x2F;* add another element inside the list item *&#x2F;
let link = document.createElement(&amp;quot;A&amp;quot;);
link.textContent = &amp;quot;Visit site&amp;quot;;
link.href = &amp;quot;https:&#x2F;&#x2F;lybekk.tech&amp;quot;;

element.appendChild(link);

list.appendChild(element);
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;create-an-onclick-event-on-an-html-element&quot;&gt;Create an onclick event on an HTML element&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;javascript&quot;&gt;const btn = document.getElementById(&amp;quot;button&amp;quot;);

btn.onclick = function() {
    const popup = document.getElementById(&amp;quot;popup&amp;quot;);
    popup.style.display = &amp;quot;none&amp;quot;;
};
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;accessing-in-browser-storage&quot;&gt;Accessing in-browser storage&lt;&#x2F;h2&gt;
&lt;p&gt;Interface with the Web Storage API&lt;&#x2F;p&gt;
&lt;h3 id=&quot;local-storage&quot;&gt;Local Storage&lt;&#x2F;h3&gt;
&lt;pre&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&#x2F;* Retrieve an item *&#x2F;
localStorage.getItem(&amp;#39;weather&amp;#39;);

&#x2F;* Save a string*&#x2F;
localStorage.setItem(&amp;#39;weather&amp;#39;, &amp;#39;Snow&amp;#39;);

&#x2F;* Save an object *&#x2F;
localStorage.setItem(
    &amp;#39;weather&amp;#39;, JSON.stringify({
        hour: 08,
        type: &amp;#39;Hail&amp;#39;
    })
);
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h3 id=&quot;session-storage&quot;&gt;Session Storage&lt;&#x2F;h3&gt;
&lt;p&gt;Session storage interaction works in the same way as Local Storage.
Just replace &lt;code&gt;localStorage&lt;&#x2F;code&gt; with &lt;code&gt;sessionStorage&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;pick-random-item-from-an-array&quot;&gt;Pick random item from an array&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;javascript&quot;&gt;const items = [&amp;quot;Item one&amp;quot;, &amp;quot;Another item&amp;quot;, &amp;quot;Item, the third&amp;quot;]

function item() {
    const item = items[Math.floor(Math.random() * items.length)];
    return item
}

console.log(item())
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;includes&quot;&gt;includes()&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;strings&quot;&gt;Strings&lt;&#x2F;h3&gt;
&lt;pre&gt;&lt;code data-lang=&quot;javascript&quot;&gt;const str = &amp;quot;Hello world, welcome to the universe.&amp;quot;;
const n = str.includes(&amp;quot;world&amp;quot;);
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h3 id=&quot;array&quot;&gt;Array&lt;&#x2F;h3&gt;
&lt;pre&gt;&lt;code data-lang=&quot;javascript&quot;&gt;const numbers = [10, 12, 1, 2, 0]
if (numbers.includes(1) {
    console.log(&amp;quot;Exists&amp;quot;)
}
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;some&quot;&gt;some()&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;javascript&quot;&gt;const numbers = [10, 12, 1, 2, 0]
const isTrue = numbers.some(number =&amp;gt; {
    return number &amp;gt; 2
})
if (isTrue) {
    console.log(&amp;quot;This is true&amp;quot;)
}
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
</description>
      </item>
      <item>
          <title>Python cheatsheet</title>
          <pubDate>Thu, 09 Jul 2020 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/cheatsheet/python/</link>
          <guid>https://lybekk.tech/cheatsheet/python/</guid>
          <description xml:base="https://lybekk.tech/cheatsheet/python/">&lt;h2 id=&quot;generic&quot;&gt;Generic&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Retrieve device hostname&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;python&quot;&gt;import socket

HOSTNAME = socket.gethostname()
print(HOSTNAME)
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Get help for a Class object&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;python&quot;&gt;help(TheClassObject)
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Parse &amp;amp; Dump a JSON file&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;python&quot;&gt;import json

with open(&amp;#39;&#x2F;path&#x2F;to&#x2F;file.json&amp;#39;, &amp;quot;r&amp;quot;) as f:
    file_contents = json.loads( f.read() )
    print( json.dumps(file_contents, indent=4) )
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Write to file&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;python&quot;&gt;with open(&amp;#39;&#x2F;path&#x2F;to&#x2F;file.txt&amp;#39;, &amp;quot;w&amp;quot;) as f:
    f.write( &amp;quot;A string, dumped JSON or the like&amp;quot; )
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Get environment variable&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;python&quot;&gt;import os

variable = os.environ[&amp;#39;some_variable_name&amp;#39;]
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Execute a shell script&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;python&quot;&gt;import subprocess
subprocess.Popen(&amp;quot;script2.sh&amp;quot;, shell=True)
#Note: *&amp;lt;code&amp;gt;os.system(&amp;quot;script2.sh&amp;quot;)&amp;lt;&#x2F;code&amp;gt; is not recommended*
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;collection-types&quot;&gt;Collection types&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;python&quot;&gt;my_list = [&amp;quot;an item&amp;quot;, &amp;quot;another item&amp;quot;, &amp;quot;A third item. Can you believe it?&amp;quot;]
my_tuple = (&amp;quot;this&amp;quot;, &amp;quot;will be&amp;quot;, &amp;quot;unchangeable&amp;quot;)
my_set = {&amp;quot;the order&amp;quot;, &amp;quot;of these&amp;quot;, &amp;quot;are not guaranteed&amp;quot;}
my_dictionary = { &amp;quot;key1&amp;quot;: &amp;quot;Value 1&amp;quot;, &amp;quot;Key 2&amp;quot;: 42 }
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Lists and Tuples are &#x27;ordered&#x27;. Items will appear as they are inserted&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Sets and Dictionaries are not ordered collection types&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;run-another-python-script&quot;&gt;Run another Python script&lt;&#x2F;h2&gt;
&lt;p&gt;Runs another Python script in the same process as the script executing the command&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;python&quot;&gt;exec(open(&amp;quot;script2.py&amp;quot;).read())
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;dict-comprehension&quot;&gt;Dict comprehension&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;python&quot;&gt;[print(key, value) for key, value in some_dictionary.items()]
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;quick-http-server&quot;&gt;Quick HTTP server&lt;&#x2F;h2&gt;
&lt;p&gt;Establish a provisionary web server&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;python&quot;&gt;python -m http.server # for Python 3
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;quick-http-server-script&quot;&gt;Quick HTTP server (Script)&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;python&quot;&gt;import http.server
import socketserver
import cgi
import webbrowser

PORT = 8787
# Binds to localhost only. &amp;quot;&amp;quot; for exposing this to network interfaces
HOST = &amp;quot;localhost&amp;quot; 

# Launches the default web browser Opens the directory
url = &amp;#39;http:&#x2F;&#x2F;&amp;#39; + HOST + &amp;quot;:&amp;quot; + str(PORT)
webbrowser.open_new_tab(url)

# Magic
Handler = http.server.SimpleHTTPRequestHandler

with socketserver.TCPServer((HOST, PORT), Handler) as httpd:
    print(&amp;quot;serving at port&amp;quot;, PORT)
    httpd.serve_forever()
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;convert-csv-to-json&quot;&gt;Convert CSV to JSON&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;python&quot;&gt;import csv
import json

csvfile = open(&amp;#39;file.csv&amp;#39;, &amp;#39;r&amp;#39;)
jsonfile = open(&amp;#39;file.json&amp;#39;, &amp;#39;w&amp;#39;)

fieldnames = (&amp;quot;FirstName&amp;quot;,&amp;quot;LastName&amp;quot;,&amp;quot;IDNumber&amp;quot;,&amp;quot;Message&amp;quot;)
reader = csv.DictReader( csvfile, fieldnames)
for row in reader:
    json.dump(row, jsonfile)
    jsonfile.write(&amp;#39;\n&amp;#39;)
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;generate-uuids&quot;&gt;Generate uuids&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;python&quot;&gt;import uuid

nbr = int(input(&amp;quot;How many? &amp;quot;))

for _ in range(nbr):
    print(uuid.uuid4())
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;token-authorization-with-requests&quot;&gt;Token authorization with Requests&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;python&quot;&gt;import requests
import json

TOKEN = &amp;quot;&amp;lt;your token&amp;gt;&amp;quot;
URL= &amp;quot;https:&#x2F;&#x2F;api.github.com&#x2F;repos&#x2F;user&#x2F;repo&#x2F;releases&#x2F;latest&amp;quot;

headers_dict = {&amp;#39;Authorization&amp;#39;: &amp;#39;token %s&amp;#39; % TOKEN}
r = requests.get(URL, headers=headers_dict)
r_dict = r.json()
r_json = json.dumps(r_dict)

print(r_json)
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
</description>
      </item>
      <item>
          <title>HTML cheatsheet</title>
          <pubDate>Sun, 28 Jun 2020 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/cheatsheet/html/</link>
          <guid>https://lybekk.tech/cheatsheet/html/</guid>
          <description xml:base="https://lybekk.tech/cheatsheet/html/">&lt;h2 id=&quot;html&quot;&gt;HTML&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;embed-plain-text-txt-files-in-html&quot;&gt;Embed plain text (txt) files in .html&lt;&#x2F;h3&gt;
&lt;pre&gt;&lt;code data-lang=&quot;html&quot;&gt;&amp;lt;embed src=&amp;quot;folder&#x2F;file.txt&amp;quot; width=&amp;quot;400&amp;quot; height=&amp;quot;200&amp;quot;&amp;gt; 
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h3 id=&quot;style-embedded-elements&quot;&gt;Style embedded elements&lt;&#x2F;h3&gt;
&lt;pre&gt;&lt;code data-lang=&quot;html&quot;&gt;&amp;lt;div style=&amp;quot;margin: 0 auto; width:100%; height:400px; overflow: auto;&amp;quot;&amp;gt;
    &amp;lt;object type=&amp;quot;text&#x2F;html&amp;quot; data=&amp;quot;file_name.txt&amp;quot; style=&amp;quot;width:100%; height:400px; margin:1%;&amp;quot; &#x2F;&amp;gt;
&amp;lt;&#x2F;div&amp;gt;

&amp;lt;p&amp;gt;
    &amp;lt;font color=&amp;quot;#FFFFFF&amp;quot;&amp;gt;
        &amp;lt;embed src=&amp;quot;filename.txt&amp;quot; width=&amp;quot;x&amp;quot; height=&amp;quot;y&amp;quot; &#x2F;&amp;gt;
    &amp;lt;&#x2F;font&amp;gt;
&amp;lt;&#x2F;p&amp;gt;
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
</description>
      </item>
      <item>
          <title>Raspberry Pi</title>
          <pubDate>Sun, 28 Jun 2020 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/cheatsheet/raspberry-pi/</link>
          <guid>https://lybekk.tech/cheatsheet/raspberry-pi/</guid>
          <description xml:base="https://lybekk.tech/cheatsheet/raspberry-pi/">&lt;h2 id=&quot;misc&quot;&gt;Misc.&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;set-change-default-password&quot;&gt;Set&#x2F;change default password&lt;&#x2F;h3&gt;
&lt;p&gt;When logged in as pi (the default user), enter &lt;code&gt;passwd&lt;&#x2F;code&gt; in a terminal&lt;&#x2F;p&gt;
&lt;h3 id=&quot;adding-users&quot;&gt;Adding users&lt;&#x2F;h3&gt;
&lt;p&gt;In a terminal, enter &lt;code&gt;sudo adduser username&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;configure-autostart-items&quot;&gt;Configure autostart items&lt;&#x2F;h2&gt;
&lt;p&gt;One method is to create a configuration file that is unique to the currently logged in user. First you need to edit this text file:&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;shell&quot;&gt;sudo nano ~&#x2F;.config&#x2F;lxsession&#x2F;LXDE&#x2F;autostart
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This file represents a list of commands to be executed when the GUI loads. It is usually blank when you first edit it so just add the applications you need to auto-load:
@lxterminal
@leafpad
To save and exit the nano editor press CTRL-X, Y and then ENTER.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;restart-apache-http-server&quot;&gt;Restart Apache HTTP Server&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;shell&quot;&gt;sudo systemctl restart apache2
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
</description>
      </item>
      <item>
          <title>SQLite</title>
          <pubDate>Thu, 25 Jun 2020 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/cheatsheet/sqlite/</link>
          <guid>https://lybekk.tech/cheatsheet/sqlite/</guid>
          <description xml:base="https://lybekk.tech/cheatsheet/sqlite/">&lt;h2 id=&quot;copy-specific-columns-from-one-table-and-insert-into-a-different-table&quot;&gt;Copy specific columns from one table and insert into a different table&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;sql&quot;&gt;INSERT INTO destination_table (field1, field2) 
SELECT field1,field2 
FROM &amp;#39;source_table&amp;#39;;
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;copy-content-in-one-column-to-another-column-within-the-same-table&quot;&gt;Copy content in one column to another column within the same table&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;sql&quot;&gt;update tableName 
set destinationField = sourceField;
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote&gt;
&lt;p&gt;Warning!
Replaces all content in destination fields&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;insert-uuids-in-empty-cells&quot;&gt;Insert UUIDs in empty cells&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;python&quot;&gt;import sqlite3
import uuid

db = &amp;#39;database.db&amp;#39;

sql_find_id = &amp;#39;&amp;#39;&amp;#39; SELECT idcolumn,rowid 
                        FROM tablename 
                        WHERE idcolumn IS NULL 
                        LIMIT 1
&amp;#39;&amp;#39;&amp;#39;
sql_insert_uuid = &amp;#39;&amp;#39;&amp;#39; UPDATE tablename SET idcolumn=? WHERE rowid=?
&amp;#39;&amp;#39;&amp;#39;
sql_find_id_after = &amp;#39;&amp;#39;&amp;#39; SELECT idcolumn,rowid 
                        FROM tablename 
                        WHERE idcolumn=? 
&amp;#39;&amp;#39;&amp;#39;

conn = sqlite3.connect(db)
c = conn.cursor()
c.execute(sql_find_id)
nullornot = c.fetchone()[0]
while nullornot == None:
    try:
        c.execute(sql_find_id)
        nullornot = c.fetchone()[0]
    except:
        break
    c.execute(sql_find_id)
    rowid = c.fetchone()[1]
    genuuid = str(uuid.uuid4())
    c.execute(sql_insert_uuid, (genuuid,rowid,))
    c.execute(sql_find_id_after, (genuuid,))
    try:
        c.execute(sql_find_id)
        nullornot = c.fetchone()[0]
    except:
        print(&amp;quot;All done&amp;quot;)
conn.commit()
conn.close()
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
</description>
      </item>
      <item>
          <title>Syncthing</title>
          <pubDate>Thu, 25 Jun 2020 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/cheatsheet/syncthing/</link>
          <guid>https://lybekk.tech/cheatsheet/syncthing/</guid>
          <description xml:base="https://lybekk.tech/cheatsheet/syncthing/">&lt;h2 id=&quot;syncthing-on-a-lan&quot;&gt;Syncthing on a LAN&lt;&#x2F;h2&gt;
&lt;p&gt;Allowing Syncthing through the firewall enables sync between devices on a Local network (LAN) directly,
instead of having to make roundtrips to Syncthing&#x27;s Discovery servers.&lt;&#x2F;p&gt;
&lt;figure class=&quot;diagram&quot;&gt;
&lt;svg role=&quot;img&quot; aria-label=&quot;Laptop and Cellphone sync directly over LAN WiFi; the LAN WiFi also reaches the Discovery server&quot; width=&quot;318pt&quot; height=&quot;188pt&quot; viewBox=&quot;0.00 0.00 318.24 188.00&quot; xmlns=&quot;http:&#x2F;&#x2F;www.w3.org&#x2F;2000&#x2F;svg&quot; xmlns:xlink=&quot;http:&#x2F;&#x2F;www.w3.org&#x2F;1999&#x2F;xlink&quot;&gt;
&lt;g id=&quot;graph0&quot; class=&quot;graph&quot; transform=&quot;scale(1 1) rotate(0) translate(4 184)&quot;&gt;
&lt;polygon fill=&quot;none&quot; stroke=&quot;transparent&quot; points=&quot;-4,4 -4,-184 314.24,-184 314.24,4 -4,4&quot;&#x2F;&gt;
&lt;g id=&quot;node1&quot; class=&quot;node&quot;&gt;&lt;ellipse fill=&quot;none&quot; stroke=&quot;currentColor&quot; cx=&quot;57.19&quot; cy=&quot;-162&quot; rx=&quot;42.79&quot; ry=&quot;18&quot;&#x2F;&gt;
&lt;text text-anchor=&quot;middle&quot; x=&quot;57.19&quot; y=&quot;-158.3&quot; font-family=&quot;Times,serif&quot; font-size=&quot;14.00&quot;&gt;Laptop&lt;&#x2F;text&gt;&lt;&#x2F;g&gt;
&lt;g id=&quot;node2&quot; class=&quot;node&quot;&gt;&lt;ellipse fill=&quot;none&quot; stroke=&quot;currentColor&quot; cx=&quot;57.19&quot; cy=&quot;-90&quot; rx=&quot;55.49&quot; ry=&quot;18&quot;&#x2F;&gt;
&lt;text text-anchor=&quot;middle&quot; x=&quot;57.19&quot; y=&quot;-86.3&quot; font-family=&quot;Times,serif&quot; font-size=&quot;14.00&quot;&gt;LAN WiFi&lt;&#x2F;text&gt;&lt;&#x2F;g&gt;
&lt;g id=&quot;edge1&quot; class=&quot;edge&quot;&gt;&lt;path fill=&quot;none&quot; stroke=&quot;currentColor&quot; d=&quot;M51.32,-144.05C50.5,-136.35 50.26,-127.03 50.59,-118.36&quot;&#x2F;&gt;
&lt;polygon fill=&quot;currentColor&quot; stroke=&quot;currentColor&quot; points=&quot;54.09,-118.49 51.28,-108.28 47.11,-118.01 54.09,-118.49&quot;&#x2F;&gt;&lt;&#x2F;g&gt;
&lt;g id=&quot;edge4&quot; class=&quot;edge&quot;&gt;&lt;path fill=&quot;none&quot; stroke=&quot;currentColor&quot; d=&quot;M63.11,-108.28C63.91,-116.03 64.14,-125.36 63.79,-134.01&quot;&#x2F;&gt;
&lt;polygon fill=&quot;currentColor&quot; stroke=&quot;currentColor&quot; points=&quot;60.29,-133.83 63.07,-144.05 67.27,-134.33 60.29,-133.83&quot;&#x2F;&gt;&lt;&#x2F;g&gt;
&lt;g id=&quot;node3&quot; class=&quot;node&quot;&gt;&lt;ellipse fill=&quot;none&quot; stroke=&quot;currentColor&quot; cx=&quot;57.19&quot; cy=&quot;-18&quot; rx=&quot;57.39&quot; ry=&quot;18&quot;&#x2F;&gt;
&lt;text text-anchor=&quot;middle&quot; x=&quot;57.19&quot; y=&quot;-14.3&quot; font-family=&quot;Times,serif&quot; font-size=&quot;14.00&quot;&gt;Cellphone&lt;&#x2F;text&gt;&lt;&#x2F;g&gt;
&lt;g id=&quot;edge2&quot; class=&quot;edge&quot;&gt;&lt;path fill=&quot;none&quot; stroke=&quot;currentColor&quot; d=&quot;M51.32,-72.05C50.5,-64.35 50.26,-55.03 50.59,-46.36&quot;&#x2F;&gt;
&lt;polygon fill=&quot;currentColor&quot; stroke=&quot;currentColor&quot; points=&quot;54.09,-46.49 51.28,-36.28 47.11,-46.01 54.09,-46.49&quot;&#x2F;&gt;&lt;&#x2F;g&gt;
&lt;g id=&quot;node4&quot; class=&quot;node&quot;&gt;&lt;ellipse fill=&quot;none&quot; stroke=&quot;currentColor&quot; cx=&quot;221.19&quot; cy=&quot;-18&quot; rx=&quot;89.08&quot; ry=&quot;18&quot;&#x2F;&gt;
&lt;text text-anchor=&quot;middle&quot; x=&quot;221.19&quot; y=&quot;-14.3&quot; font-family=&quot;Times,serif&quot; font-size=&quot;14.00&quot;&gt;Discovery server&lt;&#x2F;text&gt;&lt;&#x2F;g&gt;
&lt;g id=&quot;edge5&quot; class=&quot;edge&quot;&gt;&lt;path fill=&quot;none&quot; stroke=&quot;currentColor&quot; d=&quot;M89.6,-75.17C114.15,-64.69 148.2,-50.16 175.51,-38.5&quot;&#x2F;&gt;
&lt;polygon fill=&quot;currentColor&quot; stroke=&quot;currentColor&quot; points=&quot;177.04,-41.65 184.86,-34.51 174.29,-35.21 177.04,-41.65&quot;&#x2F;&gt;&lt;&#x2F;g&gt;
&lt;g id=&quot;edge3&quot; class=&quot;edge&quot;&gt;&lt;path fill=&quot;none&quot; stroke=&quot;currentColor&quot; d=&quot;M63.11,-36.28C63.91,-44.03 64.14,-53.36 63.79,-62.01&quot;&#x2F;&gt;
&lt;polygon fill=&quot;currentColor&quot; stroke=&quot;currentColor&quot; points=&quot;60.29,-61.83 63.07,-72.05 67.27,-62.33 60.29,-61.83&quot;&#x2F;&gt;&lt;&#x2F;g&gt;
&lt;&#x2F;g&gt;
&lt;&#x2F;svg&gt;
&lt;&#x2F;figure&gt;
&lt;h3 id=&quot;linux&quot;&gt;Linux&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;em&gt;Tested on Ubuntu and Raspbian&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Run these in the terminal&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;sudo ufw allow syncthing
sudo ufw allow syncthing-gui
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Verfiy that firewall rules were added&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;sudo ufw status verbose
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;ignore-node-modules&quot;&gt;Ignore Node Modules&lt;&#x2F;h2&gt;
&lt;p&gt;Put these in the folders &lt;code&gt;.stignore&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code&gt;node_modules
**node_modules
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
</description>
      </item>
      <item>
          <title>Running PouchDB Server on Android</title>
          <pubDate>Thu, 25 Jun 2020 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/guide/pouchdb-server-termux/</link>
          <guid>https://lybekk.tech/guide/pouchdb-server-termux/</guid>
          <description xml:base="https://lybekk.tech/guide/pouchdb-server-termux/">&lt;p&gt;&lt;strong&gt;PouchDB Server&lt;&#x2F;strong&gt; is a drop-in replacement for CouchDB, using PouchDB and Node.js. &lt;strong&gt;Termux&lt;&#x2F;strong&gt; is an Android terminal emulator and Linux environment app that works directly with no rooting or setup required.
With the ability to run a linux terminal on Android, we can get a running instance of PouchDB Server on it.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;goal&quot;&gt;Goal&lt;&#x2F;h3&gt;
&lt;p&gt;Having a PouchDB Server running on your Android phone.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;what-you-will-need&quot;&gt;What you will need&lt;&#x2F;h3&gt;
&lt;p&gt;An Android phone with &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;play.google.com&#x2F;store&#x2F;apps&#x2F;details?id=com.termux&amp;amp;hl=en_US&quot;&gt;Termux&lt;&#x2F;a&gt; installed&lt;&#x2F;p&gt;
&lt;h3 id=&quot;instructions&quot;&gt;Instructions&lt;&#x2F;h3&gt;
&lt;p&gt;At the command line in Termux, run the commands below in the following order:&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;pkg install python
pkg install nodejs
npm -g install node-gyp
npm install -g pouchdb-server
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;A ton of warnings and errors may pop up. These can be ignored as long as we get it up and running successfully.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Finally, run:&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;pouchdb-server --sqlite
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If it didn&#x27;t work, install SQLite:&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;pkg install sqlite
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If all goes well, the PouchDB Server admin interface should be available at &lt;code&gt;http:&#x2F;&#x2F;localhost:5984&#x2F;_utils&lt;&#x2F;code&gt;, in any browser on your phone:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;some-finishing-notes&quot;&gt;Some finishing notes&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;At first, PouchDB Server will only be available locally. To enable access from other devices connected to the same network access point, change configuration setting httpd bind_address to 0.0.0.0&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;It starts in admin party-mode (no authentication = open to any one editing.). Be sure to create an admin user if the server is made available on the network to prevent unintended access.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</description>
      </item>
      <item>
          <title>Bash cheatsheet</title>
          <pubDate>Mon, 01 Jun 2020 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/cheatsheet/bash/</link>
          <guid>https://lybekk.tech/cheatsheet/bash/</guid>
          <description xml:base="https://lybekk.tech/cheatsheet/bash/">&lt;h2 id=&quot;find-files-with-grep&quot;&gt;Find files with GREP&lt;&#x2F;h2&gt;
&lt;p&gt;Search for a specific word, phrase or Regex in file contents.&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;# Search for a specific word or phrase in a specific file
grep &amp;quot;word&amp;quot; file.txt

# Same as above, but limiting to one extension&#x2F;suffix
grep &amp;quot;word&amp;quot; *.txt

# or using wildcard to search multiple files
grep &amp;quot;word&amp;quot; *

# As above, while traversing subdirectories
grep -r &amp;quot;word&amp;quot; *
​
# Case-Insensitive search (ignore case)
​    grep -i &amp;quot;word&amp;quot; *
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;read-x-last-lines-from-a-file&quot;&gt;Read x last lines from a file&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;# example
tail -100 &#x2F;var&#x2F;log&#x2F;apache2&#x2F;error.log
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;copy-a-file&quot;&gt;Copy a file&lt;&#x2F;h2&gt;
&lt;p&gt;sudo cp &#x2F;path&#x2F;to&#x2F;source&#x2F;file.txt &#x2F;path&#x2F;for&#x2F;destination&#x2F;file.txt&lt;&#x2F;p&gt;
&lt;h2 id=&quot;recursively-search-for-filename&quot;&gt;Recursively search for filename&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;# Add wildcard &amp;#39;*&amp;#39; on either side where required
find . -name &amp;quot;yourfilename*&amp;quot;

# Case insensitive
find . -iname &amp;quot;yourfilename*&amp;quot;
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;measure-temperature&quot;&gt;Measure temperature&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;# If command is not found, install lm-sensors
sudo apt install lm-sensors

# Then run
sensors
# or
sensors-detect
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;tcptrack&quot;&gt;TCPtrack&lt;&#x2F;h2&gt;
&lt;p&gt;tcptrack displays the status of TCP connections that it sees on a given network interface. tcptrack monitors their state and displays information such as state, source&#x2F;destination addresses and bandwidth usage in a sorted, updated list very much like the top(1) command.&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;# If command is not found, install with
sudo apt install tcptrack

# Assumed network name - wlp2s0 - replace with your own.
sudo tcptrack -r 1 -i wlp2s0
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;securely-erase-replace-free-space-on-disk&quot;&gt;Securely erase&#x2F;replace free space on disk&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;# Example. Replace &amp;#39;Desktop&amp;#39; with desired path
sfill -v Desktop&#x2F;
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;Skip -v for less verbose output&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;permissions&quot;&gt;Permissions&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;change-permissions&quot;&gt;Change permissions&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;# Change owner user and group on a directory or file
chown yourusername:yourgroup &amp;lt;directory or file&amp;gt;

# Make a file editable for owner and group
chmod 774 file.txt
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h3 id=&quot;find-files-not-owned-by-user&quot;&gt;Find files not owned by user&lt;&#x2F;h3&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;sudo find ~yourusername&#x2F; \! -user yourusername -print
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;measure-wireless-wifi-wlan-signal-quality-and-strength&quot;&gt;Measure wireless (WiFi&#x2F;WLAN) signal quality and strength&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;iwconfig

# Output example
wlp2s0  IEEE 802.11  ESSID:&amp;quot;Network Name&amp;quot;
        Mode:Managed  Frequency:2.472 GHz  Access Point: 1D:B7:2C:37:0F:D0
        Bit Rate=144.4 Mb&#x2F;s   Tx-Power=22 dBm
        Retry short limit:7   RTS thr:off   Fragment thr:off
        Power Management:on
        Link Quality=53&#x2F;70  Signal level=-57 dBm
        Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
        Tx excessive retries:0  Invalid misc:991   Missed beacon:0
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;Look for &lt;code&gt;Signal level&lt;&#x2F;code&gt;, this example outputs -57dbm, a good signal. Not excellent, but good.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;count-words-in-a-plain-text-file&quot;&gt;Count words in a plain text file&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;cat filename.txt | xargs -n1 | sort | uniq -c &amp;gt; newfilename.txt
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;diff-find-differences-between-two-folders&quot;&gt;Diff - Find differences between two folders&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;diff -r dir1 dir2 | grep dir1 | awk &amp;#39;{print $4}&amp;#39; &amp;gt; difference1.txt
# For skipping pipe output to file
diff -rq dir1 dir2
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;du-disk-usage&quot;&gt;DU (disk usage)&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;find-the-biggest-files-in-a-directory-and-subdirs&quot;&gt;Find the biggest files in a directory (and subdirs)&lt;&#x2F;h3&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;du -Sh | sort -rh | head -20
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h3 id=&quot;directory-size&quot;&gt;Directory size&lt;&#x2F;h3&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;du -sh *
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
</description>
      </item>
      <item>
          <title>Couchbase cheatsheet</title>
          <pubDate>Mon, 01 Jun 2020 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/cheatsheet/couchbase/</link>
          <guid>https://lybekk.tech/cheatsheet/couchbase/</guid>
          <description xml:base="https://lybekk.tech/cheatsheet/couchbase/">&lt;h2 id=&quot;couchbase-server&quot;&gt;Couchbase Server&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;starting-stopping&quot;&gt;Starting &amp;amp; stopping&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;linux-ubuntu-debian&quot;&gt;Linux (Ubuntu&#x2F;Debian)&lt;&#x2F;h4&gt;
&lt;p&gt;In a terminal&#x2F;console&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;shell&quot;&gt;sudo systemctl start couchbase-server
sudo systemctl stop couchbase-server
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h4 id=&quot;powershell-windows&quot;&gt;Powershell (Windows)&lt;&#x2F;h4&gt;
&lt;pre&gt;&lt;code data-lang=&quot;shell&quot;&gt;Stop-Service &amp;quot;CouchbaseServer&amp;quot; -PassThru
Start-Service &amp;quot;CouchbaseServer&amp;quot; -PassThru

# OR

Restart-Service &amp;quot;CouchbaseServer&amp;quot; -PassThru
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;The -PassThru flag can be omitted. It just makes the console wait for the result before returning control of the console.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;windows-cmd&quot;&gt;Windows CMD&lt;&#x2F;h4&gt;
&lt;pre&gt;&lt;code data-lang=&quot;shell&quot;&gt;net stop CouchbaseServer
net start CouchbaseServer
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h3 id=&quot;adjusting-stats-collection&quot;&gt;Adjusting stats collection&lt;&#x2F;h3&gt;
&lt;p&gt;Log in as root or use sudo to change the Couchbase Server static configuration, which is located at: &#x2F;opt&#x2F;couchbase&#x2F;etc&#x2F;couchbase&#x2F;static_config by default.&lt;&#x2F;p&gt;
&lt;p&gt;Add the parameter grab_stats_every_n_ticks, 10, where 10 is the number of ticks. In the Couchbase Server environment, one tick is one second (default). It is recommended that the statistics collection be more frequent (and accurate). However, assign an appropriate tick value for your environment.&lt;&#x2F;p&gt;
&lt;p&gt;Restart the Couchbase Server service.&lt;&#x2F;p&gt;
&lt;p&gt;After restarting the Couchbase service, the statistics collection rate is changed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;couchbase-sync-gateway&quot;&gt;Couchbase Sync Gateway&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;starting-stopping-1&quot;&gt;Starting &amp;amp; stopping&lt;&#x2F;h3&gt;
&lt;pre&gt;&lt;code data-lang=&quot;shell&quot;&gt;sudo service sync_gateway start
sudo service sync_gateway stop
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h3 id=&quot;adding-users&quot;&gt;Adding users&lt;&#x2F;h3&gt;
&lt;p&gt;This will add a normal user (I.E. not admin).&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;shell&quot;&gt;curl -vX POST &amp;quot;http:&#x2F;&#x2F;localhost:4985&#x2F;mydatabase&#x2F;_user&#x2F;&amp;quot; \
-H &amp;quot;accept: application&#x2F;json&amp;quot; \
-H &amp;quot;Content-Type: application&#x2F;json&amp;quot; \
-d &amp;#39;{&amp;quot;name&amp;quot;: &amp;quot;user&amp;quot;, &amp;quot;password&amp;quot;: &amp;quot;&amp;lt;password&amp;gt;&amp;quot;}&amp;#39;
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;Users will get synced towards a connected instance of Couchbase Server&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
</description>
      </item>
      <item>
          <title>Kate</title>
          <pubDate>Mon, 01 Jun 2020 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/cheatsheet/kate/</link>
          <guid>https://lybekk.tech/cheatsheet/kate/</guid>
          <description xml:base="https://lybekk.tech/cheatsheet/kate/">&lt;h2 id=&quot;fixing-kate-s-save-session-bug&quot;&gt;Fixing Kate&#x27;s &#x27;save session&#x27; bug&lt;&#x2F;h2&gt;
&lt;p&gt;If Kate is not saving sessions&lt;&#x2F;p&gt;
&lt;p&gt;Make sure the active user own all files under &lt;code&gt;.kde&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;shell&quot;&gt;sudo chown -R username:username &#x2F;home&#x2F;username&#x2F;.kde
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Open ~&#x2F;.kde&#x2F;share&#x2F;config&#x2F;katerc and verify if these are in there:&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code&gt;[General] 
Last Session=mysession.katesession 
Restore Window Configuration=true 
Session Exit=save
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: There has been a long outstanding bug where sometimes some of the settings are not properly saved.&lt;&#x2F;p&gt;
</description>
      </item>
      <item>
          <title>Markdown syntax</title>
          <pubDate>Mon, 01 Jun 2020 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/cheatsheet/markdown/</link>
          <guid>https://lybekk.tech/cheatsheet/markdown/</guid>
          <description xml:base="https://lybekk.tech/cheatsheet/markdown/">&lt;h2 id=&quot;markdown&quot;&gt;Markdown&lt;&#x2F;h2&gt;
&lt;p&gt;A more complete list of commonly used Markdown found &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.markdownguide.org&#x2F;basic-syntax&quot;&gt;here&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;definition-list&quot;&gt;Definition List&lt;&#x2F;h2&gt;
&lt;pre&gt;
term
: definition
&lt;&#x2F;pre&gt;
&lt;h3 id=&quot;links-to-headings&quot;&gt;Links to headings&lt;&#x2F;h3&gt;
&lt;p&gt;You can make links to headings based on the heading text, for example:&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code&gt;### My Heading

Lorem ipsum...

[Reference](#my-heading)
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h3 id=&quot;github-specific&quot;&gt;GitHub specific&lt;&#x2F;h3&gt;
&lt;p&gt;In order to create table of contents (TOC) in markdown files on GitHub, put this snippet anywhere you would want a TOC to be generated:&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code&gt;* TOC
{:toc}
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
</description>
      </item>
      <item>
          <title>Apache HTTP Server cheatsheet</title>
          <pubDate>Wed, 29 May 2019 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/cheatsheet/apache-http-server/</link>
          <guid>https://lybekk.tech/cheatsheet/apache-http-server/</guid>
          <description xml:base="https://lybekk.tech/cheatsheet/apache-http-server/">&lt;h2 id=&quot;config-file-location&quot;&gt;Config file location&lt;&#x2F;h2&gt;
&lt;p&gt;In Debian&#x2F;Ubuntu distros:
&lt;code&gt;&#x2F;etc&#x2F;apache2&#x2F;apache2.conf&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;error-log-location&quot;&gt;Error log location&lt;&#x2F;h2&gt;
&lt;p&gt;Debian&#x2F;Ubuntu:
&lt;code&gt;&#x2F;var&#x2F;log&#x2F;apache2&#x2F;error.log&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;restarting&quot;&gt;Restarting&lt;&#x2F;h2&gt;
&lt;pre&gt;&lt;code data-lang=&quot;shell&quot;&gt;sudo service apache2 restart

# If that doesn&amp;#39;t work, try this:
sudo systemctl restart apache2
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
</description>
      </item>
      <item>
          <title>Termux cheatsheet</title>
          <pubDate>Wed, 29 May 2019 00:00:00 +0000</pubDate>
          <author>Christoffer Lybekk</author>
          <link>https://lybekk.tech/cheatsheet/termux/</link>
          <guid>https://lybekk.tech/cheatsheet/termux/</guid>
          <description xml:base="https://lybekk.tech/cheatsheet/termux/">&lt;h2 id=&quot;termux-mariadb&quot;&gt;Termux &amp;amp; MariaDB&lt;&#x2F;h2&gt;
&lt;p&gt;How to run MariaDB, a drop-in alternative to MySQL, on Termux&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;# Install MariaDB
pkg mariadb

# Run this multi-line command
cd &amp;#39;&#x2F;data&#x2F;data&#x2F;com.termux&#x2F;files&#x2F;usr&amp;#39; ; \ 
&#x2F;data&#x2F;data&#x2F;com.termux&#x2F;files&#x2F;usr&#x2F;bin&#x2F;mysqld_safe \ 
--datadir=&amp;#39;&#x2F;data&#x2F;data&#x2F;com.termux&#x2F;files&#x2F;usr&#x2F;var&#x2F;lib&#x2F;mysql&amp;#39;
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;open-files-from-within-termux&quot;&gt;Open files from within Termux&lt;&#x2F;h2&gt;
&lt;p&gt;Open a file reachable by Termux, and view it in any Android app. I.E. send a file by email or view&#x2F;edit an image in an editor.&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;shell&quot;&gt;termux-open file.jpg
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This will request the &quot;open in&quot; prompt.
Handy for viewing images, PDF or any other file format not viewable in a terminal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;postgresql&quot;&gt;PostgreSQL&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;troubleshooting&quot;&gt;Troubleshooting&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;em&gt;Problem&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;After installation, on database initialization PostgreSQL server is unable to start.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;when running &lt;code&gt;$ initdb&lt;&#x2F;code&gt; the following exception is raised&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;samp&gt;
CANNOT LINK EXECUTABLE &quot;&#x2F;data&#x2F;data&#x2F;com.termux&#x2F;files&#x2F;usr&#x2F;bin&#x2F;postgres&quot;: library &quot;libicui18n.so.67&quot; not found no data was returned by command &quot;&quot;&#x2F;data&#x2F;data&#x2F;com.termux&#x2F;files&#x2F;usr&#x2F;bin&#x2F;postgres&quot; -V&quot; initdb: error: The program &quot;postgres&quot; is needed by initdb but was not found in the same directory as &quot;&#x2F;data&#x2F;data&#x2F;com.termux&#x2F;files&#x2F;usr&#x2F;bin&#x2F;initdb&quot;. Check your installation.
&lt;&#x2F;samp&gt;
&lt;p&gt;&lt;em&gt;Solution&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;pkg upgrade&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;python&quot;&gt;Python&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;troubleshooting-1&quot;&gt;Troubleshooting&lt;&#x2F;h3&gt;
&lt;p&gt;If matplotlib fails to install:
&lt;code&gt;pip3 install wheel&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Jupyter Notebook&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;shell&quot;&gt;pkg install libzmq

pip3 install jupyter
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
</description>
      </item>
    </channel>
</rss>
