Skip to content

Instantly share code, notes, and snippets.

View csuter's full-sized avatar

Christopher Suter csuter

  • Google
  • NYC, New York
View GitHub Profile
def intersect(l1, l2):
# l1 and l2 are lines specified by 3 coefficients, as in
# a x + b y + c = 0
mat = jnp.stack([l1[:2], l2[:2]], axis=0)
vec = -jnp.stack([l1[2], l2[2]], axis=0)
return jnp.linalg.solve(mat, vec)
def intersection_depth(x, hd, seg):
def _cross(u, v):
return u[0] * v[1] - u[1] * v[0]
#!/bin/bash
reliably_download()
{
ssh_user=$1
remote_host=$2
remote_file=$3
local_file=$4
# default to 3 tries
max_tries=${5-3}
import java.io.*;
import java.util.zip.CheckedInputStream;
import java.util.zip.CheckedOutputStream;
import java.util.zip.CRC32;
import org.apache.commons.net.ftp.*;
public class Main implements java.io.Serializable
{
public static void main(String[] args) throws Exception
{
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* import org.apache.log4j.Logger;
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0