Assume you've got homebrew installed.
Assume python is installed through
brew install python --universial
| // Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) | |
| // Edits by Glynn Taylor. MIT license | |
| // Includes code for splitmap by https://twitter.com/adamgryu and triplanar mapping by https://github.com/keijiro. MIT License | |
| #ifndef TERRAIN_SPLATMAP_COMMON_CGINC_INCLUDED | |
| #define TERRAIN_SPLATMAP_COMMON_CGINC_INCLUDED | |
| struct Input | |
| { | |
| float3 localNormal : TEXCOORD0; |
| package com.test | |
| import java.net.{URI, URL} | |
| import org.apache.hadoop.conf.Configuration | |
| import org.apache.hadoop.fs.FsUrlStreamHandlerFactory | |
| import org.apache.spark.sql.SparkSession | |
| import org.apache.hadoop.fs.Path; | |
| // build into a jar and run with spark-submit |
Assume you've got homebrew installed.
Assume python is installed through
brew install python --universial
| 当前是i,j in [0...i),first pass算max(A[i]+A[j]+i-j),second pass 算max(A[i]+A[j]+n-(i-j)) | |
| 第一次用公式max_value = max(max_value+1, A[i-1]+1) | |
| 第二次用公式max_value = max(max_value-1, A[i-1]+n-1) | |
| for i in xrange(len(ar)): | |
| #try to update max_value | |
| ret = max(ret, A[i]+max_value) | |
| 这个循环写两次,用两个不同的公式 |
| # deno = [2, 5, 13] | |
| # deno_nums = [1, 3, 1] | |
| # target = 17 | |
| deno = [1, 2, 7, 11] | |
| deno_nums = [5, 18, 1, 7] | |
| target = 82 | |
| # every cell has 4 parts: | |
| # one pointer to the previous cell which is part of current combination |
| def distant(i, j, n): | |
| i%=n | |
| j%=n | |
| dis = abs(j-i) | |
| if ((n-dis) > dis): | |
| dis = n-dis | |
| return dis |
| # -*- coding: utf-8 -*- | |
| ''' | |
| A circular array A[1, . . . , n] is an array such that n ≥ 3 and A[1] and A[n] are considered to be adjacent elements just like A[1] and A[2], A[2] and A[3], etc., are adjacent. | |
| We are given a circular array A[1, . . . , n] of non-negative integers. For any i, j ∈ {1, 2, . . . , n} such that i != j, dist(i, j) = max {|i − j|, n − |i − j|}. | |
| Design a linear time algorithm that computes a maximum number t such that for some i, j ∈ {1, 2, . . . , n}, i != j, t = A[i] + A[j] + dist(i, j). | |
| ''' | |
| def distant(i, j, n): | |
| dis = abs(j-i) |
| --- install2.js 2013-01-25 15:32:38.358227000 +0800 | |
| +++ install.js 2013-01-25 14:29:55.639011700 +0800 | |
| @@ -108,7 +108,9 @@ | |
| unzipStream.on('error', finishIt) | |
| unzipStream.on('close', finishIt) | |
| - var readStream = fs.createReadStream(downloadedFile) | |
| + var zipPath = path.normalize('d:/node/phantomjs-1.8.0-windows.zip') | |
| + var readStream = fs.createReadStream(zipPath) | |
| + //var readStream = fs.createReadStream(downloadedFile) |
| arg_count = foo.func_code.co_argcount | |
| args = foo.func_code.co_varnames[:arg_count] | |
| args_dict = {} | |
| for k, v in d.iteritems(): | |
| if k in args: | |
| args_dict[k] = v | |
| foo(**args_dict) |
| class Foo(object): | |
| def __init__(self): | |
| self._func = None | |
| def callDerivedFunc(self): | |
| # self._func() # call bound method | |
| # self._func(self) # call unbound method | |
| method = self._func | |
| method(self) # call unbound method |