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"
Thursday, January 5, 2012
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.
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
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.
After that you go to your browser at localhost:8099 and you'll get the response you set up.
# 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.
Thursday, October 28, 2010
focus
I had been running some scripts, but kept getting distracted.
I found a linux script for a dialog alert, but not one for OSX, so here is my modified script for OSX.
I found a linux script for a dialog alert, but not one for OSX, so here is my modified script for OSX.
#!/bin/bash
eval $@
if [[ $? -eq 0 ]]; then
osascript -e 'tell application "Finder"' -e "activate" -e "display dialog \"Command '$@' in $PWD completed.\"" -e 'end tell';
else
osascript -e 'tell application "Finder"' -e "activate" -e "display dialog \"Command '$@' in $PWD failed! $@\"" -e 'end tell';
fi
Thursday, September 16, 2010
Yay Conque
I just found this vim plugin called Conque that lets you run a shell inside your vim window. It looks almost perfect.
Tuesday, September 14, 2010
Copy from and Paste to Native OS X Clipboard in Vim
I was annoyed that the builtin OSX vim version on Snow Leopard could not copy to the clipboard. I grabbed this homebrew formula http://github.com/adamv/homebrew/blob/duplicates/Library/Formula/vim.rb and recompiled vim with it. I had to move the existing vim out of way for some reason and then I had a shiny new vim with clipboard support. Just "set clipboard=unnamed" in your .vimrc file.
Subscribe to:
Posts (Atom)