Automatically allow go binary in goland to listen on MacOS

Everytime you compile a go binary in goland and start it, MacOS will ask you to allow the binary to listen for incoming connection, which can quickly become a nuisance. To always allow the binary, do two things

Listen only on “localhost”

Set the execution environment to HOST=”localhost” for gin

Code sign the executable before launch

Voilà! No more prompts!

Application and apps for living in Korea

For Windows

This part is about little-known applications that fixes minor annoyances you may encounter as an expat in Korea. I’m pretty sure there’s more I didn’t know, if you do please leave a comment.

Blocks ads on Kakaotalk client

The ads on Kakaotalk for Windows can be a little overwhelming. You can apply this patch for download an application to hide those ads

Banking plugins

Internet Explorer is on its final breath… not in Korea! Similar to how they established a “Windows XP task force” after Microsoft stopped updates to the OS, I expect IE to live for a while longer on government and banking sites.

Installing the ActiveX those sites requires are one thing. You’ll find that what you had installed will slow down your computer or prevent you from accessing some website (yep). And uninstalling them one by one is a daunting task, sometimes even a Windows factory reset is faster.

The solution is “Hoax remover” (it’s an awkward name, but it works). This program will uninstall all those little ActiveXs for you, leaving you with a usable computer (at least until you need to install them again…)

Edit hangeul files

Universities love 한글, government love 한글, users don’t and they complain a lot that they have to fork out 40,000 won for a software that is inferior to Office.

Hancom decided that they had enough license money from the government so they released a public version of Hangeul that provides basic editing functionality so you can fill out forms and complete your homework. Though upon startup it will warn you not to use it for commercial purposes…

For Phones

List of apps that I find useful, not your typical list of map, food, talk apps that everyone already uses. Most will require a Korean number associated with your identity so get your ARC ready.

  • Toss use this to manage your bank account instead of the official bank apps. Especially useful if you have multiple accounts across multiple banks. Other functions: credit report, fingerprint fast payment, pay to account copied in clipboard…
  • Emergency ready app Don’t understand what the emergencies messages said because it’s in Korean? Turn of information notifications on your phone and install this app. It’s provide you with a translation of those messages
  • Annoyance report Your neighbor didn’t dispose of trash properly? Someone parked illegally blocking your way? Some public facility is broken? You can report those to the government and get a response in 1-2 days with this app

Just Awesome Vietnamese

In a moment of inspiration, I forked an abandoned awesome-vietnamese list and add some new entries to it. Hopefully this list will be useful for people looking for awesome Vietnamese projects

Assorted TILs

Difference between go get and go install

go install is part of the workflow when working locally. Say you want to use a library, but for some reason a change is required. You would do:

  • go get -d library, which only downloads it;
  • make the change on the downloaded package;
  • go install library to install the local version.

How to specify options for protoc

protoc -go_out=\

M{type1}={alias2},\

M{type2}={alias2},\

{option1}={value1},\

{option2}={value2}:\

{output path} {proto file}

How to use goproto_enum_prefix with GRPC plugin

protoc -I=. -I=$GOPATH/src/github.com/gogo/[email protected]/protobuf --proto_path="$dir" \

--gogo_out=\ Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,\

Mgoogle/protobuf/empty.proto=github.com/gogo/protobuf/types,\

goproto_enum_prefix=false,\

plugins=grpc:"$GOPATH/src"

How to create a type alias in go

package timestamp

import "github.com/gogo/protobuf/types"

type Timestamp = types.Timestamp

How to create a function alias in go

package ptypes

import "github.com/gogo/protobuf/types"

var TimestampProto = types.TimestampProto

var TimestampNow = types.TimestampNow

To publish a scoped package to npm @somethingsomething / packagename

  1. Create organization on npm ‘somethingsomething’
  2. npm login
  3. Edit package name to be @somethingsomething / packagename
  4. npm publish
  5. Profit!

To automate web tasks

Like finding elements on a page and click it, use Selenium IDE, available as a simple plugin for many browsers

How to type in Dvorak but keep Qwerty shortcuts

