How to do a HTTP request from terminal

A quick tip for use in terminal:

# print string auth 
echo -n "dummyuser:MyPassword" | base64

# Unix terminal (basic auth, doing http request with GET method)

curl -X GET \
  -H "Content-Type: text/xml" \
  -H "Authorization: Basic ZHVtbXl1c2VyOk15UGFzc3dvcmQ=" \
  "http://dummyserver:5000/dir/wsdl?p=ic/6e7abd99891231jij123ndb769978566c470"


# Unix terminal (basic auth, doing http request with POST method to send payload from file)

curl -X POST \
  -H "Content-Type: application/soap+xml" \
  -H "Authorization: Basic ZHVtbXl1c2VyOk15UGFzc3dvcmQ=" \
  -d @./request.xml \
  "https://dummyserver:50001/XISOAPAdapter/MessageServlet?senderParty=&senderService=SYS_LEGACY&receiverParty=&receiverService=&interface=BookingFlight_Out&interfaceNamespace=http://LGCY/namespace"


# Unix terminal (basic auth, doing http request with POST method)

curl -X POST \
  -H "Content-Type: text/xml" \
  -H "Authorization: Basic ZHVtbXl1c2VyOk15UGFzc3dvcmQ=" \
  -d "<soapenv:Envelope>....ommited lines </soapenv:Envelope>" \
  "https://dummyserver:50001/XISOAPAdapter/MessageServlet?senderParty=&senderService=SYS_LEGACY&receiverParty=&receiverService=&interface=BookingFlight_Out&interfaceNamespace=http://LGCY/namespace"



# Windows Powershell (basic auth, doing http request with GET method)

$Username = "dummyuser"
$Password = ConvertTo-SecureString "MyPassword" -AsPlainText -Force
$Credential = New-Object System.Management.Automation.PSCredential ($Username, $Password)

Invoke-RestMethod -Uri "http://dummyserver:5000/dir/wsdl?p=ic/6e7abd99891231jij123ndb769978566c470" -Method GET -Credential $Credential


# Windows Powershell (basic auth, doing http request with POST method to send payload from file)
 
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("dummyuser:MyPassword"))
$headers = @{
    Authorization = "Basic $base64AuthInfo"
    "Content-Type" = "text/xml"
}

Invoke-RestMethod -Uri "https://dummyserver:50001/XISOAPAdapter/MessageServlet?senderParty=&senderService=SYS_LEGACY&receiverParty=&receiverService=&interface=BookingFlight_Out&interfaceNamespace=http://LGCY/namespace" -Method Post -Headers $headers -Body (Get-Content -Path "request.xml" -Raw)

Bye!

Sonarqube running in Podman containers

This is a quick entry to show how to run sonarqube using Podman. Please note that I’m using windows powershell.

First, create the next directory structure and add the following SQL script into sql directory:

\SONARQUBE
\---sql
    init-dabase.sql

Script content:

-- Creating db user and database for sonarqube

CREATE USER mysonaruser PASSWORD 'mypassword';
CREATE DATABASE sonarqube OWNER mysonaruser;

Open that directory into the terminal, download the images from docker repository and create the volumes.

# Download images

podman pull postgres:15.4
podman pull sonarqube:9.9.2-community

# Create volumes

podman volume create sonarqube_data
podman volume create sonarqube_logs
podman volume create sonarqube_extensions
podman volume create postgres-data

There are two ways to run the containers, creating a network or run in the same pod, please choose only one of the next.

Seguir leyendo

GNOME, creating Dynamic Wallpapers

This is a quick entry, there are two kind of Dynamic wallpapers for gnome:

  • Dynamic wallpaper changed by choosen theme (light/dark)
  • Dynamic wallpaper changed by defined time transition

It can easily identify each one, the first have a preview with the both backgrouns (light and dark), the second have a clock icon at the bottom left corner:

They can be created using the next tools, installed from flathub.

Dynamic Wallpaper

https://flathub.org/apps/me.dusansimic.DynamicWallpaper

Dynamic Wallpaper Editor

https://flathub.org/apps/com.github.maoschanz.DynamicWallpaperEditor

Or if you prefer, you could create and edit the files manually from the next locations:

# Only for the actual user

## path to user xml definition of the background
~/.local/share/gnome-background-properties

## path to user backgrounds directory with xml definition for transitions
~/.local/share/backgrounds

# For all users

## path to system xml definition of the background
/usr/share/gnome-background-properties/

## path to system backgrounds directory with xml definition for transitions
/usr/share/backgrounds/Dynamic_Wallpapers/

Thats all, enjoy =D!

