Create reverse tunnel with autossh and systemd

Install autossh with sudo apt install autossh Create autossh.service in /etc/systemd/system/ folder The content of autossh.service: [Unit] Description=AutoSSH service for a reverse tunnel from SERVER to localhost # start after DNS ready, but seems no difference with [Service] ExecStart=autossh -M [LOCAL_PORT] -N -D [YOUR_LOCAL_IP]:[LOCAL_PORT] -i [YOUR_PRIVATE_KEY] [REMOTE_USER]@[REMOTE_USERVER] RestartSec=5 Restart=always [Install] Execute… Read More »

Docker Image Cleanup

Here is a bash script to cleanup images on a build server: #!/bin/bash sudo docker image rm -f $(sudo docker image ls | grep ‘your_image_name’ | awk ‘{ print $3 }’) sudo docker images -q -f dangling=true | xargs -r sudo docker rmi -f Hope it helps. 🙂

Bluetooth mouse won’t connect after reboot/sleep on Ubuntu 18.04

System & hardware: OS: Ubuntu 18.04 LTS Mouse: Logitech M337 Symptom: After reboot/sleep, Bluetooth mouse won’t get connected again. Need to remove and pair again to make it work again. Steps to solve this problem: 1. Update bluez. sudo add-apt-repository ppa:bluetooth/bluez sudo apt install bluez 2. Remove paired mouse. (If it is paired before) 3.… Read More »

Open in Visual Studio Code in Finder with Automator

Here’s how to add “Open in Visual Studio Code” in Finder in MacOS: Open Automator. Choose Quick Action. Change Workflow receives current with files and folders, and in with and Path (if you have) Add an action Run Shell Script, enter open -n -b “” –args “$*” And it’s done.  

Category: mac

Display Azure Container Registry as Table

The docker image display of Azure Container Registry is horrible: From the Azure UI, you don’t know the relation of each tag and time. So I wrote a shell script to display it in a table using Azure Cli: The result will be like this: Much nicer. 🙂

Migrate from Vue Cli 2 to 3

Vue Cli 3 is officially released so it’s a great time to upgrade because it brings a bunch of new features like plugin system, hiding the complexity of webpack and the very nice UI for the Cli. It make the Vue development experience even more fun. I spent around 30 mins to migrate an complete… Read More »

Category: vue

Entity Framework Generic Repository

Introduction A generic Entity Framework repository pattern implementation. Code Usage Unzip Database\Database.7z, attach to LocalDB, or restore to your favoriate Sql Server instance and change the connection string in App.Config. Open solution and run the application. Base Repository The base repository exists in Common\AbstractRepository.cs, it handles the basic CRUD operations, for example, methods like… Read More »