gitlab-cli : Interact with Gitlab from the command line, currently focusing on issues

gitlab-cli a cli tool that I have written for interacting with Gitlab. Currently the tool focuses on working with issues for a project. It is written in Go and works cross-platform (works with Windows, Linux and OS X). Refer to the project README page for installation instructions. Here is what the command help says: ⏚ [shank:~] % gitlab Usage: gitlab [OPTIONS] COMMAND [arg...] Gitlab-CLI Options: -v, --version Show the version and exit Commands: members Work with project members issues Work with project issues labels Work with labels in this project Run 'gitlab…

Keep reading

Poor man's generics in Golang (Go) [or pick your poison]

Golang does not have generics. Period. With that in mind, I just wish to share how I am thinking of implementing generic code. For this example, I am going to create a generic Stack data-structure. type Stack struct { T reflect.Type arr []interface{} } Yes, it wraps around a slice of interface{} type. And yes, that means loosing static safety. I also do store the Type of values that are permitted to be added to the stack. Storing this Type is what would help us to prevent dirty data from entering…

Keep reading

Solution to Eight Queens problem in Golang

We shall use the recursive backtracking technique for getting all the solutions to the Eight Queens Problem. We shall use two 8x8 arrays, one to store the position of the queens and the other to store the counts of the queens that are attacking a particular position. var hasQueen [8][8]bool var inAttack [8][8]int Next is the helper function that we call to place a queen at a position (i, j). func placeQueen(i, j int) { hasQueen[i][j] = true // update attack counts // row for c := 0;…

Keep reading

Golang equivalent of Python's bisect_left() and bisect_right()

Today I needed to binary_search on a sorted list of items in Golang. In Python (which remains my favorite language, btw) it was a simple thing to use the bisect module. That got me looking for its equivalent in Golang std packages. I found what I was looking for in the sort package. It has a function Search whose signature is like func Search(n int, f func(int) bool) int As per the documentation, Search uses binary search to find and return the smallest index i in [0,…

Keep reading

Input template (Go) for algorithmic competitions

Since I have been playing with Go recently, I decided to use it for the qualification round of Google Code Jam - 2016. Here is the struct I wrote to wrap around a reader so as to handle input from either a file or os.STDIN (technicall any io.Reader). type MyInput struct { rdr io.Reader lineChan chan string initialized bool } func (mi *MyInput) start(done chan struct{}) { r := bufio.NewReader(mi.rdr) defer func() { close(mi.lineChan) }() for { line, err := r.ReadString('\n') if !mi.initialized { mi.initialized…

Keep reading

go-hn: command line client for hacker news, written in golang

So, I was in need of a command line client for Hacker News and have been playing with Golang for some time. This weekend, I finally got some spare time and I hacked together a command line client for HackerNews in Golang. The project lives at gitlab. Its a quick hack and is in no way polished. Currently supports logging in, upvoting, opening an item, navigating to next/prev page. Will work on it, as and when I get some spare time.…

Keep reading

Git commit message - tips

The seven rules of a great git commit message Separate subject from body with a blank line Limit the subject line to 50 characters Capitalize the subject line Do not end the subject line with a period Use the imperative mood in the subject line Wrap the body at 72 characters Use the body to explain what and why vs. how Source: Chris Beams Blog…

Keep reading

tmux - cheatsheet

Keep reading

tig - Text-mode interface for git

Keep reading

Homebrew - how to find the list of packages that can be updated

The command to find the list of packages that can be updated, is not listed on the help page of brew. The command is: brew outdated…

Keep reading

Notes - Grep

Source: Notes are from the video tutorial by Frank Perez…

Keep reading

GIMP - How to get retina fonts

Right-click the gimp.app and choose “Show Package Content”. Edit the file info.plist Just above: </dict> </plist> Place this: <key>NSHighResolutionCapable</key> <true/> Now in order for the OSX to update the change, make a copy of the gimp.app, remove the old and rename. GIMP fonts would not be in retina resolution. However the icons would still be blurry and need a different fix. Source: jayway.com…

Keep reading

AssertionError on `pip list`

I am using pip3, but all the following commands have pip equivalent too. When doing a pip3 list, I was getting the following output: argparse (1.4.0) chardet (2.3.0) cloud-init (0.7.7) colorama (0.3.2) command-not-found (0.3) configobj (5.0.6) html5lib (0.999) Jinja2 (2.7.3) jsonpatch (1.3) jsonpointer (1.0) language-selector (0.1) MarkupSafe (0.23) oauthlib (0.6.1) pbr (1.7.0) pip (1.5.6) prettytable (0.7.2) pycrypto (2.6.1) pycurl (7.19.5)…

Keep reading

[WIP] Notes : Vagrant

Some useful aliases (add to ~/.zshrc) - vdestroy='vagrant destroy' vht='vagrant halt' vit='vagrant init' vsd='vagrant suspend' vssh='vagrant ssh' vst='vagrant status' vup='vagrant up' Installation - brew install vagrant Installing plugins - vagrant plugin install <plugin_name> Plugins that I use [ //TODO ] - - vagrant-proxyconf >> for using behind proxy - vagrant-vbguest >> for automatically installing host's virtualbox guest additions in the guest os Adding a Box (downloads it so that it can be used further) vagrant box add debian/jessie64 Init (creates a vagrantfile in…

Keep reading

Diving into DIY

For as long as I remember, I have always been a software guy, working on projects, hacking away at my code and working in from of my monitor for an inhumane number of hours a day. While I still love coding, I was looking for another hobby and the DIY revolution has splintered my interest. While I have not been living under a rock, I do agree I am terribly late to this stuff. But then, they say "Better late than never !", and so be it. I ordered my Arduino…

Keep reading