Skip to content

Instantly share code, notes, and snippets.

View GuoJing's full-sized avatar
🎯
Focusing

GuoJing GuoJing

🎯
Focusing
View GitHub Profile
@GuoJing
GuoJing / br.sh
Created June 10, 2014 15:24
br.sh
#!/bin/bash
set -e
device=$1
vlanid=$2
interface=vlan$vlanid
bridge="docker0"
modprobe 8021q
@GuoJing
GuoJing / .bash_profile
Created May 16, 2014 15:50
simple color config
export TERM="xterm-color"
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
PS1="\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] "
@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',
@GuoJing
GuoJing / .screenrc
Created May 4, 2014 05:33
screen rc
shell -$SHELL
altscreen on
startup_message off
autodetach on
nonblock on
defutf8 on
defscrollback 10000
@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;
#include <stdio.h>
#include <stdlib.h>
struct node {
node *left;
node *right;
node *parent;
int value;
};
#include <stdio.h>
#include <stdlib.h>
struct page {
int value;
page *next;
};
int miss = 0;
int hit = 0;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef int heap_elem_t;
typedef struct heap_t
{
int size;
int capacity;
#!/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
"""
@GuoJing
GuoJing / test.py
Last active August 29, 2015 13:56
import os
import time
from watchdog.observers import Observer
from watchdog.events import LoggingEventHandler
def sync_delete(event):
print 'delete %s' % event.src_path