Skip to content

Instantly share code, notes, and snippets.

View bitroniq's full-sized avatar

Piotr Kowalski bitroniq

View GitHub Profile
@bitroniq
bitroniq / openssl-commands.md
Created February 27, 2023 14:10
OpenSSL Commands

OpenSSL 🔐

Install

Install the OpenSSL on Debian based systems

sudo apt-get install openssl
@bitroniq
bitroniq / Converting-multi-line-PEM-file-to-single-line-string.md
Last active February 27, 2023 14:09
Converting multi line PEM file to single line string
  1. Generate private key
openssl genrsa -out privatekey.pem 1024
Generating RSA private key, 1024 bit long modulus (2 primes)
......................+++++
....................+++++
e is 65537 (0x010001)
@bitroniq
bitroniq / bash-colors-template-script.sh
Last active April 10, 2024 13:57
Bash Colors Script Template
#!/bin/bash
################################################################################
#
# Helper variables to print text using some colors.
#
################################################################################
# Restore to default colours
RESTORE='\033[0m'
@bitroniq
bitroniq / JQ-filter-grep-JSON-by-value.md
Created October 18, 2022 10:49
JQ grep or filter JSON by value

JQ to filter JSON by value

Syntax: cat <filename> | jq -c '.[] | select( .<key> | contains("<value>"))'

Example: To get json record having _id equal 611

cat my.json | jq -c '.[] | select( ._id | contains(611))'

Remember: if JSON value has no double quotes (eg. for numeric) to do not supply in filter i.e. in contains(611)

log-shipping-api

Snippets for interview

@bitroniq
bitroniq / speetest-cli-graph.sh
Created June 28, 2022 14:53
speedtest-cli with interval
#!/bin/bash
while true; do speedtest-cli --csv; sleep 300; done
## Example
## 47590,Telewizja Kablowa SMNT,Nowy Tomyśl,2022-06-28T14:39:25.018280Z,147.92933777800633,18.491,214250762.91277993,182789875.8979877,,185.49.31.123
## speedtest-cli --csv --csv-header
## Server ID,Sponsor,Server Name,Timestamp,Distance,Ping,Download,Upload,Share,IP Address
while true; do speedtest-cli --simple | tr '\n' ' ' | ts ; echo "" ; done
# Jun 28 16:47:33 Ping: 18.361 ms Download: 255.12 Mbit/s Upload: 190.35 Mbit/s
# Jun 28 16:47:52 Ping: 20.787 ms Download: 250.77 Mbit/s Upload: 172.12 Mbit/s
@bitroniq
bitroniq / foldable-makrdown-example.md
Last active May 12, 2022 18:38
Foldable Markdown example

A collapsible section containing markdown

Click to expand!

Heading

  1. A numbered
  2. list
    • With some
  • Sub bullets

Looking to create a Software RAID 1 setup for your 2-disk server on Ubuntu Server 20.04?

Screen Shot 2020-06-05 at 20 55 31

Let's start with the basics: the official guide by Ubuntu (https://ubuntu.com/server/docs/install/storage) is outdated/wrong. And as of March 2021 it's possible that there's a bug as well with how the bios_grub partitions are created when using multiple disks.

Now on to the solution:

  • Select "Custom storage layout" when you reach the storage configuration step of the installer.
  • If the disks have existing partitions, click on each disk under AVAILABLE DEVICES and then select REFORMAT. This will (temporarily) wipe out the partitions.
@bitroniq
bitroniq / tcpdump-cheat-sheet.md
Created November 30, 2021 17:47
tcpdump cheat sheet

Tcpdump

Tcpdump is a commandline tool that is used to dump traffic on a network. This tool comes in hand when you want to analyse network captures within the command line. Basically it can do most of the wireshark job.

NOTE This guide might not be complete it just serve as a reference to me.

Additional Note & Reference