Learning how to code
2023-01-09
If you find yourself doing the same task repeatedly, consider learning how to code.
For instance, a friend of mine had to perform the following tasks on daily basis:
- logging into a internal portal
- selecting certain menus
- exporting some
.xlsxreports - opening various excel files
- clicking on the “Refresh All” button to update external data
- sending an email
Here’s the code that I assisted him with: https://github.com/quantonganh/ims
The initial steps can be done by using chromedp.
Save draft mail in Zimbra web client using ChromeDP
2020-07-03
As an engineer, I want to automate everything as much as possible. This CLI tool is created to save a draft mail in Zimbra web client.
Read config file:
func initConfig() {
if cfgFile != "" {
// Use config file from the flag.
viper.SetConfigFile(cfgFile)
} else {
// Find home directory.
home, err := homedir.Dir()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
// Search config in home directory with name ".zwc" (without extension).
viper.AddConfigPath(home)
viper.SetConfigName(".zwc")
}
viper.AutomaticEnv() // read in environment variables that match
// If a config file is found, read it in.
if err := viper.ReadInConfig(); err != nil {
log.Fatal(err)
}
fmt.Println("Using config file:", viper.ConfigFileUsed())
}
Quan Tong