SSH
gcloud compute ssh jian_kuang@compute-engine-instance-with-bigtable-access
Copy
gcloud compute copy-files Anaconda2-4.2.0-Linux-x86_64.sh jian_kuang@genia-datalab-compute:Anaconda2-4.2.0-Linux-x86_64.sh --zone us-central1-b
This file contains 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
def array_left_rotation(a, n, k): | |
if n == k * 2: | |
for i in range(k): | |
a[i+k], a[i] = a[i], a[i+k] | |
else: | |
temp = a[0] | |
i = 0 | |
while True: | |
if i+k < n: | |
a[i] = a[i+k] |
split
Function
>>> str = "Hello,world,how,are,you"
>>> str.split(",")
['Hello', 'world', 'how', 'are', 'you']
>>> str.split(",")[0]
'Hello'
>>> str.split(",")[1]
'world'
>>> str.split(",", 1)
This file contains 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 mysql tables into HDFS using sqoop | |
sqoop import-all-tables --connect jdbc:mysql://localhost/retail_db --username retail_dba --password cloudera | |
# import mysql tables into hive using sqoop | |
sqoop import-all-tables --connect jdbc:mysql://localhost/retail_db --username retail_dba --password cloudera --hive-import --create-hive-table |
This file contains 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
<head> | |
<style> | |
.node circle { | |
fill: #fff; | |
stroke: steelblue; | |
stroke-width: 1.5px; | |
} | |
.node { | |
font: 10px sans-serif; | |
} |
This file contains 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
<body> | |
<script src="https://d3js.org/d3.v3.min.js" charset="utf-8"></script> | |
<script> | |
var width = 960, height = 900, | |
color = d3.scale.category10(); | |
var chart = d3.select("body").append("svg") | |
.attr("width", width).attr("height", height) | |
.append("g") | |
.attr("transform", "translate(50,50)"); |
This file contains 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
<body> | |
<nav><ul> | |
<li><a href="index.html">Pack Layout</a></li> | |
<li><a href="bubblechart.html">Bubble Layout</a></li> | |
</ul></nav> | |
<script src="https://d3js.org/d3.v3.min.js" charset="utf-8"></script> | |
<script> | |
var width = 800, height = 600; | |
var chart = d3.select("body").append("svg") |
This file contains 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
<body> | |
<script src="https://d3js.org/d3.v3.min.js" charset="utf-8"></script> | |
<script> | |
var chart = d3.select("body").append("svg") | |
.attr("width", 500) | |
.attr("height", 500) | |
.append("g") | |
.attr("transform", "translate(50, 50)"); | |
var tree = d3.layout.tree() |
This file contains 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
<body> | |
<script src="https://d3js.org/d3.v3.min.js" charset="utf-8"></script> | |
<script type="text/javascript"> | |
var data = [10, 50, 80]; | |
var r = 300; // outer radius | |
var color = d3.scale.ordinal() | |
.range(["red", "blue", "orange"]); | |
var svg = d3.select("body").append("svg") |
NewerOlder