This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin | |
It seems that Ruby 2.2.4, string[n] = "x" is not O(1). It was suggested that | |
this was due to UTF-8 encoding, but I see the same performance with US-ASCII. | |
Any ideas? | |
$ ruby --version | |
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-linux] | |
$ time ruby -E US-ASCII:US-ASCII storeseq2.rb 1000 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# cases: | |
# cb ARGS -- if any args, put them on the clipboard | |
# cb | wc -- stdin is a tty, send clipboard to stdout | |
# date | cb -- stdin is not a tty, put stdin on clipboard | |
# | |
if [ $# -ne 0 ] | |
then | |
echo -n $* | cb |