from https://github.com/spite/Wagner
509189
function LGraphLensFX() {
            this.addInput("in", "Texture");
            this.addInput("f", "number");
            this.addOutput("out", "Texture");
            this.properties = {
                enabled: true,
                factor: 1,
                precision: LGraphTexture.LOW
            };

            this._uniforms = { u_texture: 0, u_factor: 1 };
        }
210068
def get_signum(val, err, max_sig=numpy.inf):
    
    coeff, pwr = ('%e' % err).split('e')
    if pwr.startswith('-'):
        pwr = int(pwr[1:])
        if round(float(coeff)) == 10.:
            pwr -= 1
        pwr = min(pwr, max_sig)
        tmplt = '%.' + str(pwr+1) + 'f'
        return tmplt % val
    else:
        pwr = int(pwr[1:])
        if round(float(coeff)) == 10.:
            pwr += 1
        # if the error is large, we can sometimes get 0;
        # adjust the round until we don't get 0 (assuming the actual
        # value isn't 0)
        return_val = round(val, -pwr+1)
        if val != 0.:
            loop_count = 0
            max_recursion = 100
            while return_val == 0.:
                pwr -= 1
                return_val = round(val, -pwr+1)
                loop_count += 1
                if loop_count > max_recursion:
                    raise ValueError("Maximum recursion depth hit! Input " +\
                        "values are: val = %f, err = %f" %(val, err))
        return drop_trailing_zeros(return_val)
357621
function makeAcyclic(g) {
    var onStack = {};
    var visited = {};

    function dfs(u) {
      if (u in visited) {
        return;
      }
      visited[u] = true;
      onStack[u] = true;
      g.successors(u).forEach(function(v) {
        if (v in onStack) {
          g.addEdge(v, u);
          g.removeEdge(u, v);
        } else {
          dfs(v);
        }
      });
      delete onStack[u];
    }

    g.nodes().forEach(function(u) {
      dfs(u);
    });
  }
196240
function kruskal(weightFn) {
    weightFn = weightFn || function (edge) {
      return 1;
    };

    var _this$byGroup = this.byGroup(),
        nodes = _this$byGroup.nodes,
        edges = _this$byGroup.edges;

    var numNodes = nodes.length;
    var forest = new Array(numNodes);
    var A = nodes; // assumes byGroup() creates new collections that can be safely mutated

    var findSetIndex = function findSetIndex(ele) {
      for (var i = 0; i < forest.length; i++) {
        var eles = forest[i];

        if (eles.has(ele)) {
          return i;
        }
      }
    }; // start with one forest per node


    for (var i = 0; i < numNodes; i++) {
      forest[i] = this.spawn(nodes[i]);
    }

    var S = edges.sort(function (a, b) {
      return weightFn(a) - weightFn(b);
    });

    for (var _i = 0; _i < S.length; _i++) {
      var edge = S[_i];
      var u = edge.source()[0];
      var v = edge.target()[0];
      var setUIndex = findSetIndex(u);
      var setVIndex = findSetIndex(v);
      var setU = forest[setUIndex];
      var setV = forest[setVIndex];

      if (setUIndex !== setVIndex) {
        A.merge(edge); // combine forests for u and v

        setU.merge(setV);
        forest.splice(setVIndex, 1);
      }
    }

    return A;
  }
1023253
def _JzIntegrand(z,Ez,pot):
    """"""
    return nu.sqrt(2.*(Ez-potentialVertical(z,pot)))
