Skip to content

Instantly share code, notes, and snippets.

Kai Wang lotusk

Block or report user

Report or block lotusk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Pyspark Flatten json
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.dataType)
for field in df.schema.fields
if type(field.dataType) == ArrayType or type(field.dataType) == StructType])
while len(complex_fields)!=0:
lotusk /
Created Jun 21, 2019 — forked from frengky/
Update Nvidia driver on CentOS 7.x after kernel update

Update Nvidia driver on CentOS 7.x

Download the latest Nvidia driver on

Update the kernel to the latest version

$ yum update

Change to runlevel 3 - multi user mode for the next reboot

lotusk /
Created Sep 17, 2018 — forked from mrkwjc/
CUDA vs. CPU sparse solver in Python
# ### Interface cuSOLVER PyCUDA
import pycuda.gpuarray as gpuarray
import pycuda.driver as cuda
import pycuda.autoinit
import numpy as np
import scipy.sparse as sp
import ctypes
## Wrap the cuSOLVER cusolverSpDcsrlsvqr() using ctypes
View HostSizeFilter.scala
lotusk / gist:6051962
Created Jul 22, 2013
这里的 jedisPool 如果不先搞成父类就无法调用 returnBrokenResource方法. 为什么,,why 类似这样的情况有无其他方法
View gist:6051962
package com.zhisuo.redis
import redis.clients.jedis.Jedis
import redis.clients.jedis.JedisPool
import redis.clients.jedis.BinaryJedis
import redis.clients.util.Pool
* 基本redis访问
You can’t perform that action at this time.