Skip to content

Instantly share code, notes, and snippets.

View geosmart's full-sized avatar
🎯
Focusing

geosmart geosmart

🎯
Focusing
View GitHub Profile
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
:%s/r//g 删除DOS方式的回车^M
:%s= *$== 删除行尾空白
:%s/^(.*)n1/1$/ 删除重复行
:%s/^.{-}pdf/new.pdf/ 只是删除第一个pdf
:%s/<!--_.{-}-->// 又是删除多行注释(咦?为什么要说「又」呢?)
:g/s*^$/d 删除所有空行 :这个好用有没有人用过还有其他的方法吗?
@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
@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 / 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 / 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 / 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 / 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
/**
* 更改流程实例的流程定义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("指定的流程定义不存在!");
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 {