Skip to content

Instantly share code, notes, and snippets.

View geosmart's full-sized avatar
🎯
Focusing

geosmart geosmart

🎯
Focusing
View GitHub Profile
/**
*
* 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("指定的流程定义不存在!");
@geosmart
geosmart / get_job_status.sh
Created March 17, 2018 08:41 — forked from arturmkrtchyan/get_job_status.sh
Apache Spark Hidden REST API
curl http://spark-cluster-ip:6066/v1/submissions/status/driver-20151008145126-0000
@geosmart
geosmart / parallel_groupby_apply.py
Created April 2, 2018 10:32 — forked from chumo/parallel_groupby_apply.py
Parallelize apply after pandas groupby using PySpark
import pandas as pd
# Spark context
import pyspark
sc = pyspark.SparkContext()
# apply parallel
def applyParallel(dfGrouped, func):
# rdd with the group of dataframes
@geosmart
geosmart / gist:8836115ad2f402704e76cce0cc336400
Created November 8, 2018 07:33 — forked from marcustallberg/gist:d1bae55dd408f964579f1012b2b2e659
Stress testing a file-upload with Apache Bench
$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>
@geosmart
geosmart / Device.java
Created December 23, 2019 13:40 — forked from hormesiel/Device.java
How to get an Android device's serial number, visible to the user in "Settings > About phone/tablet/device > Status > Serial number".
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() {
@geosmart
geosmart / helpful-docker-commands.sh
Created July 6, 2020 11:25 — forked from garystafford/helpful-docker-commands.sh
My list of helpful docker commands
###############################################################################
# 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
@geosmart
geosmart / pyspark-on-yarn-self-contained.md
Created September 18, 2020 03:57 — forked from seanorama/pyspark-on-yarn-self-contained.md
PySpark on YARN in self-contained environments