How to hide pictures in your Android Gallery

TLDR: Create a file called .nomedia in the directory of which pictures you don’t want to see in you Gallery app.

I have a lot of ebooks on my phone, it syncs the page status with my ereader so when my wife and me go shopping, I can just join the ‘dad section’ of whatever store we’re at and dive back in to my book(s)

But having so much e books means that they all appear when I scroll through my pictures.., especially since they are all located in separate folders per author and per book (yay for ordering!)

Unfortunately so much folders mean that each folder is individually shown in the gallery app when browsing pics. Adding a file called .nomedia means it hides all pics from the gallery from that folder (and it’s subfolders!)

Slow NFS speed on TrueNAS Scale using ZFS dataset

TLDR

Accept possible data loss and disable SYNC on the dataset in TrueNAS Scale.

Log in to TrueNAS Scale, navigate to Datasets, select the Dataset which is performing badly. Edit Dataset Details and disable SYNC.

Seriously; Think about if it is bad for you to lose data when power loss occurs. Because you will lose writes in that case.

My use case is reading big files remotely, thus I value performance over potential data loss.

docker bind address already in use

Perhaps you’ve been playing with docker-compose, and you run into this error

docker bind address already in use

In my case I was editing my docker compose file, and removed a service before I ran docker-compose down. This meant the service was still running as docker-compose down did not bring down that specific service. In turn the port remained in use.

Solution

docker-compose down --remove-orphans

ZOMG, suddenly I remembered I indeed started those services, I iz dumbass.

Linux command line task management with jobs, BG, FG and nohup – multitasking

Often I see people waiting while their command is executing, impatiently tapping their desk until a file copy or command has finished.

They are often amazed when I show them that the Linux command line has a way of sending pending commands to the background, so you can continue on another task.

Below is a gif screencast which shows:

Continue reading “Linux command line task management with jobs, BG, FG and nohup – multitasking”

VMWare Hardware Virtualization is not a feature of the CPU HP Proliant Microserver Gen10 Plus v2

For a while I’ve been postponing enabling Virtualization on my new microserver. But this weekend my wife was visiting her parents and I already watched all the series I wanted to, so no more procrastination!

Yet when I started, my HP Proliant Microserver showed this warning during the installation of VMWare ESXi VSphere:

<HARDWARE_VIRTUALIZATION WARNING: Hardware Virtualization is not a feature of the CPU, or is not enabled in the BIOS>

I ignored it, hoping for the best, but when I tried to power on a VM a similar message popped up:

Failed – This host supports Intel VT-x, but Intel VT-x is restricted. Intel VT-x might be restricted because ‘trusted execution’ has been enabled in the BIOS/firmware settings or because the host has not been power-cycled since changing this setting.

FIX: disable trusted execution (Intel TXT) in the Microserver BIOS

Follow these steps:

  1. Enter BIOS (F9 during boot)
  2. Enter menu option System Configuration

  3. Enter BIOS/Platform Configuration (RBSU)

  4. Enter Server Security
  5. Disable Microsoft (R) Secured-core Support
  6. Enter Intel Security Options and disable Intel(R) TXT Support
  7. Enter Virtualization Options and make sure Intel(R) Virtualization Technology, Intel(R) VT-d and Access Control Service are enabled

Disclaimer

Now you should know I just enabled and disabled these option based on reddit and Stackoverflow posts, and since nothing production like is running on this node I’m fine if I might have missed some steps or perhaps enabled too much. Basically I’m saying; You are responsible for your own server 🙂 Check with a professional if your node is running more important tasks.

Yet if I made a booboo somewhere, I would appreciate if you would please let me know and I’ll update the post accordingly.

File won’t download from Microsoft Teams

My colleague and me wanted to share a 50MB zip file via Teams. Which looked fine, but MS Teams application would not do anything when I tried to download it.

