Using SSH to host a local git repository (simplest way)

I shift laptops and devices a lot, and mounting storage is not ideal between devices. For my use case I decided I liked a git repo the best for document storage (markdown files)

To be able to access that repo I wanted it to be accessible on my server, from my home via SSH. (Remotely I use VPN to my home network to sync)

When searching for remote Git repositories I mostly see paid alternatives or fullblown Git servers being advertised. That is too much functionality for me, and not necessary.

Solution

  1. Create repo on server
  2. Clone repo on client(s) via ssh

These are all that’s necessary, and it’s so much simpler than using Git servers.

1. Create repo (on server)

# connect to your server
ssh yourserver
# change directory to your project
cd /git
# create a git repo
git init --bare notesmygoats.git

2. Clone repo on client(s)

# cd into the directory which will contain your git repo
cd /home/notetaker/documents
#git clone the remote repo
git clone yourserver:/git/notesmegoats.git
Cloning into 'notemegoats'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (3/3), done.

Tips

Use links to create structure

The directory /git/ is a link to a folder in my storage. I like to use links to create logical structure, that’s completely personal though.
If you can SSH into a server, you can use any directory for the git repo, just make sure you replace the clone command with the directory you’re actually using:

git clone yourserver:/home/youruser/mygitrepo

Bare repository

Copied from https://www.atlassian.com/git/tutorials/setting-up-a-repository/git-init

The –bare flag creates a repository that doesn’t have a working directory, making it impossible to edit files and commit changes in that repository. You would create a bare repository to git push and git pull from, but never directly commit to it. Central repositories should always be created as bare repositories because pushing branches to a non-bare repository has the potential to overwrite changes. Think of --bare as a way to mark a repository as a storage facility, as opposed to a development environment. This means that for virtually all Git workflows, the central repository is bare, and developers local repositories are non-bare.

Create fixed width thumbnails with correct orientation from EXIF data for use in NanoGallery2

First off; This is totally a bookmark for myself. But I’d be amazed if it actually helps you, the reader!

I started using a static self-hosted NanoGallery2 for holiday photos, and the thumbnails look better when they are all the same width.

Execute this in the directory where your JPGs reside, all thumbnails have “thumb-” prefixed to their bigger picture counterpart.

 for i in *.JPG; do convert -auto-orient -thumbnail '200x>' $i thumb-$i; done;

Block Samsung Television ads (using ASUS router Firewall with URL Filter)

We switched to a Samsung Serif television last year, and it was not cheap.

But it feels cheap in the way it spawns ads every time we turn it on.

So let’s remove those ads by blocking the ads URL in our ASUS router, this way the television can not retrieve new ads anymore.

  1. Log in to your ASUS router
  2. Navigate to the “Firewall” menu item, located under “Advanced Settings”
  3. Select the second tab “URL Filter”
  4. Make sure the following settings are present;
    1. Enable URL Filter: “Enabled”
    2. Filter Table Type: “Deny List”
    3. URL Filter List:
      1. Add “ads.samsung.com” and click the PLUS button
    4. Click Apply

Important: make sure to choose Filter Table Type “Deny List”, which denies all entries in the list. If you would choose “Allow List” then you could only access the urls in the list and you cannot access any other site, effectively preventing you from accessing the internet from your home network.

 

Read more: ASUS Support FAQ: [Wireless Router] How to set up the URL Filter – Black/White List?(Firewall)

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.