Skip to content

Instantly share code, notes, and snippets.

View geosmart's full-sized avatar
🎯
Focusing

geosmart geosmart

🎯
Focusing
View GitHub Profile
@geosmart
geosmart / testRegex.js
Created September 13, 2024 01:30 — forked from hanxiao/testRegex.js
Regex for chunking by using all semantic cues
// Updated: Aug. 20, 2024
// Run: node testRegex.js whatever.txt
// Live demo: https://jina.ai/tokenizer
// LICENSE: Apache-2.0 (https://www.apache.org/licenses/LICENSE-2.0)
// COPYRIGHT: Jina AI
const fs = require('fs');
const util = require('util');
// Define variables for magic numbers
const MAX_HEADING_LENGTH = 7;
@seanorama
seanorama / pyspark-on-yarn-self-contained.md
Last active September 8, 2023 07:43
PySpark on YARN in self-contained environments
@hormesiel
hormesiel / Device.java
Last active May 29, 2024 11:47
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() {
@garystafford
garystafford / helpful-docker-commands.sh
Last active August 9, 2024 16:14
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
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" ],
2013-05-01 11:04:36,466 [main] DEBUG [org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl] - database product name: 'Oracle'
2013-05-01 11:04:36,466 [main] DEBUG [org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl] - using database type: oracle
2013-05-01 11:04:37,596 [main] DEBUG [org.activiti.engine.impl.interceptor.LogInterceptor] -
2013-05-01 11:04:37,597 [main] DEBUG [org.activiti.engine.impl.interceptor.LogInterceptor] - --- starting SchemaOperationsProcessEngineBuild --------------------------------------------------------
2013-05-01 11:04:37,805 [main] DEBUG [org.activiti.engine.impl.persistence.entity.PropertyEntity.selectProperty] - ooo Using Connection [Transaction-aware proxy for target Connection [org.hibernate.engine.jdbc.internal.proxy.ConnectionProxyHandler@7dfa50db[valid=true]]]
2013-05-01 11:04:37,810 [main] DEBUG [org.activiti.engine.impl.persistence.entity.PropertyEntity.se
/**
* 更改流程实例的流程定义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("指定的流程定义不存在!");
:%s/r//g 删除DOS方式的回车^M
:%s= *$== 删除行尾空白
:%s/^(.*)n1/1$/ 删除重复行
:%s/^.{-}pdf/new.pdf/ 只是删除第一个pdf
:%s/<!--_.{-}-->// 又是删除多行注释(咦?为什么要说「又」呢?)
:g/s*^$/d 删除所有空行 :这个好用有没有人用过还有其他的方法吗?
package com.famousPro.process.service.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.activiti.engine.FormService;
import org.activiti.engine.HistoryService;
import org.activiti.engine.RepositoryService;
@geosmart
geosmart / gist:4452867
Created January 4, 2013 14:16
ActivitiRestApplication
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and