I tried several things, opening the same location in Sharepoint, moving it to OneDrive, etc. but in the end the following worked for me:

  • Open MS teams in a browser (URL for convenience: https://teams.microsoft.com/)
  • Open the same chat in which the file was shared
  • Go to the Files tab
  • Download the file

I’m not sure why Teams app would not download, but atleast this worked for me.

Happy “Not trying to use USB sticks ever again” day to you all!

Log as well as see error and standard output in Linux Terminal

Quick snippet, as I was searching for this one today.

You can output both standard and error output to both screen and log file with the below command:

my_command.sh 2>&1 | tee my_command.log

Explanation:

  • my_command.sh
    • replace with your command (possibly including arguments)
  • 2>&1
    • redirects standard error to standard output, otherwise only standard output is written to file
  • | tee
    • my_command.log pipes the output to tee, which writes both to screen and file

Simple http API backend for testing purpose using docker/kubernetes

At work we are responsible for an API Gateway offering. Testing of that API gateway is often done by using an API backend. This post shows how to create a static API backend to which you can easily add responses.

While looking for solutions I did not want to maintain another image, so I tried using an existing image and add config to mold it into something we can use.

I’m going to show both docker-compose and kubernetes yaml, as I’ve used both for testing.

Note: Create a local directory html for static files. These files contain the ‘responses’ for the backend.

Big thanks to my colleague Mahesh, who showed me a lot of cool tricks with K8s and OpenShift! Not only that, he helps me a lot with my simple questions and it’s been a lot of fun to figure out our (work related) challenges!
If you’d like then take a look at his blog over here: Mahesh Chinthaka – Medium

Setup

First up is the docker compose file which we can use for testing our backend locally. This file was the basis forwhat I converted to the k8s yamls.

Docker compose

version: '3.8'

services:
  nginxbackend:
    image: nginxinc/nginx-unprivileged
    container_name: nginxapibackend

    ports:
      - "8080:8080/tcp"
    volumes:
      - ./html:/usr/share/nginx/html
    restart: unless-stopped

Run docker compose up -d to start the nginx backend.

You can test the backend by opening this endpoint in your browser:

http://localhost:8080/yourfile.json

Note that yourfile.json should be present in the html directory

Kubernetes

Note: I’m not going to expose the NGINX backend outside of our namespace as I only want it accessible from the API Gateway, which resides in the same namespace.

If you want to test the backend, use docker or change the service to your liking.

The setup changes slightly because I don’t want to use local storage in my kubernetes cluster. In this setup I am using configmaps for the static response files.

K8s step 1: Create the configmap

kubectl create configmap nginxhtml --from-file=./html/

In the next steps we’ll mount the configmap for use in the pod.

K8s step 2: Create the deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: nginxapibackend
  name: nginxapibackend
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginxapibackend
  strategy: {}
  template:
    metadata:
      labels:
        app: nginxapibackend
    spec:
      containers:
      - image: nginxinc/nginx-unprivileged
        name: nginx
        volumeMounts:
          - name: nginxhtml
            mountPath: /usr/share/nginx/html
        ports:
          - containerPort: 8080
      volumes:
        - name: nginxhtml
          configMap:
            name: nginxhtml

Create the service

apiVersion: v1
kind: Service
metadata:
  name: nginxapibackend-service
  namespace: apim-dev
spec:
  selector:
    app: nginxapibackend
  ports:
    - protocol: TCP
      port: 8080
      targetPort: 8080

Extra; Update the HTML configmap in kubernetes

You cannot update a configmap, so delete the current one and create a new one. Then recreate your pod so it uses the updated html directory.

kubectl delete configmap nginxhtml
kubectl create configmap nginxhtml --from-file=./html/
kubectl delete pod nginxapibackend-abcdefghij-abcde

Run a quick interactive shell in kubernetes for testing purposes

Today I wanted to check some stuff on a pod running in my local kubernetes cluster. I’m still getting used to Kubernetes, thus didn’t want something ugly like exposing that pod.

The easiest way of doing it for me has been to spin up a temporary pod using Ubuntu;

kubectl run myshell --rm -i --tty --image ubuntu -- /bin/bash

Now you can do whatever you want in the pod and when you log out of myshell, it’ll be removed immediately and we’re back to square one! <3