Tuesday, September 2, 2014

Google OpenId is broken

For some reason google open id is broken.

Monday, August 26, 2013

Mac Irritations

I recently I had to use a loaner Mac because mine was on the fritz and I realized how many customizations I had made on the machine.  Here is a list of some things that irritated me, just in case I need to move to a new system in the future:

beeping terminal
pageup and down in osx not working
capslock as escape key
install homebrew
install tmux
vim configuration spf13 with tweaks
,inputrc
setup kdiff3 as git difftool
quicksilver not setup
copy and paste not working in eclipse
z command not setup
JAVA_HOME not setup
to get mouse support in tmux
https://bitheap.org/mouseterm/
j.sh not setup

Wednesday, July 3, 2013

Editing markdown with vim

We've started using markdown at work for documentation.  To get it to work with vim, try using https://github.com/suan/vim-instant-markdown.  It works very well, I had to hack the instant-markdown-d server to get it to show images, but it is very snappy and luanches and closes markdown files you edit in vim in your browser.  I also used pngpaste to add my images while editing.  You can create a vim shortcut to create an image link for you using that.  Now I can use the OSX shortcuts to capture images from the desktop and easily insert links to them through vim.

Thursday, January 5, 2012

My Favorite Unix Alias

I use this "z" command every day.  For example, let's say you have a list of files and you want to do something to one of them. 

find . | grep file_im_looking_for   | z


Up pops vim and lets you find the file hilight with the V  command and yank it.  Then you close vim, paste it on the screen and edit your command to do whatever you want.




And here it is, just add to .bash_alias file or .profile:

alias z="tee /tmp/blah; vim /tmp/blah"

How to fix your Tmux copy and paste problems

I had stopped using tmux when I went back to OSX because the copy quit working, but I've been wanting it back because I really want to use my better copy mode to copy existing text on the screen, and because it lets you search through your open windows.


So finally someone has done the research and work to get this working correctly and in a non-invasive way.  Beautiful, I can go back now. 

https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard


Thank you Chris Johnsen.

Wednesday, June 15, 2011

Java Trie

I have been looking for some Java based string Tries, preferably one with compression. Here is what I've come up with so far.


There is a TernaryStringTrie in the jaspell.sourceforge.com http://jaspell.sourceforge.net/javadocs/pt/tumba/spell/TernarySearchTrie.html

There is the open patricia trie http://code.google.com/p/patricia-trie/

I just found a simple PrefixTrie one in strut2. http://struts.apache.org/2.2.3/struts2-core/apidocs/org/apache/struts2/util/PrefixTrie.html

I guess there is this one.
http://www.java2s.com/Open-Source/Java-Document/Internationalization-Localization/icu4j/com/ibm/icu/impl/CharTrie.java.htm

There is this one
http://www.digitaltsunami.net/projects/wordscope/site/apidocs/net/digitaltsunami/word/util/CharTrie.html

I would like something like the marisa trie implemented in java.
http://code.google.com/p/marisa-trie/

There is this one:
http://www.badgenow.com/p/radixtree/

This one works well: https://code.google.com/p/radixtree-java/

There is one here that gives a high degree of compression and sacrifices speed:
https://github.com/ning/tr13

Here is a nice comparison test that compares tr13 with hash implementations in terms of space and time.
http://groups.google.com/group/ning-tr13-users/msg/8c3e942335676b96

For compression I found the dsiutils project here

Wednesday, November 10, 2010

Use netcat as a fake server to debug http issues

I had a problem with my http server where my cookie didn't seem to be accepted by the browser and resent. To debug the issue I wanted to be able to edit the headers that were being sent back to the browser. Here is the technique I used to quickly find the issue.


# use curl to pull the raw response
# from the server and the headers that were sent back

curl -D headers2 --raw www.serverwithproblem.com > raw2.txt

# concatenate the headers and response into one file

cat headers2 raw2.txt > both2.txt

# cause netcat to listen on a specified port
# and cat your mock response to it

cat both2.txt | nc -l 8099

# netcat will sit and wait for your request
# now aim your browser at localhost:8099


After that you go to your browser at localhost:8099 and you'll get the response you set up.