52288
function TaskFormatter(o) {
        
        var fn=(o.prefix?o.prefix+'_':'')+o.name;
        var params='p';
        var paramspec=o.as||[];
        
        for (var i in paramspec) {
          var pname=paramspec[i][0][1];
          if (i==0) {
            addLocal(pname,'=p');
          } else {
            removeLocal(pname);
            params+=','+pname;
          }
        }

        if (SafetyFetch) { addLocal('$_b'); SafetyFetch=false; }
        if (FunctionChain) { addLocal('$_c'); addLocal('$_d'); FunctionChain=false; }
        if (!o.nothis) {
          if (o.unbound) {
            addLocal('$','=undefined');
          } else if (o.property) {
            addLocal('$','=this');
          } else {
            addLocal('$','=this['+fn+']?this:$bindfail('+fn+')');
          }
        }
        
        var rawFunctionName=fn.substring(1,fn.length-1);
        var head='', tail='';
        var sup=GlobVar();
        if (o.prefix!='get' && o.prefix!='set') {
          addToList('lock',rawFunctionName);
          head='var '+sup+'=prototype['+fn+'] || function(){};\n';
          if (o.unbound) {
            head+='var _'+rawFunctionName+'=';
          }
          head+='prototype['+fn+']=';
          tail=';\n';
        }
      
        if (o.unbound) {
          o.body=o.body.replace(/\^\[U,b,\?/g, "^[U,u,"+o.name);
        }
        o.body=Linker(o.body,false);
        if (o.unbound) {
          checkUsedMemberVar(fn+'(t)');
        } usedMemberVar=false;
      
        if (!o.preface) o.preface='';
        if (!o.postface) o.postface='';
        var fun=o.kind+'('+params+') {\n'+o.preface+getLocals();
        if (o.expects) {
          fun+=GetExpectsTester(o.expects,fn);
        }
        fun+='{'+o.body+'}'+o.postface; // function body
        fun+='}';
      
        if (o.name) {
          if (fun.indexOf('^{this}')>-1) fail("SAI Compiler: Cannot use unrooted attribute (e.g. 'it') without a context, though the context may have been lost by a syntax error somewhere.\n\n"+fun);
        }
        var r=RV(head+fun+tail,{this:false,super:sup});

        return r;

      }
125401
function tail (argv, callback) {
  if (!argv[2]) {
    console.error('url is required')
    console.error('Usage : tail <url>')
    process.exit(-1)
  }
  var uri = argv[2]
  var wss = 'wss://' + uri.split('/')[2] + '/'

  var s = new ws(wss, {
    origin: 'http://websocket.org'
  })

  s.on('open', function open () {
    s.send('sub ' + uri)
  })

  s.on('close', function close () {
    console.log('disconnected')
  })

  s.on('message', function message (data, flags) {
    var a = data.split(' ')
    if (a.length && a[0] === 'pub') {
      util.get(a[1], function (err, res) {
        if (err) {
          console.error('Error : ' + err)
        } else {
          console.log(res)
        }
      })
    }
  })
}
1328780
function compit(ca,cb,aa,ab) {
            return (ca*aa + cb*ab * (1-aa)) / (aa+ab*(1-aa));
        }
700547
function(args, fn, type) {
    this.args = args;
    this.fn = fn;
    this.type = type;

    this.id = prefix + _code_node_id_count++;
}
671468
public function &c() {
    $args = func_get_args();
    if (count($args) > $this->argsCount) {
      $rel = array_pop($args); // rel ist übergeben worden
    } else {
      $rel = 0;
    }
    for ($i=0; $i < $this->argsCount; $i++) {
      $this->values[$i][] = $args[$i];
    }

    $key = $this->getKey($args);
    if (!array_key_exists($key,$this->counts)) {
      $this->counts[$key] = $this->initCount;
    }
    $ref =& $this->counts[$key];
    $ref += $rel;
    return $ref;
  }
334977
function(arg, handler) {
		handler = handler ? handler : this.spirit;
		gui.Array.make(arg).forEach(function(type) {
			if (this._removechecks(type, [handler])) {
				if (this._handlers[type]) { // weirdo Gecko condition...
					var index = this._handlers[type].indexOf(type);
					gui.Array.remove(this._handlers[type], index);
					if (this._handlers[type].length === 0) {
						delete this._handlers[type];
					}
				}
			}
		}, this);
		return this.spirit;
	}
234072
function computeStackTraceFromStacktraceProp(ex) {
        // Access and store the stacktrace property before doing ANYTHING
        // else to it because Opera is not very good at providing it
        // reliably in other circumstances.
        var stacktrace = ex.stacktrace;
        if (!stacktrace) {
            return;
        }

        var opera10Regex = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,
            opera11Regex = / line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^\)]+))\((.*)\))? in (.*):\s*$/i,
            lines = stacktrace.split('\n'),
            stack = [],
            parts;

        for (var line = 0; line < lines.length; line += 2) {
            var element = null;
            if ((parts = opera10Regex.exec(lines[line]))) {
                element = {
                    'url': parts[2],
                    'line': +parts[1],
                    'column': null,
                    'func': parts[3],
                    'args':[]
                };
            } else if ((parts = opera11Regex.exec(lines[line]))) {
                element = {
                    'url': parts[6],
                    'line': +parts[1],
                    'column': +parts[2],
                    'func': parts[3] || parts[4],
                    'args': parts[5] ? parts[5].split(',') : []
                };
            }

            if (element) {
                if (!element.func && element.line) {
                    element.func = guessFunctionName(element.url, element.line);
                }
                if (element.line) {
                    try {
                        element.context = gatherContext(element.url, element.line);
                    } catch (exc) {}
                }

                if (!element.context) {
                    element.context = [lines[line + 1]];
                }

                stack.push(element);
            }
        }

        if (!stack.length) {
            return null;
        }

        return {
            'mode': 'stacktrace',
            'name': ex.name,
            'message': ex.message,
            'stack': stack
        };
    }