Quod Libet another music player for linux

I have been testing some alternative music players in linux, in my recent entry I talked about g4music and their clean and responsive user interface, but I miss a playlist feature on it. Well in this entry I’m going to share another player with some additional features that I have use frecuently like, id tag and playlist editor, and its very flexible to organize my music library. BUT the UI is more like the old school applications, but I consider that it has a good set of features.

«Quod Libet is a GTK+-based audio player written in Python, using the Mutagen tagging library. It’s designed around the idea that you know how to organize your music better than we do. It lets you make playlists based on regular expressions (don’t worry, regular searches work too). It lets you display and edit any tags you want in the file, for all the file formats it supports.

Unlike some, Quod Libet will scale to libraries with tens of thousands of songs. It also supports most of the features you’d expect from a modern media player.«

Seguir leyendo

Fedora, move user home directory to another partition

This is a quick entry, after mount a new encrypted partition, I have to move my default home directory to this new partition. The easy way to do that is using the next command (as super user).

$ usermod -m -d /path/to/new/home/dir userNameHere

Where:

-m, --move-home, Move the content of the user's home directory to the new location.

-d, --home HOME_DIR, The user's new login directory.

It could takes some minutes to complete but it depends of the size of your data, in my case took 5 mins to move arround of 90 GB.

Seguir leyendo

g4music an open source music player for gnome

Since six years ago, I have been using youtube music (previously named Google Play Music), and each time I have felt the influence of the algorithm more and more when it shows me some recommendations, sometimes it was fine, but I really miss the simplicity to listen to my music without depend from the streaming service.

So then I have decided to use an offline music player and I choosed g4music, it is «a beautiful, fast, fluent, light weight music player written in GTK4» and I really like it.

I have been using it a lot the last few days and I remembered how I felt to manage and play my music library with no internet connection and it is really enjoyable.

It can be installed from flathub:

# Install

flatpak install flathub com.github.neithern.g4music

# Run

flatpak run com.github.neithern.g4music

Here are some features that I’ve noticed.

Seguir leyendo

Fedora, connect to wifi using the console (nmcli)

This is a quick tip for my notes, Network Management Command-Line Interface (nmcli) is a tool for managing the NetworkManager application and reporting on the status of the network.

A complete list of commands can be readed here. These are some them:

# List available access points(AP) to connect to

nmcli device wifi list

# Create a new connection to an open AP

nmcli device wifi connect <SSID|BSSID>

# Create a new connection to a password protected AP

nmcli device wifi connect <SSID|BSSID> password <password>

# List available devices and their status

nmcli device status

References

Fedora, device encryption using dm-crypt/LUKS

According to the fedora documentation:

«Block device encryption encrypts/decrypts the data transparently as it is written/read from block devices, the underlying block device sees only encrypted data.

To mount encrypted block devices the sysadmin (or user, depending on context) must provide a passphrase to activate the decryption key.

Encryption provides additional security beyond existing OS security mechanisms in that it protects the device’s contents even if it has been physically removed from the system. Some systems require the encryption key to be the same as for decryption, and other systems require a specific key for encryption and specific second key for enabling decryption.«

What LUKS means?

LUKS (Linux Unified Key Setup) is a specification for block device encryption. It establishes an on-disk format for the data, as well as a passphrase/key management policy.

So, In this entry I’m going to show how I enabled for one partition my disk.

Seguir leyendo

Onedrive client for Linux (an alternative)

One of the applications that I’ve used the most in the recent years is the Onedrive to sync my files to the cloud, and recently I found an excellent alternative for linux named onedriver.

This is an open source software that allows the access to your files directly from Nautilus as local file, according to the project:

«This is not a sync client. Instead of syncing files, onedriver performs an on-demand download of files when your computer attempts to use them. onedriver allows you to use files on OneDrive as if they were files on your local computer.«

This are the main features:

  • Files are only downloaded when you use them
  • Bidirectional sync.
  • Can be used offline
  • Fast
  • Has a user interface
  • Multi account support

And that is exactly what I need.

Seguir leyendo

GNOME 3, a single Mac OS theme on fedora

This is a short entry, I used to prefer the Mac OS for the simplicity of the UI… but I really miss the customizable options in linux, and sometimes I’ve seen most of the people spend time to change the user interface to be similar as Mac OS.

I’ve found this script in github to change all the UI without effort. You can read the instrucions in the readme file and select the UI using the gnome tweaks.

This is a sample of some windows with the theme enabled:

I don’t use this kind of themes but I’ve leave it here if you like this UI. (Actually, I’m using the default fedora theme Adawaita)

See ya =)

References