Author: https://github.com/seanorama
Note: This was tested on HDP 3.1. It may not work with other Spark/YARN distributions.
/** | |
* | |
* Base64 encode / decode | |
* http://www.webtoolkit.info/ | |
* | |
**/ | |
var Base64 = { |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import org.apache.http.HttpResponse; | |
import org.apache.http.client.methods.HttpPost; | |
import org.apache.http.entity.StringEntity; | |
import org.apache.http.impl.client.DefaultHttpClient; | |
public class TestLogin { |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import org.apache.http.HttpResponse; | |
import org.apache.http.client.methods.HttpPost; | |
import org.apache.http.entity.StringEntity; | |
import org.apache.http.impl.client.DefaultHttpClient; | |
public class TestLogin { |
/** | |
* 更改流程实例的流程定义ID | |
* @param processInstanceId | |
* @param processDefinitionId | |
*/ | |
@Transactional | |
public void changeProcessDefinitionId(String processInstanceId, String processDefinitionId) { | |
long count = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionId).count(); | |
if (count == 0) { | |
throw new ServiceException("指定的流程定义不存在!"); |
curl http://spark-cluster-ip:6066/v1/submissions/status/driver-20151008145126-0000 |
import pandas as pd | |
# Spark context | |
import pyspark | |
sc = pyspark.SparkContext() | |
# apply parallel | |
def applyParallel(dfGrouped, func): | |
# rdd with the group of dataframes |
$ab -n 10 -c 2 -p /Users/post_file.txt -T "multipart/form-data; boundary=1234567890" http://localhost/upload | |
post_file.txt (use CRLF line-endings): | |
--1234567890 | |
Content-Disposition: form-data; filename="file.png" | |
Content-Type: application/octet-stream | |
Content-Transfer-Encoding: binary | |
<base64 encoded file> |
import android.os.Build; | |
import java.lang.reflect.Method; | |
public class Device { | |
/** | |
* @return The device's serial number, visible to the user in {@code Settings > About phone/tablet/device > Status | |
* > Serial number}, or {@code null} if the serial number couldn't be found | |
*/ | |
public static String getSerialNumber() { |
############################################################################### | |
# Helpful Docker commands and code snippets | |
############################################################################### | |
### CONTAINERS ### | |
docker stop $(docker ps -a -q) #stop ALL containers | |
docker rm -f $(docker ps -a -q) # remove ALL containers | |
docker rm -f $(sudo docker ps --before="container_id_here" -q) # can also filter | |
# exec into container |
Author: https://github.com/seanorama
Note: This was tested on HDP 3.1. It may not work with other Spark/YARN distributions.