How to fork a go library (my way)

  • Git fork
  • Go mod init if not yet a module
  • Update path to new module github.com/someone/library -> github.com/you/library. This is because the module will continue to look for dependencies in the old path
  • Bump version with a tag (v1.0.0 -> v1.0.1)
  • Push the tag to Git
  • Go mod tidy in any project using the go library

Disassembling things I’m not supposed to

Replacing the brita water filter’s battery

The water pitcher that’s synonymous with the middle class in the 80s

Studies have shown they are pretty much useless in filtering out harmful stuff (which would be the subject of another post). However, they survived thanks to a loyal following that swear by the taste of their water and… planned obsolesce

This little thing measure when you have to change your filter again. It’s “designed to last up to 5 years” with no mention of how it can be reused – you are supposed to just trash it and buy a new one when the battery is out.

Harmful for the environment. Let’s change it!

First you need to pry the little device from your pitcher, do this with a flat-head screwdriver. The thing may scratch and breaks a little bit because they used some glue to make your job harder.

The back is cleary two simple pieces of plastic that you could have pried out easily… but couldn’t, thanks to more glue!

After you have pried it open, it’s a pretty straightforward battery. A pack of 5 of those batteries cost 1$

They even punched the battery to make it sticks to the receptors and damaging them if you aren’t careful when removing the battery. What an asshole design!

Voilà! Like new!

Korean bank OTP

This one is actually easy to disassemble. Just unscrew the face plate and you’ll get access to the board. However don’t try this on your main device. Upon removing and replacing the batter. the screen shows “Download 13” then fades away… forever. Probably a self-destruct feature to prevent tampering of the device.

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

Prune big files from Git with BFG

Step 2: Clone your repo as a mirror

Run this to clone your repo as a mirror.

git clone --mirror git://example.com/your-repo.git

The —-mirror flag means that it doesn’t actually download any of the files from your codebase. It downloads the .git directory contents into the top level, so it looks a little funky at first.

Step 3: Back up your repo

Just in case, now is a good idea to back up your repo to a separate location so that you can restore from it if needed.

cp -r your-repo.git your-repo-backup.git

Step 4: Run BFG to remove large blobs

In BFG, you have 3 main options for clearing out large files from your Git history.

Note: “blobs” are the objects that store file contents in Git.

Option 1: Strip blobs bigger than a specified size

In this case, you’re telling BFG to remove any blobs from history that are larger than a specified size. For example, to strip out any blobs bigger than 10MB, you run:

bfg --strip-blobs-bigger-than 10M your-repo.git

Option 2: Strip the biggest blobs, limited to a specified number

If you’d rather just strip the biggest blobs regardless of how large they are, BFG makes that easy:

bfg --strip-biggest-blobs 100 your-repo.git

This command will strip the 100 largest blobs from your repo history.

Option 3: Strip specific blobs, specified by IDs

If you know of specific files you want to get rid of, you can take this approach. In this case, you’ll pass in a text file that contains the list of blob IDs you want to strip.

bfg --strip-blobs-with-ids blobs.txt your-repo.git

You can use a one-liner like this like this to find the IDs of the largest blobs.

Protecting specific branches

BFG is very good at making sure that it doesn’t touch any of the files on your HEAD. It only adjusts your history, not the files in your latest commit.

But if you have other branches you want to make sure you protect, you can do that with the --protect-blobs-from flag:

bfg --protect-blobs-from master,dev,stage --strip-biggest-blobs 100 your-repo.git

Step 5: Expire and prune your repo

You’re removing things with BFG. Now it’s time to expire and prune your git history to reflect your changes. Here’s how you’d do that:

cd your-repo.git git reflog expire --expire=now --all && git gc --prune=now --aggressive

Note that this command can take a long time depending on your repo size. So it’s best to make sure you’re done running BFG first. You only want to have to run this command one time.

Step 6: Check your repo size

Verification time! Did the repo shrink? If not, then you probably missed a step or didn’t remove the correct files.

Step 7: Push your changes

Now you’re ready to push all your updates so that everyone can enjoy the new, slimmer repo you have fashioned.

git push

And that’s that! Your repo should be smaller, without any noticeable negative effects. Thanks BFG!

source: https://www.phase2technology.com/blog/removing-large-files-git-bfg