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
| # + http://stackoverflow.com/questions/11826054/valueerror-invalid-literal-for-int-with-base-16-x0e-xa3-python | |
| encodeByte(3, 42) | |
| #-84 | |
| n = '\x03' | |
| n | |
| #'\x03' | |
| len(n) | |
| #1 | |
| int(n) | |
| #Traceback (most recent call last): |
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 main | |
| import "fmt" | |
| func fmap( f (func(int) int), a []int) []int { | |
| for i:= range a { | |
| a[i] = f(a[i]) | |
| } | |
| return a | |
| } |
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
| #!env bash | |
| # Xilinx tools: http://www.xilinx.com/support/documentation/boards_and_kits/xtp044.pdf | |
| # Bluespec: http://www.bluespec.com/forum | |
| # Xilix ISE:http://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/design-tools/v2012_4---14_6.html | |
| # This is for bash -- if using interactively with zsh, consider | |
| # setting sh_word_split on, or using $=<PARAM> instead of $PARAM | |
| # TODO: Make sure all updates to $PATH are written to .${SHELL}rc |
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
| 1000 8 985 8 0 | |
| 2000 0 999 0 0 | |
| 3000 1 996 1 0 | |
| 4000 14 981 14 0 | |
| 5000 32 964 32 0 | |
| 6000 40 955 40 0 | |
| 7000 33 963 33 0 | |
| 8000 39 956 39 0 | |
| 9000 36 959 36 0 | |
| 10000 36 960 36 0 |
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.io.IOException; | |
| import java.util.StringTokenizer; | |
| import org.apache.hadoop.conf.Configuration; | |
| import org.apache.hadoop.fs.Path; | |
| import org.apache.hadoop.io.IntWritable; | |
| import org.apache.hadoop.io.Text; | |
| import org.apache.hadoop.mapreduce.Job; | |
| import org.apache.hadoop.mapreduce.Mapper; | |
| import org.apache.hadoop.mapreduce.Reducer; |
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
| /** | |
| * A mini tutorial on JavaScript Object Inheritance | |
| * | |
| * API myPerson = person.create() creates a person object | |
| * myPerson.id set/get ID | |
| * myPerson.name set/get name | |
| * myPerson.age set/get age | |
| * myPerson.salute() return a salute (incl. name) | |
| * person.staticSalute() returns a static salute (no name) | |
| * |
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
| /* | |
| A simple new-line delimited JSON protocol with upgrades. | |
| Receiving Usage: | |
| protocol = require('./frame-protocol'); | |
| // parsing data | |
| parser = protocol.Parser(); |
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
| FROM ubuntu | |
| RUN apt-get update | |
| RUN apt-get install -y socat | |
| VOLUME /foo | |
| CMD socat UNIX-LISTEN:/foo/bar.sock - |
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
| function memoize(fun) { | |
| // memoize a function with arbitrary arguments | |
| var memo = {} | |
| var name = fun.name || "anonymous"; | |
| return function memoize_fun() { | |
| this.name = this.name + "__" + name; | |
| var args = arguments; | |
| var sargs = JSON.stringify(args); | |
| if (memo[sargs]) { | |
| return memo[sargs]; |
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
| // http://stackoverflow.com/questions/7505623/colors-in-javascript-console | |
| // https://github.com/adamschwartz/log | |
| // color-console | |
| (function() { | |
| var exportedLog, ffSupport, formats, getOrderedMatches, hasMatches, isFF, | |
| isIE, isOpera, isSafari, log, makeArray, operaSupport, safariSupport, | |
| stringToArgs, _log; | |
| if (!(window.console && window.console.log)) { | |
| return; |