Download the latest Nvidia driver on http://www.nvidia.com/drivers
Update the kernel to the latest version
$ yum update
Change to runlevel 3 - multi user mode for the next reboot
| import sys | |
| from awsglue.transforms import * | |
| from awsglue.utils import getResolvedOptions | |
| from pyspark.context import SparkContext | |
| from awsglue.context import GlueContext | |
| from awsglue.job import Job | |
| from pyspark.sql.functions import * | |
| from awsglue.dynamicframe import DynamicFrame | |
| // Invoke Spark Shell | |
| $ glue-spark-shell -v --properties-file /home/glue/glue_spark_shell.properties --packages com.databricks:spark-avro_2.11:4.0.0 | |
| // Import Required Classes | |
| import org.apache.spark.SparkContext | |
| import com.amazonaws.services.glue.GlueContext | |
| import com.amazonaws.services.glue.DynamicFrame | |
| import com.amazonaws.services.glue.DynamicRecord | |
| import com.amazonaws.services.glue.MappingSpec | |
| import com.amazonaws.services.glue.errors.CallSite |
| from pyspark.sql.types import * | |
| from pyspark.sql.functions import * | |
| #Flatten array of structs and structs | |
| def flatten(df): | |
| # compute Complex Fields (Lists and Structs) in Schema | |
| complex_fields = dict([(field.name, field.dataType) | |
| for field in df.schema.fields | |
| if type(field.dataType) == ArrayType or type(field.dataType) == StructType]) | |
| while len(complex_fields)!=0: |
| #!/usr/bin/env python3 | |
| # | |
| # Query AWS Athena using SQL | |
| # Copyright (c) Alexey Baikov <sysboss[at]mail.ru> | |
| # | |
| # This snippet is a basic example to query Athen and load the results | |
| # to a variable. | |
| # | |
| # Requirements: | |
| # > pip3 install boto3 botocore retrying |
| #! /usr/bin/env python | |
| # | |
| # Mixpanel, Inc. -- http://mixpanel.com/ | |
| # | |
| # Python API client library to consume mixpanel.com analytics data. | |
| # | |
| # Copyright 2010-2013 Mixpanel, Inc | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. |
| # ### Interface cuSOLVER PyCUDA | |
| from __future__ import print_function | |
| import pycuda.gpuarray as gpuarray | |
| import pycuda.driver as cuda | |
| import pycuda.autoinit | |
| import numpy as np | |
| import scipy.sparse as sp | |
| import ctypes |
Download the latest Nvidia driver on http://www.nvidia.com/drivers
Update the kernel to the latest version
$ yum update
Change to runlevel 3 - multi user mode for the next reboot
| #!/bin/bash | |
| current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,') | |
| if [ "$current_branch" = "master" ] || [ "$current_branch" = "develop" ]; then | |
| echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" | |
| echo "" | |
| echo "禁止直接向master或develop分支提交代码!" | |
| echo "" | |
| echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" | |
| exit 1 |
| curl -XPUT 'http://localhost:9200/us/user/1?pretty=1' -d ' | |
| { | |
| "email" : "[email protected]", | |
| "name" : "John Smith", | |
| "username" : "@john" | |
| } | |
| ' | |
| curl -XPUT 'http://localhost:9200/gb/user/2?pretty=1' -d ' | |
| { |
| /* | |
| * 逐行读取文件 | |
| * 分段读取文件 | |
| */ | |
| var fs = require('fs'); | |
| //每段读取的长度 | |
| //@param inputFile{filepath} | |
| //@param onEnd{func} 所有内容读完了 | |
| module.exports = function(inputFile, onEnd){ | |
| var sLength = 1024; |