hakk

software development, devops, and other drivel
Tree lined path

Docs

Golang Listing Directory Contents and Sorting by File Size

Listing the contents of a directory in go and sorting by file size. To get the list of file we will use the ReadDir function from os package. To sort the files we will use the sort package and compare the file sizes to arrange them in ascending or descending order. package main import ( "fmt" "io/ioutil" "log" "os" "sort" ) func SortFileSizeAscend(files []os.FileInfo) { sort.Slice(files, func(i, j int) bool { return files[i]. Read more...

Initial Ubuntu Server Setup

When deploying a new Ubuntu server there are a few steps that should be taken in order to make sure it’s secure. This should provide a fairly secure default setup. However, as more software is added further measures will need to be taken in order to secure the server. Page Nav Bare Metal Installations New User setup Setup Public Key Auth Disable Root login and remove Password Auth Basic UFW setup Setup Fail2Ban Setting up automatic updates Bare Metal Installations Note: It is now an option to install openssh during installation. Read more...