Organize Go project and publish modules

1. Directory structure lrn_package/src/hello/main.go lrn_package/somepackage/somefile.go lrn_package/internal/somefile.go lrn_package_use/src/hello/main.go 2. Programs lrn_package/src/hello/main.go package main import ( "fmt" "github.com/kamisuzuri/lrn_package/somepackage" "github.com/kamisuzuri/lrn_package/internal" ) func AddUpper() func (int) int { var n int = 10 return func (x int) int { n = n + x return n } } func main() { ff := AddUpper() fmt.Println(ff(1)) fmt.Println(ff(2)) fmt.Println(ff(3)) disp.SomeFunction() itnldisp.SomeFunction() } lrn_package/somepackage/somefile.go package disp import "fmt" func SomeFunction() { fmt.Println("This is an public package function") } lrn_package/internal/somefile....

May 20, 2024 Â· 2 min

Webscraping

Sometimes you need to get data for your own purpose or functions extension from the website which provides the data in different way. Data analysis or ML or build your app with data aggrecated from different sites… A lot of use case. But you need to make sure that this behaivior isn’t violate the license agreement, guiding etc. 1. What you need? Python (whatever language is ok. I choose python just because of the Beautiful Soup) Beautiful Soup 4 – This is the tool to extract the data requests – Handle https stuffs Sellenium – handy way to enter sites with login page Google ChromeDriver – needed to work together with Sellenium Browser development menu – read the source to find the target place....

August 13, 2023 Â· 3 min

Host your website on AWS

1. AWS services needed for static website Route53 - Route the request to the CloudFront distribution CloudFront - Frontend point to response from the closest web server S3 - Storage for all of the contents 2. Create S3 Bucket for Configuration the property to set the S3 as Web site Create policy to allow read permission for public { "Version": "2012-10-17", "Statement": [ { "Sid": "PublicReadGetObject", "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::< S3 name >/*" } ] } Remove all of the ‘Block public access (bucket settings)' Edit the ACL permission to allow every one for ‘List’ 3....

July 22, 2023 Â· 3 min

Most Handy Way to Publish Website - Full automation

1. Create a repository in Github Register a Github ID at: https://www.github.com Create a repository in github. For example, ‘my-website-repo’ Find the URL of your my-website-repo in github. You can get it from [Code] button on your repository page. 2. Link your local git to Github git remote add origin [Gitrepo URL] [Git repo URL] is the one you copied from Github. 3. Setup the Visual Studio Code for Git This is optional but highly recommended....

July 20, 2023 Â· 2 min

Build Your Own Web Site

1. What you need? Your own domain name Visual Studio Code (Editor) Github (Contents management) Hugo (Site Generator) Netlify (Web Hosting) 2. Get your own domain name I use a Japan based domain name service. Onamae.com Cost for domain name is from 0 Yen to million Yen ~~~~ 3. Visual Studio Code / Github Please consider the VS Code and Github as set. You can use BitBucket as well but for people who use Hugo, Github is a better choice....

July 20, 2023 Â· 2 min