Every Dvorak user knows the pain: shortcuts in every program on earth is designed with Qwerty in mind. Cut – Copy – Paste is supposed to be next to each other but it’s not so in Dvorak.

As A Dvorak user, I’ve had to find and try many solutions for this problem over the years. It involved all sort of hacks and modifications to the deepest parts of the operating system: creating custom keyboard layouts, modifying the registry, write a new input method etc. Even so, it didn’t work in some applications (looking at you, IntelliJ, Java and Firefox – the bugs isn’t even fixed yet, and they are almost 10 years old!).

Almost 10 years later, in 2019, I finally found solutions that work for all major operating systems, and here they are:

MacOS

Apple makes great software, even though I don’t like their business practices, that’s an undeniable fact. MacOS is the simplest of the three OSes: Simply add Dvorak-QWERTY as an input method and you are good to go!

Windows

Used to be the second-easiest OS to work with, but recently Microsoft started cracking down on custom software and drivers so any custom keyboard layout not provided by them will get wiped out (and basically becomes very buggy with Windows 8 and up).

My solution? Use AutoHotKey! Yes, it’s an extra install, but it works reliably across all machines I’ve used with little setup required.

How to use Dvorak-QWERTY with AutoHotKey on Windows

  1. Install and set a Dvorak layout as your default (which language doesn’t matter)
  2. Install AutoHotKey
  3. Save this gist to your machine
  4. Optional: Convert the .ahk file to .exe with AutoHotKey so you can use it elsewhere without AHK
  5. Put the .ahk file in your startup folder
  6. Profit!

Notes about the AHK script

  • It will switch the layout to Qwerty when control keys or a combination of them is pressed (Ctrl, Alt, Win, Ctrl + Alt, Ctrl + Win)
  • It will disable itself when the input language is Korean (code = 68289554) so you can type Korean characters uninterfered. You can find similar code for Japanese, Chinese, etc. using AHK’s inspection tool
  • It will disable itself when scroll lock is on. This is for exceptional cases when you want to use Qwerty without pressing modifiers key
  • If you need additional combination of control keys, you must copy a whole section and add the control keys manually. For some reason, AHK’s * doesn’t work properly with control keys no there’s no way to make the script shorter

Linux

What worked for me: modifying the xkb keymaps! This idea came when I tried to replicate the AutoHotKey solution on Linux. I found source code of past projects that tried to achieve this. Sadly no step by step guide on how to apply them. Here’s how:

  • Press the plus button
  • Choose English (United States)
  • Choose any of the English (Dvorak-Qwerty), the flavor you prefer
  • Now switch the keyboard layout to your newly added layout
  • You’re done!

Conclusion

Dvorak is a good ergonomic layout but it hasn’t seen more widespread adoption due to entry barriers like the QWERTY shortcut problem. I hope this post solved part of that problem.

To read: The twelve factor app

Introduction

In the modern era, software is commonly delivered as a service: called web apps, or software-as-a-service. The twelve-factor app is a methodology for building software-as-a-service apps that:

  • Use declarative formats for setup automation, to minimize time and cost for new developers joining the project;
  • Have a clean contract with the underlying operating system, offering maximum portability between execution environments;
  • Are suitable for deployment on modern cloud platforms, obviating the need for servers and systems administration;
  • Minimize divergence between development and production, enabling continuous deployment for maximum agility;
  • And can scale up without significant changes to tooling, architecture, or development practices.

The twelve-factor methodology can be applied to apps written in any programming language, and which use any combination of backing services (database, queue, memory cache, etc).

The twelve factors

I. Codebase

One codebase tracked in revision control, many deploys

II. Dependencies

Explicitly declare and isolate dependencies

III. Config

Store config in the environment

IV. Backing services

Treat backing services as attached resources

V. Build, release, run

Strictly separate build and run stages

VI. Processes

Execute the app as one or more stateless processes

VII. Port binding

Export services via port binding

VIII. Concurrency

Scale out via the process model

IX. Disposability

Maximize robustness with fast startup and graceful shutdown

X. Dev/prod parity

Keep development, staging, and production as similar as possible

XI. Logs

Treat logs as event streams

XII. Admin processes

Run admin/management tasks as one-off processes