1100197
function loop(loopGroup, loopItems) {
        return {
            task: function (taskName, human, gulpTask) {
                let subtasks = [];
                Object
                    .keys(loopItems)
                    .forEach(key => {
                        let loopTaskItem = `${loopGroup}:${taskName}:${key}`;
                        let value = loopItems[key];
                        subtasks.push(loopTaskItem);
                        let wrapGulpTask = (gulpTask? (done) => gulpTask(done, value) : undefined);
                        task(loopTaskItem, (args) => human({ ...args, loop: value }), wrapGulpTask);
                    })
                _defineSequence2(
                    `${loopGroup}:${taskName}`,
                    subtasks
                );
            }
        };

        function _defineSequence2(taskName, taskList) {
            _gulp.task(taskName, function (done) {
                sequence(...taskList, function (error) {
                    if (error) {
                        console.log(error.message);
                    } else {
                        console.log(`${taskName} terminó OK`);
                    }
                    done(error);
                });
            });
        }
    }
581824
def yeasttruth(args):
    
    p = OptionParser(yeasttruth.__doc__)
    p.set_outfile()
    opts, args = p.parse_args(args)

    if len(args) < 2:
        sys.exit(not p.print_help())

    pillars = args[0]
    gffiles = args[1:]
    aliases = {}
    pivot = {}
    for gffile in gffiles:
        is_pivot = op.basename(gffile).startswith("Saccharomyces_cerevisiae")
        gff = Gff(gffile)
        for g in gff:
            if g.type != "gene":
                continue
            for a in g.attributes["Alias"]:
                aliases[a] = g.accn
                if is_pivot:
                    pivot[a] = g.accn
    logging.debug("Aliases imported: {0}".format(len(aliases)))
    logging.debug("Pivot imported: {0}".format(len(pivot)))
    fw = open("yeast.aliases", "w")
    for k, v in sorted(aliases.items()):
        print("\t".join((k, v)), file=fw)
    fw.close()

    fp = open(pillars)
    pairs = set()
    fw = must_open(opts.outfile, "w")
    for row in fp:
        atoms = [x for x in row.split() if x != "---"]
        pps = [pivot[x] for x in atoms if x in pivot]
        atoms = [aliases[x] for x in atoms if x in aliases]
        for p in pps:
            for a in atoms:
                if p == a:
                    continue
                pairs.add(tuple(sorted((p, a))))

    for a, b in sorted(pairs):
        print("\t".join((a, b)), file=fw)
    fw.close()
1007627
function f_tahta_ihale_gizlenen_tumu(_tahta_id) {
        return f_tahta_ihale_gizlenen_idler(_tahta_id)
            .then(function (_ihale_idler) {
                if (_ihale_idler && _ihale_idler.length > 0) {
                    /** @type {OptionsIhale} */
                    var opts = {};
                    opts.bArrKalemleri = true;
                    opts.bYapanKurum = true;
                    opts.bTakip = true;
                    opts.optKalem.bArrTeklifleri = false;
                    opts.optKalem.bOnayDurumu = true;
                    opts.optKalem.bTakiptemi = true;
                    var db_ihale = require("./db_ihale");
                    return db_ihale.f_db_ihale_id(_ihale_idler, _tahta_id, opts);
                } else {
                    return [];
                }
            });
    }
