All microblog

2021

Go R1 Day 28

progress

  • Solved [Hamming Distance] on exercism.io
  • Simple problem, but reminded me of how to use string split.
1
2
3
4
5
6
7
8
9
diffCount := 0
aString := strings.Split(a, "")
bString := strings.Split(b, "")

for i, x := range aString {
  if x != bString[i] {
    diffCount++
  }
}
  • Reviewed other solutions, and found my first attempt to split the string wasn’t necessary. Looks like I can just iterate on the string directly. I skipped this as it failed the first time. The error is: invalid operation: x != b[i] (mismatched types rune and byte).

This threw me for a loop initially, as I’m familar with .NET char datatype.

Golang doesn’t have a char data type. It uses byte and rune to represent character values. The byte data type represents ASCII characters and the rune data type represents a more broader set of Unicode characters that are encoded in UTF-8 format. Go Data Types

Explictly casting the data types solved the error. This would be flexibly for UTF8 special characters.

1
2
3
4
5
for i, x := range a {
  if rune(x) != rune(b[i]) {
    diffCount++
  }
}

With this simple test case, it’s it’s subjective if I’d need rune instead of just the plain ascii byte, so I finalized my solution with byte(x) instead.

1
2
3
4
5
for i, x := range a {
  if byte(x) != byte(b[i]) {
    diffCount++
  }
}

Incremental and Consistent

It’s really hard to prioritize when life gets busy, but it’s important that continued improvement is a priority.

Great at Work: How Top Performers Do Less, Work Better, and Achieve More was a really interesting book. The fact that small incremental improvement done daily can make such a difference is pretty interesting.

It’s similar to Agile tenets in how to approach software design. Smaller iterations with rapid feedback is better than large isolated batches work delivered without regular feedback.

If you find yourself saying, “But I don’t have time” or “When I have some time” it might be indicative of a failure to grasp this. When I catch myself saying this I try to reword it and say “Whenever I make time for this” instead.

You’ll always have pressure on you. The further along in your career and life you go, the more pressure is likely to be on you.

You have to “make” time for improvement and learning if it’s a priority.

Nativefier

Ran across this app, and thought was kinda cool. I’ve had some issues with Chrome apps showing up correctly in certain macOS windows managers to switch context quickly.

Using this tool, you can generate a standalone electron app bundle to run a webpage in as it’s own dedicated window.

It’s cross-platform.

For a site like Azure DevOps, you can run:

1
2
3
4
5
6

$MYORG = 'foo'
$MYPROJECT = 'bar'
$BOARDNAME = 'bored'
nativefier https://dev.azure.com/$MYORG/$MYPROJECT/_boards/board/t/$BOARDNAME/Backlog%20items/?fullScreen=true ~/$BOARDNAME

If redirects for permissions occur due to external links opening, you might have to open the application bundle and edit the url mapping. GitHub Issue #706

1
/Users/$(whoami)/$BOARDNAME/APP-darwin-x64/$BOARDNAME.app/Contents/Resources/app/nativefier.json

Ensure your external urls match the redirect paths that you need such as below. I included the standard oauth redirect locations that Google, Azure DevOps, and Microsoft uses. Add your own such as github to this to have those links open inside the app and not in a new window that fails to recieve the postback.

1
"internalUrls": "(._?contacts\.google\.com._?|._?dev.azure.com_?|._?microsoft.com_?|._?login.microsoftonline.com_?|._?azure.com_?|._?vssps.visualstudio.com._?)",

Go R1 Day 27

progress

  • Iterated through AWS SDK v1 S3 buckets to process IAM policy permissions.
  • Unmarshaled policy doc into struct using Json-To-Struct.

Github Pages Now Supports Private Pages

I’m a huge static site fan (lookup jamstack).

What I’ve historically had a problem with was hosting. For public pages, it’s great.

For private internal docs, it’s been problematic. It’s more servers and access control to manage if you want something for a specific group inside a company to access.

This new update is a big deal for those that want to provide an internal hugo, jekyll, mkdocs, or other static generate based documentation site for their team.

Access control for GitHub Pages - GitHub Changelog

Ensuring Profile Environment Variables Available to Intellij

Open IntelliJ via terminal: open "/Users/$(whoami)/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app"

This will ensure your .profile, .bashrc, and other profile settings that might be loading some default environment variables are available to your IDE. For macOS, you’d have to set in the environment.plist otherwise to ensure they are available to a normal application.

ref: OSX shell environment variables – IDEs Support (IntelliJ Platform) | JetBrains

Leverage Renovate for Easy Dependency Updates

Renovate is a great tool to know about. For Go, you can keep modules updated automatically, but still leverage a pull request review process to allow automated checks to run before allowing the update.

This is particularly useful with Terraform dependencies, which I consider notoriously difficult to keep updated. Instead of needing to use ranges for modules, you can start specifying exact versions and this GitHub app will automatically check for updates periodically and submit version bumps.

Why? You can have a Terraform plan previewed and checked for any errors on a new version update with no work. This means your blast radius on updates would be reduced as you are staying up to date and previewing each update as it’s available.

No more 5 months of updates and figuring out what went wrong 😁

Here’s an example json config that shows how to allow automerging, while respecting minor/major version updates not enabling automerge.

Note that you’d want to install the auto-approver app they document in the marketplace if you have pull request reviews required.

In addition, if you use CODEOWNERS file, this will still block automerge. Consider removing that if you aren’t really leveraging it.

Go R1 Day 26

Progress

  • Evaluated gorm usage best practices with Slack Gopher community.
  • Obtained a great example to get me started on go routine and channels usage with multi-database queries.

