in English
I use Protobuf Support Plugin for syntax highlighting. However, it can't resolve 3rd party proto file like this: In my case, the file which is not resolved is located in proto/third_party directory. Solution Open Project Structure (File ->…
Sometimes it's painful to safisfy a large interface in Go. Here is a simple answer for this, just embed interface on struct like bellow: package main import ( "fmt" ) type Foo interface { MethodA() MethodB() MethodC() MethodD() } type FooI…
There are a lot of examples to use math/rand. However, should use crypto/rand if you want to generate an unpredictable random value. That's because crypto/rand uses getrandom(2) if available, /dev/urandom otherwise on Linux. As a real worl…
This blog post describes basics and practical examples of go test. Go’s automated test mechanism is well designed and easy to use. I’ll show you some techniques of go test in this article. What is go test go test is a command to run automa…
The arguments to the deferred function (which include the receiver if the function is a method) are evaluated when the defer executes, not when the call executes. Effective Go - The Go Programming Language I sometimes make a mistake that d…
Installing latest npm $ npm install -g npm@latest Disabling npm’s progress bar Disabling progress bar for faster npm install. $ npm set progress=false See Progress bar noticeably slows down npm install · Issue #11283 · npm/npm Installing n…
stackoverflow.com If you take the address of loop variable, it may cause a bug which all values are same. You might expect following program prints 5 10 15 but it prints 15 15 15. That’s because loop variable v is initialized just once. pa…
How nginx processes a request server { listen 80; server_name example.org www.example.org; ... } server { listen 80; server_name example.net www.example.net; ... } server { listen 80; server_name example.com www.example.com; ... } In this …
$ ps aux --sort -rss Sorted by ascending order if you don't add -. alvinalexander.com
This is a just memo for me who is a beginner of front-end development.
Just add urllib.parse.uses_netloc.append("mysql") if you want to parse URL such as mysql://root:pass@localhost/demo. #!/usr/bin/env python import urllib.parse urllib.parse.uses_netloc.append("mysql") if __name__ == "__main__": url_str = "m…
Sending pull-request only with terminal and keyboard. Mac, Terminal and hub command are required.
I use Selenium to log into dmm.com because dmm.com requires JavaScript enabled browser. Here is a sample code. You can see Firefox is launched and automatically logging into dmm.com if you use Firefox instead of PhantomJS. login_dmm.py #!/…
Information schema is metadata about MySQL. We can obtain useful information from it. For example, I get current auto increment values by following SQL. SELECT t.table_name, t.auto_increment FROM information_schema.tables AS t WHERE t.tabl…
dotGo 2014 - Andrew Gerrand - 5 things I love Andrew Gerrand is a Googler and worked for Go. I watched this video just to learn English but it was good that he was describing Go's feature very well. www.youtube.com Golang UK Conference 201…
Duplicate foo table into foo_20150904 /* Create a new table from foo's schema */ > CREATE TABLE foo_20150904 LIKE foo; /* Insert whole data into a new table */ > INSERT INTO foo_20150904 SELECT * FROM foo;
Use CPD to detect duplicated code in Golang. And visualize how much duplicated by Jenkins DRY plugin.
virtio makes VirtualBox's network faster. In my case, it's 1.7x faster.
Packer can build Vagrant box from VirtualBox OVF file.
Mocking HTTP access with http.RoundTripper
bower caches packages in ~/.cache/bower. How can I change the directory? bower's document says "Add the following in .bowerrc" but it's totally wrong. "storage": { "cache" : "~/.bower/cache", "registry" : "~/.bower/registry" } I try the co…
pmd https://github.com/pmd/pmd/pull/44 CPD (Copy Paste Detector) supported GoLang. go-xorm https://github.com/go-xorm/xorm/issues/166 Suggested and implemented "soft delete" for xorm. My pull-request was immediately merged! (very impressiv…
I use Java VM's option -XX:+PrintGCTimeStamps in order to output time in GC log of Java VM , Just like this. TODAY=`date "+%Y%m%d-%H%M%S"` JAVA_OPTS="-server -Xms512m -Xmx512m -Xmn256m -XX:PermSize=256m -XX:MaxPermSize=256m \ -XX:+UseConcM…
Recently I found static syntax checker for Ruby called ruby-lint. We haven't had such a syntax checker for Ruby, so I'm very happy to find it. (Although it's alpha quality) Installation $ gem install ruby-lint Try Prepare following ruby co…