802733
function () {
		var freq = new Int32Array(hands.length);
		var start = Date.now();
		for (var c1 = 1; c1 <= deckSize; c1++) {
			var r1 = evaluator[deckSize + c1 + 1];
			for (var c2 = c1 + 1; c2 <= deckSize; c2++) {
				var r2 = evaluator[r1 + c2];
				for (var c3 = c2 + 1; c3 <= deckSize; c3++) {
					var r3 = evaluator[r2 + c3];
					for (var c4 = c3 + 1; c4 <= deckSize; c4++) {
						var r4 = evaluator[r3 + c4];
						for (var c5 = c4 + 1; c5 <= deckSize; c5++) {
							var r5 = evaluator[r4 + c5];
							for (var c6 = c5 + 1; c6 <= deckSize; c6++) {
								var r6 = evaluator[r5 + c6];
								for (var c7 = c6 + 1; c7 <= deckSize; c7++) {
									var r7 = evaluator[r6 + c7];
									freq[r7 >> 12]++;
		}	}	}	}	}	}	}
		var finish = Date.now();
		var total = 0;
		for (var key = 0; key < hands.length; key++) {
			total += freq[key];
			console.log(hands[key] + ': ' + freq[key]);
		}
		console.log('Total: ' + total);
		console.log((finish - start) + 'ms');
	}
610716
function Graphviz() {
		var sb = []
		function print(x) {
			sb.push(x)
		}
		print("digraph {")

		var seen_nodes = Object.create(null)
		function makeNodeLabel(node) {
			var str = []
			if (node.isObject) {
				str.push("object")
			}
			if (node.isAny) {
				str.push("any")
			}
			if (node.global) {
				str.push("global")
			}
			node.primitives.forEach(function(t) {
				str.push(formatType(t))
			})
			str.push(node.id)
			return str.join(',')
		}
		var tnode_id = 1;
		function makeTypeNodeId() {
			return 'T' + (tnode_id++)
		}
		function visitTypeNode(tnode, id) {
			print(id + ' [shape=diamond]')
		}
		function visitNode(node) {
			node = node.rep()
			if (seen_nodes[node.id])
				return
			seen_nodes[node.id] = true
			print(node.id + ' [shape=box,label="' + escapeLabel(makeNodeLabel(node)) + '"]')
			if (!node.global || isLive(node)) {
				markAsLive(node)
				node.properties.forEach(function(name,dst) {
					if (name in {})
						return // ignore trivial properties
					if (dst.type === 'node') {
						print(node.id + ' -> ' + dst.node.rep().id + ' [label="' + escapeLabel(name) + '"]')
						visitNode(dst.node)
					} else {
						var id = makeTypeNodeId()
						print(node.id + ' -> ' + id + ' [label="' + escapeLabel(name) + '"]')
						visitTypeNode(dst, id)
					}
				})
				node.prototypes.forEach(function(proto) {
					print(node.id + ' -> ' + proto.rep().id + ' [label="[proto]"]')
					visitNode(proto)
				})
			}
		}

		function visitFNode(fnode) {
			visitNode(fnode.self)
			visitNode(fnode.this)
			visitNode(fnode.arguments)
			visitNode(fnode.return)
			if (fnode.env)
				visitNode(fnode.env)
			// todo: calls?
		}
		var calln = 0
		function visitCall(call) {
			visitNode(call.self)
			visitNode(call.this)
			visitNode(call.arguments)
			visitNode(call.return)
			var id = 'call_' + (calln++)
			print(id + ' [shape=record,label="{{<self> self|<this> this|<arguments> arguments|<return> return}}"]')
			print(call.self.rep().id + " -> " + id + ':self')
			print(call.this.rep().id + " -> " + id + ':this')
			print(call.arguments.rep().id + " -> " + id + ':arguments')
			print(call.return.rep().id + " -> " + id + ':return')
		}

		var node2live = Object.create(null)
		function isLive(node) {
			return node2live[node.rep().id]
		}
		function markAsLive(node) {
			node2live[node.rep().id] = true
		}
		function checkLive(node) {
			node = node.rep()
			if (node.id in node2live)
				return node2live[node.id]
			node2live[node.id] = false
			var isLive = false
			node.properties.forEach(function(name,dst) {
				if (dst.type === 'node' && checkLive(dst.node)) {
					isLive = true
				}
			})
			return node2live[node.id] = isLive
		}
		
		function findAdditionalNodes() {
			all_unodes.forEach(function(node) {
				if (checkLive(node)) {
					visitNode(node)
				}
			})
		}

		this.visitNode = visitNode
		this.visitFNode = visitFNode
		this.visitCall = visitCall
		this.finish = function() {
			findAdditionalNodes()
			print("}\n")
			return sb.join('\n')
		}
	}