File.open("file_name","r") do |file| while !file.eof? puts file.read(8).unpack('D')[0] end end
Tuesday, November 6, 2012
reading binary files in ruby
Let's say you have a binary file filled with a bunch of doubles:
Thursday, March 29, 2012
create a local svn repository
adapted from here
copy project1/ to project1_cp/
remove hidden files, other crap from project1
in e.g. /home/XXX/svnrep:
verify that project1 builds and works, then remove project1_cp
copy project1/ to project1_cp/
remove hidden files, other crap from project1
in e.g. /home/XXX/svnrep:
svnadmin create project1
svn import /path/to/project1 file:///home/XXX/svnrep/project1/trunk -m "Initial import"
rm -rf /path/to/project1
svn co file:///home/XXX/svnrep/project1/trunk /path/to/project1
verify that project1 builds and works, then remove project1_cp
Tuesday, March 13, 2012
dry-run svn up
See if a svn up will lead to any conflicts:
Alias this (csh):
svn merge --dry-run -r BASE:HEAD .
Alias this (csh):
alias svnupdry 'svn merge --dry-run -r BASE:HEAD .'
Monday, March 5, 2012
ignore whitespace in svn diff
svn diff -x -wthe -x indicates that the next option is an argument for the svn internal diff implementation
other options:
-u (--unified):
Output 3 lines of unified context.
-b (--ignore-space-change):
Ignore changes in the amount of white space.
-w (--ignore-all-space):
Ignore all white space.
--ignore-eol-style:
Ignore changes in EOL style.
-p (--show-c-function):
Show C function name in diff output.
Subscribe to:
Posts (Atom)