This file contains hidden or 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
| extern mod extra; | |
| use std::{int,io,result}; | |
| use extra::{net,net_tcp,uv}; | |
| fn main() { | |
| let (accept_port, accept_chan) = stream(); | |
| let (finish_port, finish_chan) = stream(); | |
| let addr = extra::net_ip::v4::parse_addr("127.0.0.1"); |
This file contains hidden or 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
| alias sha1='openssl dgst -sha1' | |
| SHARED_BASH_REMOTE=~/path/to/dropbox/shared_bash.sh | |
| SHARED_BASH_TMP=~/.bash_shared.sh.tmp | |
| SHARED_BASH_LOCAL=~/.bash_shared.sh | |
| if [ -f $SHARED_BASH_REMOTE ]; then | |
| cp $SHARED_BASH_REMOTE $SHARED_BASH_TMP | |
| if [ -f $SHARED_BASH_LOCAL ]; then | |
| SHARED_LOCAL_SHA=`sha1 $SHARED_BASH_LOCAL | cut -f2 -d=` | |
| SHARED_TMP_SHA=`sha1 $SHARED_BASH_TMP | cut -f2 -d=` |
This file contains hidden or 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
| -- Full precision summation based on http://code.activestate.com/recipes/393090/ | |
| msum :: [Double] -> Double | |
| msum [] = 0 | |
| msum (x:xs) = sum $ foldl' (\ps x' -> reverse (partials x' ps)) [x] xs | |
| partials :: Double -> [Double] -> [Double] | |
| partials x = foldl' (\acc p -> case hilo x p of (hi, 0) -> hi:acc | |
| (hi, lo) -> hi:lo:acc) [] | |
| hilo :: Double -> Double -> (Double, Double) |
This file contains hidden or 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
| package org.jdiscript | |
| import org.jdiscript.handlers.* | |
| import org.jdiscript.util.VMSocketAttacher | |
| import com.sun.jdi.* | |
| VirtualMachine vm = new VMSocketAttacher(12345).attach() | |
| JDIScript j = new JDIScript(vm) | |
| j.monitorContendedEnterRequest({ |
This file contains hidden or 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
| import java.util.Arrays; | |
| import java.util.Random; | |
| public class LexiSortable { | |
| // Converting to hex is fast and easy | |
| private final static char[] HEX_DIGITS = { | |
| '0', '1', '2', '3', '4', '5', '6', '7', | |
| '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' | |
| }; |
This file contains hidden or 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
| public static String toLexiSortable(final double d) { | |
| long tmp = Double.doubleToRawLongBits(d); | |
| return toHexString('d', (tmp < 0) ? ~tmp : (tmp ^ SIGN_MASK)); | |
| } | |
| public static double doubleFromLexiSortable(final String s) { | |
| if (!s.startsWith("d")) { | |
| throw new IllegalArgumentException(s | |
| + " does not represent a double"); | |
| } |
This file contains hidden or 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
| public class LexiSortable { | |
| // Lookup table to find hex digits from bytes. | |
| private final static char[] HEX_DIGITS = { | |
| '0', '1', '2', '3', '4', '5', '6', '7', | |
| '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' | |
| }; | |
| // Lookup table to find bytes from hex digits. | |
| private final static byte[] BYTE_LOOKUP = new byte['F' + 1]; |
NewerOlder