Remove Chrome Autocomplete Suggestion

Do you have a Chrome suggestion for a domain, url, or specific site location that you don’t want anymore?

You can remove an invalid suggestion that you don’t want popping up each time by using shift+delete.

If it’s the first entry it will remove it, or use arrow keys to highlight a different entry and press the same command.

Also relevant: To Delete Chrome Address Bar Suggestions with Mouse

Go R1 Day 25

Day 25 of 100

progress

  • Worked with Gorm, my first experience with ORM based querying.
  • Used gofakeit with gorm to connect to MSSQL Server in Docker and randomize name entries.
  • Learned a bit about Context package and how it helps with propagation of cancellation.
  • As a new user to this, the examples were very confusing as it mixed up go-mssqldb along with examples using just gorm. As I get better with it, I’ll try to log better introductory examples.

Go R1 Day 24

Day 24 of 100

progress

  • Used glamour to render some nice console output.
  • Formatted text testing some text tooling.
  • Progressbar ui tested.
  • Connected successfully to MSSQL Docker instance and returned results of query, rendering to to console .

Go R1 Day 23

Day 23 of 100

progress

  • Used Viper to load configuration for a CLI tool.
  • Ran into problems with trying to print out map[string]interface{} type. Lots of magic performed by .NET to do this type of action. This is a lot more hands-on 😁.
  • Had stability issues with VSCode today, so I finally switched over to Intellij with the Go plugin and it worked well. The keyboard mappings are different so that was painful, but still overall a good experience that got me unblocked.

2020

Go R1 Day 22

Day 22 of 100

progress

Using Dash, I read through much of the language specification. Dry reading for sure, but helped a bit in understanding a little more on stuff like arrays, slices, loops, etc.

Nothing profound to add, except to say I don’t think I want to write a language specification.

Go R1 Day 21

Day 21 of 100

progress

  • Signed up for exercism.io, which is a pretty great website to work through progressively harder exercises.
  • Did Hello world to start with as requires progressive steps through the exercises.
  • Did a string concatenation exercise as well (Two Fer).

I like the mentor feedback system concept and submission of work. After I finish this, would be good to add myself as a mentor and contribute back to this community. This is a fantastic concept to help get acclimated to a new language and do progressively harder exercises to better learn the language usage.

Go R1 Day 20

Go R1 Day 19

Go R1 Day 18

SQL Server Meets AWS Systems Manager

Excited. Have a new solution in the works to deploy Ola Hallengren via SSM Automation runbook across all SQL Server instances with full scheduling and synchronization to S3. Hoping to get the ok to publish this soon, as I haven’t seen anything like this built.

Includes:

  • Building SSM Automation YAML doc from a PS1 file using AST & metadata
  • Download dependencies from s3 automatically
  • Credentials pulled automatically via AWS Parameter Store (could be adapted to Secrets Manager as well)
  • Leverage s5cmd for roughly 40x faster sync performance with no aws-cli required. It’s a Go executable. #ilovegolang
  • Deployment of a job that automates flipping instances to FULL or SIMPLE recovery similar to how RDS does this, for those cases where you can’t control the creation scripts and want to flip SIMPLE to full for immediate backups.
  • Formatted deployment summary card sent with all properties to Microsoft Teams. #imissslack
  • Management of these docs via terraform.
  • Snippet for the setup of an S3 lifecycle policy automatically cleanup old backups. (prefer terraform, but this is still good to know for retro-active fixes)

I’m pretty proud of this being done, as it is replacing Cloudberry, which has a lot of trouble at scale in my experience. I’ve seen a lot of issues with Cloudberry when dealing with 1000-3000 databases on a server.

Once I get things running, I’ll see if I can get this shared in full since it’s dbatools + Ola Hallengren Backup Solution driven.

Also plan on adding a few things like on failure send a PagerDuty incident and other little enhancements to possible enable better response handling.

Other Resources

Five

I asked my daughter (3) how much she loved me. She held up her hands and said: “Five”.

I’ll take that as a win considering that’s all the fingers on that hand. 😂

Leave Me Alone

Free Means You Are the Product

Over time, I’ve begun to look at products that are free with more judgment. The saying is: “If it’s free, you are the product”. This often means your data and privacy are compromised as the product.

This has resulted in me looking more favorably at apps I would have dismissed in the past, such as Leave Me Alone.

Leave Me Alone

The notion of buying credits for something I could script, click, or do myself made me use sporadically last year. This year, I took the plunge and spent $10 and appreciate the concept and cost.

If you have a lot of tech interaction, you’ll have a slew of newsletter and marketing subscriptions coming your way. This noise can drown your email.

I saw one Children’s clothing place that got my email on a receipt generate an average of 64 emails a month!

Leave Me Alone helps simplify the cleanup process by simplifying the summary of noisiest offenders, and one-click unsubscribes to any of these.

You can use an automatically generated rating based on ranked value on mailing lists, read engagement, number of emails sent monthly, and more.

Take a look, the free start is enough to figure out if you like it.

Other Tools

Combine this type of tool with:

  • Kill The Newsletter
  • Inoreader (RSS Reader)
  • Subscription Score: a really promising tool made by the same folks, but haven’t added at this time as price seems a bit high for this specific feature if I’m already using their app. (at this time $49 a year). Be nice if this was a feature provided automatically to those who bought 250 credits or more since it’s powered by the data mining of lists users unsubscribe from the most.

You’ll be more likely to keep up to date with this noise reduced. Last tip: Add GitHub Release notes like Terraform and others as a subscription in your RSS reader, and it might reduce the noise via email and slack on releases.