As primarily a linux user, the MacOS key mapping for copy-paste is really uncomfortable. To map it more like Linux (and Windows) the general recommendation is to switch the Command and Control key, but then the switch windows (Alt-Tab on Linux and Windows) shortcut is different. The solution is to create a shortcut on MacOS for the "Copy" and "Paste" command to map to Control-C and Control-V respectively (System Settings > Keyboard > Keyboard Shortcuts > App Shortcuts).
Thursday, October 22, 2026
Sunday, May 10, 2026
Alacritty with Terminus On MacOS
Installing Terminus
- Go to Font Book and check that the fonts are all activated.
- Make sure you have the right family name and style as Alacritty is case sensitive and both needs to be entered into the config exactly or Alacritty will give you a misleading error message.
Disabling Anti-Aliasing
defaults write org.alacritty AppleFontSmoothing -int 0defaults delete org.alacritty AppleFontSmoothingInstalling a Better Terminus
[font]
size = 18.0
normal = { family = "Consoleet Terminus-18", style = "medium" }
bold = { family = "Consoleet Terminus-18", style = "bold" }
Installing Nerd Font Symbols
#!/usr/local/bin/bash
SYMBOL_REGULAR="$HOME/Library/Fonts/TerminessNerdFont-Regular.ttf"
SYMBOL_BOLD="$HOME/Library/Fonts/TerminessNerdFont-Bold.ttf"
mkdir -p ~/merged-fonts
declare -A SYMBOL_MAP=(
[/Library/Fonts/consoleet_ter18nr.otf]="$SYMBOL_REGULAR|medium"
[/Library/Fonts/consoleet_ter18br.otf]="$SYMBOL_BOLD|bold"
)
for f in "${!SYMBOL_MAP[@]}"; do
IFS='|' read -r symbol style <<< "${SYMBOL_MAP[$f]}"
name=$(basename "$f" .otf)
family="Consoleet Terminus-18 Nerd"
psname="ConsoleetTerminus18Nerd-${style}"
fullname="${family} ${style}"
cat > /tmp/merge.pe <<EOF
Open("$f")
Print("Destination em: " + \$em)
Print("Destination ascent: " + \$ascent + " descent: " + \$descent)
\$dst_em = \$em
\$dst_ascent = \$ascent
\$dst_descent = \$descent
Open("$symbol")
Print("Source em (before): " + \$em)
ScaleToEm(\$dst_ascent, \$dst_descent)
Print("Source em (after): " + \$em)
Generate("/tmp/scaled_symbol.ttf")
Close()
MergeFonts("/tmp/scaled_symbol.ttf")
SetFontNames("$psname", "$family", "$fullname", "$style")
Generate("$HOME/merged-fonts/${name}-merged.otf")
EOF
fontforge -script /tmp/merge.pe
#!/usr/local/bin/bash SYMBOL_REGULAR="$HOME/Library/Fonts/TerminessNerdFont-Regular.ttf" SYMBOL_BOLD="$HOME/Library/Fonts/TerminessNerdFont-Bold.ttf" mkdir -p ~/merged-fonts declare -A SYMBOL_MAP=( [/Library/Fonts/consoleet_ter18nr.otf]="$SYMBOL_REGULAR|medium" [/Library/Fonts/consoleet_ter18br.otf]="$SYMBOL_BOLD|bold" ) for f in "${!SYMBOL_MAP[@]}"; do IFS='|' read -r symbol style <<< "${SYMBOL_MAP[$f]}" name=$(basename "$f" .otf) family="Consoleet Terminus-18 Nerd" psname="ConsoleetTerminus18Nerd-${style}" fullname="${family} ${style}" cat > /tmp/merge.pe <<EOF Open("$f") dst_ascent = \$ascent dst_descent = \$descent Print("Destination em: " + \$em + " ascent: " + dst_ascent + " descent: " + dst_descent) Open("$symbol") Print("Source em (before): " + \$em) ScaleToEm(dst_ascent, dst_descent) Print("Source em (after): " + \$em) Generate("/tmp/scaled_symbol.ttf") Close() Open("$f") MergeFonts("/tmp/scaled_symbol.ttf") SetFontNames("$psname", "$family", "$fullname", "$style") Generate("$HOME/merged-fonts/${name}-merged.otf") EOF fontforge -script /tmp/merge.pe Done
fc-scan --format "%{family}\n%{fullname}\n%{postscriptname}\n%{style}\n" ~/merged-fonts/consoleet_ter18nr-merged.otf
fc-scan --format "%{family}\n%{fullname}\n%{postscriptname}\n%{style}\n" ~/merged-fonts/consoleet_ter18br-merged.otfcp ~/merged-fonts/consoleet_ter18*-merged.otf ~/Library/Fonts/ fc-match "Consoleet Terminus\-18 Nerd" fc-match "Consoleet Terminus\-18 Nerd:style=bold"
[font] size = 18.0 normal = { family = "Consoleet Terminus-18 Nerd", style = "medium" } bold = { family = "Consoleet Terminus-18 Nerd", style = "bold" }
Tuesday, April 7, 2026
Aerospace, Sketchybar, Jankyborders to Make OSX Workable
I've been using a combination of a Linux and ChromeOS as my work laptops, but my current job now has me using a Macbook Pro which I haven't touched in over 10 years. A combination of the way OSX behaves and the workflow necessary for my particular work environment (Slack, Outlook, Claude Code, etc.) made me realize that I really needed to configure it if I expect to have a half decent work experience.
Aerospace Windows Manager
With the sheer number of different windows (apps and many browser windows), I couldn't function with a floating windows manager. OSX's spaces/Mission Control was not effective in taming the chaos so I decided to use Aerospace, a tiling windows manager influenced by i3wm. With Aerospace, having one application per workspace is much more intuitive and natural because of how well it's shortcuts are integrated with it. It was almost instinctive to have my browser windows in the B workspace because the shortcut to it is simply Alt-B and Aerospace allowed you to configure so that whenever a browser window is opened that it can automatically put in the B workspace. Along with not having all the gazillions windows overlapping each other was enough for me to use it, but the additional features, programmability and keyboard friendliness made it even more worth while for me to adopt it.
SketchyBar
SketchyBar is a nice complement to Aerospace. It's a programmable OSX menu replacement, but I have it running vertically exclusively for Aerospace where it shows the Aerospace workspaces and what is running in each workspace.
JankyBorders
When there are multiple windows in one workspace, sometimes it wasn't obvious which was the active window. JankyBorders is an utility program that draws a more visible border around the active window to make it more easily identifiable.
Integrating Aerospace, SketchyBar and JankyBorders
AeroSpace and JankyBoarder complements each other and doesn't exactly require integration but since Aerospace can be configured to run external programs as part of its startup it is simple to simply have Aerospace launch JankyBorder.
Integrating Aerospace and SketchyBar took a little more effort but the basic steps are:
- [Aerospace] Have Aerospace start SketchyBar.
- [Aerospace] Tell Aerospace that whenever there is a chance to a workspace that it should call SketchyBar to tell it of an event change and pass along the workspace that is in focus.
- [SketchyBar] Set its config file (~/config/sketchybar/sketchybarrc) to call Aerospace's command line app to get the active workspaces and apps in each workspace to be added to the SketchyBar menu.
My ~/.aerospace.toml and ~/.config/sketchybar/[sketchybarrc | aerospace.sh] can be found on Github.
Wednesday, April 8, 2020
BASH startup file loading order
/etc/bash.bashrc
~/.bashrc
/etc/profile and then first of: /etc/profile
~/.bash_profile
~/.bash_login
~/.profile
Tuesday, July 3, 2018
Windows As a Developer Machine with Windows Subsystem for Linux (WSL)
Saturday, April 1, 2017
Accessing Github Through SSH As Different Users
$ cd ~/.ssh $ ssh-keygen -t rsa -C "github-acct1" -f "github-acct1"Then add the ssh key to the Github account.
Next, create ~/.ssh/config to tell ssh when to use which account (set permission to be 600):
# Github account #1
Host github.com-acct1
HostName github.com
User git
IdentityFile ~/.ssh/github-acct1
IdentitiesOnly yes
# Github account #2
Host github.com-acct2
HostName github.com
User git
IdentityFile ~/.ssh/github-acct2
IdentitiesOnly yes
Check out a repo as the user to use by matching to the Host value in ~/.ssh/config:
$ git clone git@github.com-acct1:repoChange to the repo directory and set the name and email to use for commits if needed.
$ cd repo $ git config user.name "Acct1" $ git config user.email acct1@example.com
To avoid accidentally using the wrong account (e.g. default):
$ git config --global --unset user.name
$ git config --global --unset user.email
$ git config --global user.useConfigOnly true
If you get an error message about the user (or the wrong user) not having the right permission to access the repo:$ eval "$(ssh-agent -s)"
$ ssh-add
Thursday, July 21, 2016
Updating VIM for Go (Golang) Development
Go Tools
Make sure that you have Go installed and then get the various Go tools.goimports
Go provides a lot of use packages that can be imported but it doesn't like it when you import a package and not use it. Goimports will automatically insert the right imports for you by looking at your code and will remove unused imports from your source. It's a great time saver!
godefgo get golang.org/x/tools/cmd/goimports
Godef lets you jump to the location where a symbol is defined.
go get -v code.google.com/p/rog-go/exp/cmd/godef
go install -v code.google.com/p/rog-go/exp/cmd/godef
golintGolint will lint your source and warns you of potential issues.
gorenamego get github.com/golang/lint/golint
Gorename helps to refactor Go code.
go get golang.org/x/tools/cmd/gorename
errcheckErrcheck checks your code for actual errors that isn't just lint issues.
go get github.com/kisielk/errcheck
gocodeGocode provides autocomplete of your Go code. When combined with vim-go and YouCompleteMe plugins, it allows autocomplete to appear as you're typing.
go get -u github.com/nsf/gocode (-u flag for "update")
It's a bit different for Windows so follow the instruction from the link for more details.gotags
Gotags generate tags for Go code. Combined with Tagbar, it will provide a pretty display of the tags in your code.
go get -u github.com/jstemmer/gotags
GuruGuru is a tool that integrates with editors to help it understand Go code.
go get golang.org/x/tools/cmd/guru
go build golang.org/x/tools/cmd/guru
go get code.google.com/p/go.tools/cmd/oracle
Vim Plugins
It used to be that you would manually install a vim plugin for each of the various Go tools as well as using the the plugins that comes with Go itself. Now, everything has been consolidated into a single Vim plugin, vim-go, and that's all you really need when it comes to Go-specific plugins. A few other plug-ins such as Tagbar and YouCompleteMe are useful to complement your development environment, though. I highly recommend that you use Vundle to manage your plugins.vim-go
Vim-go brings together all the various plug-ins and feature for Go development in VIM including autocomplete, snippet support, improved syntax highlighting, go toolchain commands, etc. in a single package.
YouCompleteMe
YCM is a fast code completion engine for VIM that works as you type. YCM requires VIM 7.3.584 or above and CMake (you'll need to compile the extension after it's downloaded).
Tagbar
A great way to view the tags in your code. This requires that you have Exuberant Ctags and gotags installed.
Bufexplorer
My favorite plugin for navigating between VIM buffers.
.vimrc
" Go Specific Stuff
au BufRead,BufNewFile *.go set filetype=go
autocmd FileType go setlocal softtabstop=4
autocmd FileType go setlocal shiftwidth=4
autocmd FileType go setlocal tabstop=4
" go-def settings
let g:godef_split=2
let g:godef_same_file_in_same_window=1
" go-vim settings
let g:go_fmt_command = "goimports"
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_structs = 1
" tagbar settings
let g:tagbar_type_go = {
\ 'ctagstype' : 'go',
\ 'kinds' : [
\ 'p:package',
\ 'i:imports:1',
\ 'c:constants',
\ 'v:variables',
\ 't:types',
\ 'n:interfaces',
\ 'w:fields',
\ 'e:embedded',
\ 'm:methods',
\ 'r:constructor',
\ 'f:functions'
\ ],
\ 'sro' : '.',
\ 'kind2scope' : {
\ 't' : 'ctype',
\ 'n' : 'ntype'
\ },
\ 'scope2kind' : {
\ 'ctype' : 't',
\ 'ntype' : 'n'
\ },
\ 'ctagsbin' : 'gotags',
\ 'ctagsargs' : '-sort -silent'
\ }
Friday, July 24, 2015
Use VIM-like HJKL Instead Of Arrow Keys in Linux and OSX
I found that after spending time in VIM if I switch to other apps I will start using HJKL for navigation. Of course that usually doesn't work and I end up using the arrow keys (e.g. when moving down menu options in the browser). Naturally if I'm using those apps a lot more then when I go back into Vim I'll get lazy and start trying to use the arrow keys. I decided what I want is to use HJKL even when I'm not in Vim and I wanted it to be consistent across Linux and OSX.
On OSX, this is easy to do. Simply install Karabiner and select the option to use VI mode using the control key. Then, in any app, simply use CTRL-[HJLK] for the equivalent behavior as using the arrow keys. To add more consistency between OSX and Linux, I remapped Caps-Lock to the CTRL key (which is also easier to type on a mabook pro).
On Linux, it's a little more work. I use Caps_Lock as the Switch_mode (SM) key and then defined that SM-[HJLK] combination to be like the arrow keys. To do this:
xmodmap - pke > ~/.Xmodmap
Add this line to the top of the .Xmodmap file to disable the Caps_Lock key:
clear Lock
Then set the Caps-Lock key to be the Switch-mode key:
keycode 66 = Mode_switch Caps_Lock
This means to set the caps_lock to be the mode_switch key (and caps-lock when it is Shift-Caps_Lock)
Next, add the Left/Down/Up/Right to the third column of the key code record that maps to the letters, HJKL.
keycode 43 = h H Left
keycode 44 = j J Down
keycode 45 = k K Up
keycode 46 = l L Right
This means that for key 45, print "k" when the key is pressed, "K" when it is SHIFT-k and Up when CapsLock-k is pressed (since CapsLock is now the mode_switch key).
Once you save the file, load it with
xmodmap .Xmodmap
Most current desktops will load .Xmodmap when logging in.
You can find out what keycodes maps to what by using xev.
Monday, May 4, 2015
Installing Waypoint Map Mods for Minecraft 1.8 for Windows, Linux and OSX (Yosemite)
Installing mods is both simple and annoying for a few reasons:
- Mods aren't officially supported by Minecraft so there is no single way to install mods.
- This means that a mod built for version A might not work for version B.
- Different mods might require different mod loaders and they might be in conflict with each other.
- Just like apps on your mobile phone, some mods might not do what it claims to do and can be potentially harmful.
- Many mods are served from sites that also tries to sneak in adware and malware on your machine when you try to download even if the mods themselves are okay.
- Minecraft is built on Java and given the security issues a lot of OSs no longer comes with Java so you'll have to install it yourself.
- If you install the official Java from Oracle (whether OSX or Windows), they try to sneak in adware on your machine as well!
Microsoft Windows
- Java 1.6+ (to run the installers for Forge, Liteloader, etc).
- Minecraft 1.8.x client launcher
- Minecraft Forge for 1.8 (see below to avoid getting mislead by the download links)
- Liteloader for 1.8
- VoxelMap for 1.8
Java 1.6+
C:\Program Files (x86)\Minecraft\runtime\jre-x64\<version>\bin\javaw.exe
set JAVA_HOME="<path to java minus the javaw.exe>"
set PATH=%PATH%;%JAVA_HOME%
Minecraft 1.8.x Client Launcher
Simply download from https://minecraft.net/download and install it.
Minecraft Forge for 1.8
Liteloader for 1.8
VoxelMap for 1.8
Installing Everything
- Click on the Minecraft installer you downloaded from minecraft.net. This will install Minecraft.
- Click on the launcher that it installed to start Minecraft.
- Click "Edit Profile" and change the version of Minecraft from "latest" to "1.8" (this is just a one time thing because Forge needs you to have run that version at least once).
- Click "Play"
- You can quit once the game menu comes up and change the profile back to latest at this point.
- Quit Minecraft completely.
- At the command prompt, install Forge with: java -jar <path to .jar file>. Select "Install client" then OK. Start up the client again, pick the "Forge" profile and make sure everything works.
- Quit Minecraft.
- At the command prompt, install Liteloader with: java -jar <path to .jar file>.
- From the menu's "extend to" option, pick the drop down that says Forge... and then install.
- Start up the client once again, select the "Liteloader 1.8 with Forge..." profile and make sure everything still works.
- Quit Minecraft
- At the command prompt, copy the VoxelMap mod to the Forge mod directory: copy <path to VoxelMap's *.liteload file> %APPDATA%/mods/1.8
- You're done! You should now be able to play Minecraft with the minimap on your screen.
Linux
- Linux might already have Java installed, but if not then use the package manager to install openjdk and you shouldn't have to do anything else beyond that for Java.
- The path to copy the VoxelMap mod (step 13 above) is ~/.minecraft/mods/1.8 (instead of %APPDATA%/minecraft/mods/1.8).
OSX
Just like Windows, the Minecraft launcher for OSX also comes with Java 1.8 so it isn't necessary to download Java separately. OSX only have Java 1.6 so you should use the version that comes with Minecraft then the default OSX Java.
Java 1.6+
Minecraft Forge for 1.8
java -jar forge-1.8-*-installer.jarThen selecting "Install client".
Liteloader for 1.8
Right click on the installer jar file and select "Open With > Archive Utility". This should create a folder with all the files from the jar file.Using the Terminal, go to the folder and copy the Liteloader jar files to the mod directory: cp liteloader-*.jar ~/Library/Application\ Support/minecraft/modsNow start up Minecraft but continue to use the Forge profile.If everything starts up fine and it Forge is running then quit Minecraft
java -jar <liteloader jar file>
cp liteloader-*.jar ~/Library/Application\ Support/minecraft/mods
VoxelMap for 1.8
cp <voxelmap mod file> ~/Library/Application\ Support/minecraft/mods/1.8
You can now start up Minecraft and see that the VoxelMap mod is loaded.
You're Done!
Now you should be able to use the VoxelMap mod whether in your single player game or if you connect to the 1.8.x server.
Wednesday, March 4, 2015
Mounting Shared Drive on Linux and Headless Bittorent Daemon
GUI Way
watch -n 72000 <program to download torrents>
Terminal Way
This similar to the GUI way described above except you do it in a terminal running in a tmux session so that you can disconnect without loosing your transmission job. To connect to the shared smb drive without the GUI by using transmission-cli tool.tmux dbus-launch bash gvfs-mount smb://<user>@<host>/<path-to-shared-drive> sudo yum install transmission-cli transmission-cliYou'd put in your user name and password as it prompts you when you mount the shared drive. You'll need to configure transmission.
Headless Way
This doesn't require any GUI or terminal and can automatically starts at each boot.Install the transmission-daemon
sudo yum install transmission-daemon sudo systemctl start transmission-daemon.service sudo systemctl stop transmission-daemon.serviceThe service file is in /usr/lib/systemd/system/transmission-daemon.service.
I started and stopped the daemon because you need to configure it through the /var/lib/transmission/.config/transmission-daemon/settings.json and this gets created when you first start (for other locations of Transmission files click here). This will also install the transmission user
Next you need to mount the shared drive in order for transmission to access and ONLY transmission:
sudo mount -t cifs -o -credential=<path-to-credential>,gid=`id -g transmission`,uid=`id -u transmission` <mount point>The credential value points to a file that contains your username, password and domain for logging into the shared drive. Make sure wherever you store it that it's not readable by others.
The gid and uid belongs to the user you want to be able to do read-and-writes to the shared drive otherwise it'll only be root that can do it. For Fedora, the user is "transmission"
If it works and you can read-and-write, you can move this into /etc/fstab:
//<host>/<path-to-file> <mount-point> cifs credentials=<path-to-cred>,uid={user id},gid={group id}
and then reload fstab:sudo mount -aOnce you configure the /var/lib/transmission/.config/transmission-daemon/settings.json to your liking then fire up:
sudo systemctl start transmission-daemon.service
sudo systemctl enable transmission-daemon.serviceThis starts up the service now and also at each machine reboot. The one issue is that transmission-daemon might start before the drive is mounted and then it won't look for the changes. It needs to be told to wait.
Systemd will look at /etc/fstab and automatically create an unit that can be added to the service file to tell it to wait. Running the systemctl command will show you an unit that can be used (it'll be something with a .mount suffix).
Add that unit to the After line:
After=network.target <mount unit>
Finally, set up a cron job to regularly check for new torrents:
crontab -u <transmission user> -eWith the value being something like:
0 23 * * * <path-to-program-to-run> >> /var/lib/transmission/download.log 2>&1
Since the transmission users is disabled for an interactive shell, to execute commands as the transmission user, use:
sudo -u <transmission user> <command>
Thursday, February 26, 2015
Compiling Synergy on OSX 10.9 Maverick (and 10.10 Yosemite)
The Synergy website looks and feel like one of those spam sites where they try to trick you into buying or downloading something with big call to action buttons while the actual link to download is kind of hidden. For example, they have a big "Get Synergy" button which is the one that ask you to pay while links to github and a link for free binary downloads (although not of the most recent version since that's the one they want you to pay for) are tiny and hidden way a bottom of the page. I guess it's better then those sites with a big button that says "Download Here!" (which actually takes you to some spam page) while next to it as a small font link is the actual download link. Plus, paying for it doesn't seem to get you additional support or anything other then being able to download a pre-compiled binary. Basically, their execution of it is the turn-off and I had to check a few times to make sure the site is legit and not a spam company trying to appear legit.
Since this is open source anyone can just download the source and build it themselves, right? Well, not exactly. The instructions for how to compile is not great, but worst is that the code itself doesn't build if you just get it from Github. I'm trying to build on OSX since most Linux distro will have it already in a package to install, but Synergy doesn't have a Homebrew formula and Macports has not maintainer. So, for OSX, you'll need to compile yourself.
The latest source doesn't work yet (I tried to build it and it errors out on compile), so I thought I get the last stable version and build from that. Nope. If you try to build strictly from the command line it fails trying to create the right build files because of problems with the toolchain it uses. If you try to build with Xcode, you'll need to code sign it. In order to build it, you'll need to patch the toolchain. I found that someone in Korea fixed the toolchain to allow him to build Synergy for Yosimite, but his solution is actually also needed to get it to build on 10.9 Maverick
So here goes:
xcode-select --install brew install cmake brew install qtNext you'll need to download the source from http://github.com/synergy/synergy.
When I grabbed the latest and tried their instructions for compiling, it didn't work. So your choice is to pull from an earlier stable release. That means either 1.6.2 or 1.4.x. Note that the 1.6.x client can't speak to 1.4.x and even 1.4.18 client isn't compatible with 1.4.10 server. Fedora 21, for example, comes with 1.4.10 so if you grabbed the latest 1.4.18 release it wont' work.
To build 1.6.2 on OSX Maveric, you'll need to change ext/toolchain/command1.py
./hm.sh conf -g1 --mac-sdk 10.9 --mac-identity Maveric ./hm.sh buildTo build 1.4.18, this is the replacement ext/toolchain/command1.py
I realized after building 1.4.18 client that it won't work with 1.4.10 server, I decided to have every system on 1.6.2 even if I can't use a package manager for it.
Don't just have Synergy client talk directly to the Synergy server directly. There's a chance that someone can be listening on your communication. Instead, use ssh tunneling so that the communication is secure. I also suggest using autossh so that it knows to reconnect if your client gets disconnected (e.g. laptop went to sleep). You can install autossh through Homebrew.
brew install autossh
Saturday, February 21, 2015
Thoughts Fedora 21
Saturday, January 3, 2015
Powerline compatible Terminus Font for OSX
On OSX, it's a little more troublesome. A search on Google will turn up three different versions in the first three results. In the past, I've used the one here. However, if you use something like powerline or vim-airline it doesn't have all the symbols so for some things it will just use the characters like '>>' and '>'.
To have those nice symbols, you generally need a 'patched' version of the font that has those symbols (this just means they added the characters to the font collection). You can find versions of many popular programming fonts here.
You'll notice that Terminus is part of the collection except that the format that is included isn't compatible with OSX. Thus, I have always had to live with the characters above. The latest version of Terminus TTF from here now includes the powerline symbols and so I was able to install it and now my status bar looks like all those other pretty ones out there!
Thursday, January 1, 2015
OSX load order of your bashrc
- ~/.bash_profile
- ~/.bash_login
- ~/.profile
Thursday, December 18, 2014
Building Protobuf on OSX
Step 1: Get the build tools.
If you have all the build tools installed then skip ahead, but on the particular machine that I was using it didn't. So I had to do the following:
Install Xcode command line tools
xcode-select --install
Install the GNU build tools (autoconf, automake, libtool):
curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-latest.tar.gz
tar -xzf autoconf-latest.tar.gz
cd autoconf-2.69./configure && make && sudo make install
curl -OL http://ftpmirror.gnu.org/libtool/libtool-2.4.2.tar.gz
tar -xzf libtool-2.4.2.tar.gz
cd libtool-2.4.2./configure && make && sudo make install
curl -OL http://ftpmirror.gnu.org/automake/automake-1.14.tar.gz
tar -xzf automake-1.14.tar.gz
cd automake-1.14
./configure && make && sudo make install
git clone git://github.com/google/protobuf
cd protobuf
./autogen.sh
configure
make
sudo make install
go get -u github.com/golang/protobuf/proto
go get -u github.com/golang/protobuf/protoc-gen-go
The system can now compile your proto files to let you use it in your code:
protoc --go_out=.
Saturday, August 17, 2013
Setting up Vim for Go
I've been playing around with the Go programming language recently and so I wanted to configure VIM to work better with it. The Go package comes with vim plugins for syntax highlighting, indentation and helper functions which is a good start, but I wanted to have some of the nice things that I set up previously for other languages that used more frequently such as being able to jump to functions, auto completions, etc. The Go community have made this dead simple and will only take a few minutes.
Auto-Completion
While I'm not a big fan of IDEs, one feature I always do want is context aware auto-completion (e.g. type in a partial function name and get a list of possibilities). I remember using a Norton tool as far as the DOS days since I'm terrible at remembering the exact spelling of function names/variables, members, etc.
Gocode is a daemon that will provide this functionality. It is a daemon that is editor-agnostic so it can be used by VIM, Emacs, Sublime Text, etc. Setup is a one-liner:
go get -u github.com/nsf/gocodeThen use the vundle VIM plugin by adding this to your .vimrc:
bundle Blackrush/vim-gocodeThe plugin will automatically start the daemon if it is not already running or you can start/stop it manually.
I use the SuperTab plugin so that when I hit "Tab" that it brings up the autocomplete menu so I set this in my .vimrc:
let g:SuperTabDefaultCompletionType = "context"There you go! Auto-completion for Go in VIM.
CTags/Tagbar
I use ctags to to let VIM know how to jump to declarations (e.g. cursor on a function name and jump to the function definition). To add Go support to CTags, use the gotags package.
go get -u github.com/jstemmer/gotagsThe README.md even has the VIM configuration for using with the Tagbar plugin!
Misc
I also added this to my .vimrc:
-
au FileType go au BufWritePre <buffer> Fmt
autocmd FileType go setlocal tabstop=4
Friday, August 24, 2012
Shuttle XH61
For portability we already have the Android tablet and a Google Chromebook (CR48) so portability was not as crucial as when we bought the Thinkpad. At that time, mini PCs were non-existent or a joke of a machine. Now, there are small powerful options that can do everything short of playing super high-end games. My first thought was get a Chromebox. I really like the ease and convenience of ChromeOS. It's small, fast and does the majority of the things that people use their computers for these days (browsing the web and using web applications). Another benefit is that it really have zero to low maintenance. However, the one shortcoming of the Chromebox is its peripheral support. I don't think it's able to use my network printer and scanner directly so I reluctantly gave up on the little beauty.
The next obvious option is the mac mini, but after mulling it over it feels underpowered for the price. The starting price is not too bad, but the memory upgrade is expensive, there is no optical drive and I've been disappointed with Lion and Mountain Lion. I also worry about the direction that Apple is going which seem to be to put a lot of restrictions on a general purpose PC to make it not general purpose.
After searching around for the mini-desktop PC, I finally decided to buy the Shuttle XH61 barebones system and put together a machine myself. Along with the kit, I had to buy a CPU (Intel Core i7 2600S), memory (8GB), bluetooth adaptor, solid state drive and an optical drive. The i7 comes with an integrated GPU so I don't need to buy a separate video card unless I plan to do highend gaming, but this is not the rig for that. For the OS, I ended up going with Windows 7 instead of Linux simply for the ease of running my wife's apps.
Putting the system together was surprising easy. Putting all the components (CPU, memory and SSD) in took about 30 minutes and it had no problems recognizing the external USB DVD drive on boot-up. The machine is super quiet and the i7 is a speedy little sucker. Installing Windows 7 was fast on the SSD, memory and network so her new machine was up in less then an hour.
Some shortcomings of the system include it doesn't come with any video cables for this video output (VGA or HDMI). It doesn't have DVI (just analog VGA and HDMI), but fortunately I had a spare HDMI cable lying around. It doesn't come with bluetooth (needed for keyboard) or WIFI support (does have gigabit ethernet which is what I'll be using anyway).
All-in-all, it is a fine little system that runs super quiet and makes my wife happy.
Monday, February 20, 2012
Vundle to manage my VIM plugins.
That lead me to Eclim which is an Eclipse and VIM plugin combo that allowed VIM to access Eclipse's functionality. This is pretty cool as it allowed me to do most of my work in VIM and switch to Eclipse when I needed to. While this solution works, I started getting the itch to see how VIM can handle some of the tasks I was depending on Eclipse for so I started looking at various VIM plugins which led me to research how to manage plug-ins in general.
Initially all the info I found talked about Pathogen which allowed each plug-in to be stored in its own directory and address the big problem of having all of your plugins clumped together in the .vim directories. However, you still had to manually download and install each plugin. Most users of Pathogen went the path of using Git to manage the plugins pulling each plugin from Git as a submodule. I was about to give Pathogen a try when I came across Vundle. Vundle take Pathogen and take it one step further by integrating the downloading and installation of your plugins.
Essentially, you install the Vundle plugin and then in your .vimrc list the plugins you want to use. Start up VIM and do a ":BundleInstall" and it will download the plugins to their own directory and install/upgrade each one. It's all very clean.
set nocompatiblefiletype offset rtp+=~/.vim/bundle/vundlecall vundle#rc()Having this at the top of your .vimrc and you can immediately see what kind plugins to use (remove one and Vundle will uninstall it for you as well). If you share your .vimrc across multiple machine (i.e. through github) you don't have worry about keeping copies or download the plugins yourself since vundle handles all of that.
Bundle 'gmarik/vundle'
Bundle "bufexplorer.zip"Bundle "snipMate"Bundle "SuperTab-continued."Bundle "taglist.vim"
Bundle "bufkill.vim"Bundle "Command-T"
Saturday, February 18, 2012
Uninstalling MySQL on OSX
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /var/db/receipts/com.mysql*
Wednesday, March 23, 2011
Find out which app is using a port.
lsof -i :<port>
or
netstat -p

