First, i would like to say

This is my first post in english for this blog, so bear with me. I have blogged for two years now, in danish only. I did that because i wanted to find my grounds: what to blog about, where to blog, how to blog. I have been using ghost, but I have switched over to a self-hosted platform:

  1. single node k8s
  2. argocd
  3. gitlab
  4. org
  5. emacs
  6. helm

and I really like it. I have tried to blog about my knowledge about Azure and ARM (for which i have a deep knowledge). I did that as a part of my former work, but I hav since moved to another company, where we use a completly different tech stack: k8s, helm etc (not the reason why i have moved my own blog to this platform) and personally I have switched from using Windows to Linux (more specifically NixOS). Therefore i have also moved domain, from to, because … well. It really fits my way of life: emacs and the shell. Love it. I have used Linux for an extended period of time, before making the switch again (7 years), but I decided to move to Windows because of my education (we were kind of forced because of .NET), but here I am, back in business.

Now, for the pasta business

Firstly you need xclip installed, so install that with your favourite package manager, and hit the terminal. Me myself needed to copy a private ssh key to some place else, and i simply cat it and piped it to xclip

cat ~/.ssh/id_rsa | xclip

Now you can paste it with CTRL+V.

But what about if i just want to copy ceratin lines or a range of lines, you may ask: sed!

If you want to only copy a range of lines, or certain lines, you can use: sed. Sed stands for: stream editor, and it is really funky. I always forget how to use it, but i know some basic stuff, and it comes in handy when i only want to copy some lines, or certain lines.

If i want to know the line numbers, i cat it. On my system, cat is actually an alias to bat. If you haven't installed it, do it. Read more about it here. It shows line numbers. I have a small file that consists of five lines

line 1
line 2
line 3
line 4
line 5

if i needed to copy the first line, i would do cat test.txt | sed -n '1,1p' | xclip, or if i want to copy the second line cat test.txt | sed -n '2,1p' | xclip. Easy! Now, if i wanted to copy line 2, 3 and 4, i would simply do cat test.txt | sed -n '2,4p' | xclip. It tells sed to take between line 2 and 4 and (p)rint it. The other two, with single lines is a bit special: if the first number is equal or bigger than the second number, then it only takes that line. The second example could also be expressed like this: cat test.txt | sed -n '2,2p', but i think it is easier to read "start at 2, and (p)rint 1 (this)". Well, my mind works in mysterious ways.

Read more about sed and range adresses here.

That's all folks! My next post is going to be about integration test with: xunit, docker-compose, ductus and dind (in gitlab). Stay tuned!