Tutorials
Golang : Simple file scaning and remove virus example
Just for fun, for this tutorial, we will simulate a simple anti-virus program. Let's create a simple file scanner that….... read more
Golang : Randomly pick an item from a slice/array example
Problem:
You are building a game and you want to randomly pick an item from a slice of URLs. How….... read more
Golang : Get SPF and DMARC from email headers to fight spam
Problem:
You are building an email server with spam filter from scratch with Golang and you want to query a….... read more
Golang : How to determine a prime number?
In mathematics and computer security, it is very important to determine if a given number is a prime number or….... read more
Golang : Delay or limit HTTP requests example
Problem:
For some technical limitation reason, you want to delay or slow down HTTP requests to one of your machines….... read more
Golang: Prevent over writing file with md5 hash
This is an additional note for previous tutorial on how to upload/submit file from command line to a….... read more
Golang : Command line file upload program to server example
Writing this tutorial for a friend who is using Golang to develop her IoT application. She needs a client program….... read more
Golang : How to filter a map's elements for faster lookup
A short tutorial on how to filter map elements. Map is a hash table equivalent in Golang and very useful….... read more
Golang : Identifying Golang HTTP client request
Problem:
You've read about the Mirai DDoS malware that infects IoT devices and turning them into a massive….... read more
Golang : Not able to grep log.Println() output
Problem:
You have a Golang program that uses log.Println()
to capture text output generated by your program and you want….... read more
Golang : Accessing content anonymously with Tor
There are times when we need to access content and do research anonymously. Using Tor(The Onion Router) can be useful….... read more
Golang : How to reverse slice or array elements order
In this short tutorial, we will learn how to reverse the elements order inside a slice or array. Taking the….... read more
Golang : Reverse IP address for reverse DNS lookup example
Problem:
You need to reverse a given IPv4 address into a DNS reverse record form to perform reverse….... read more
Golang : Skip blank/empty lines in CSV file and trim whitespaces example
Problem:
Your Golang program is reading from a CSV file and you want to skip blank lines in the CSV….... read more
Golang : Save map/struct to JSON or XML file
Previous tutorial on converting map/slice/array to JSON or XML format is for output to web via net/http
package.….... read more
Golang : Clean formatting/indenting or pretty print JSON result
Problem:
Your Golang program is producing JSON result in a single line that looks like this :
["apple","orange","durian","pear"]
….... read more Golang : How to convert strange string to JSON with json.MarshalIndent
Problem:
Your database is spewing out a funny looking string that looks like this {"width";800;"height";450}
and you want to map….... read more
Golang : How to convert JSON string to map and slice
Couple of simple examples on how to convert JSON string to map and slice(array).
Simple and straightforward way of converting….... read more