Skip to content

Instantly share code, notes, and snippets.

View GuoJing's full-sized avatar
🎯
Focusing

GuoJing GuoJing

🎯
Focusing
View GitHub Profile
{
"url": "https://t.me/smartdeer_test_bot/mine",
"name": "SmartDeer Test",
"iconUrl": "https://global-image.smartdeer.work/p/images/0x9db20f8d5ecf4d2db0ddb8789d1c45f4.svg"
}
@GuoJing
GuoJing / film_clean.py
Created November 16, 2020 02:27 — forked from zhongql/film_clean.py
时间计算
import sys
def calculate(params, tm):
ex_stack = []
tmp = []
mutil = []
for p in params:
if (not p):
continue
@GuoJing
GuoJing / ProcessDefinitionGeneratorEx.java
Created December 11, 2017 11:29 — forked from winse/ ProcessDefinitionGeneratorEx.java
根据Activiti的processInstanceId得到流程图,高亮当前执行中的流程。 与官方提供的不同,该类仅仅是在原图的基础上添加高亮。这样可以不需要考虑汉字乱码的问题。
package com.winse.activiti.util;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.Stroke;
import java.awt.geom.RoundRectangle2D;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
@GuoJing
GuoJing / README.md
Created May 31, 2016 03:09 — forked from majek/README.md
Passing TCP socket descriptors around

Passing TCP socket descriptors around

In linux, normally, it is impossible to "bind()" to the same TCP port twice. If you try to bind to the same port from second proces unix processes you'll see:

socket.error: [Errno 98] Address already in use

@GuoJing
GuoJing / progessbar.py
Created May 17, 2016 06:20
Python Progress Bar
import sys
def print_progress(iteration, total, prefix = '', suffix = '', decimals = 2, barLength = 100):
filledLength = int(round(barLength * iteration / float(total)))
percents = round(100.00 * (iteration / float(total)), decimals)
bar = '#' * filledLength + '-' * (barLength - filledLength)
sys.stdout.write('%s [%s] %s%s %s\r' % (prefix, bar, percents, '%', suffix)),
sys.stdout.flush()
if iteration == total:
print("\n")
import sys
from itertools import chain, combinations
def find_partition(int_list):
A = set()
B = set()
for n in sorted(int_list, reverse=True):
if sum(A) < sum(B):
A.add(n)
else:
syntax = "proto3";
package tutorial;
message Person {
string name = 1;
int32 id = 2;
string email = 3;
enum PhoneType {
@GuoJing
GuoJing / socket_server.go
Created December 23, 2015 12:06
simple socket server with keepalive
package main
import (
"fmt"
"net"
"os"
"time"
)
func main() {
@GuoJing
GuoJing / AppDelegate.m
Created March 25, 2015 15:36
ares thrift server
#import "AppDelegate.h"
#import "gen-cocoa/ares.h"
#import "thrift/Thrift.h"
#import "thrift/transport/TSSLSocketClient.h"
#import "thrift/transport/TTransport.h"
#import "thrift/transport/TSocketClient.h"
#import "thrift/transport/TFramedTransport.h"
#import "thrift/protocol/TBinaryProtocol.h"
@implementation AppDelegate
@GuoJing
GuoJing / casper.js
Last active August 29, 2015 14:03
casper
var c = require('framework.js');
var _step1_url = c.url + '/mine/info/1'
var _step2_url = c.url + '/mine/info/2'
var _step3_url = c.url + '/mine/info/3'
var _step4_url = c.url + '/mine/info/4'
var _step5_url = c.url + '/mine/info/5'
var check_loaded = function(){
casper.waitForResource(/form_helper\.js$/, function(){