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 / rbtree.c
Last active September 29, 2022 15:06
simple rbtree source code
#include <stdio.h>
#include <stdlib.h>
int BLACK = 0;
int RED = 1;
struct node {
struct node *left;
struct node *right;
struct node *parent;
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys, os, time, atexit
from signal import SIGTERM
class Daemon:
"""
A generic daemon class.
Usage: subclass the Daemon class and override the _run() method
"""
#include <stdio.h>
#include <stdlib.h>
struct node {
node *left;
node *right;
node *parent;
int value;
};
@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 / gevent_pycurl.py
Created June 27, 2013 09:55
pycurl for gevent.
"""Implementation of pycurl's "easy" interface that uses pycurl's multi interface + gevent.
"""
# parts of code from Tornado's curl_httpclient.py
import logging
import gevent
assert gevent.version_info[:2] >= (0, 14), 'Gevent 0.14 or older required. Your version is %s' % gevent.__version__
from gevent.core import EVENTS, READ, WRITE
from gevent.hub import Waiter
@GuoJing
GuoJing / fui.py
Last active June 25, 2019 13:43
A very simple html tags and attributes filter with BeautifulSoup
from BeautifulSoup import BeautifulSoup
VALID_TAGS = [
'div',
'span',
'a',
'p',
'br',
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef int heap_elem_t;
typedef struct heap_t
{
int size;
int capacity;
@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