Skip to content

Instantly share code, notes, and snippets.

@hit9
hit9 / foolib.c
Last active December 27, 2015 01:19
typedef struct post {
char *x;
char *y;
int x_z;
} post_t;
void
foo (post_t *o, char *src)
{
@hit9
hit9 / script.py
Last active December 26, 2015 10:39
糗百面试题目
# coding=utf8
"""
思路
~~~~
1. 按行读取文件, 三列入列表start_lst, end_lst, code_lst
2. 对start_lst进行二分法查找,直到找到离目标ip地址x最近的元素start和其
在start_lst中的索引i, 使得恰好有
start=start_lst[i]<=x
@hit9
hit9 / sources.list
Created July 3, 2013 12:59
ubuntu 11.04 源 update date: 2013-07-03
deb http://old-releases.ubuntu.com/ubuntu/ natty main universe restricted multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ natty main universe restricted multiverse
deb http://old-releases.ubuntu.com/ubuntu/ natty-security universe main multiverse restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ natty-security universe main multiverse restricted
deb http://old-releases.ubuntu.com/ubuntu/ natty-updates universe main multiverse restricted
deb http://old-releases.ubuntu.com/ubuntu/ natty-proposed universe main multiverse restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ natty-proposed universe main multiverse restricted
deb http://old-releases.ubuntu.com/ubuntu/ natty-backports universe main multiverse restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ natty-backports universe main multiverse restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ natty-updates universe main multiverse restricted
@hit9
hit9 / daemon.py
Created June 11, 2013 12:49 — forked from jamiesun/daemon.py
#! /usr/bin/env python2.7
#encoding:utf-8
#@description:一个python守护进程的例子
#@tags:python,daemon
import sys
import os
import time
import atexit
from signal import SIGTERM
@hit9
hit9 / colored_logging.py
Created May 23, 2013 11:44
colored python logging. And add a level 'success'
class Color(object):
"""
utility to return ansi colored text.
"""
colors = {
'black': 30,
'red': 31,
'green': 32,
'yellow': 33,
@hit9
hit9 / color.py
Last active December 17, 2015 15:58
utility to return ansi colored text.
class Color(object):
"""
utility to return ansi colored text.
usage::
>>> from color import colored
>>> colored("text","red")
'\x1b[31mtext\x1b[0m'
"""
@hit9
hit9 / progress.py
Created May 21, 2013 13:50
打印一个百分进度
import sys
import time
from termcolor import colored
class Progress(object):
def __init__(self):
size = 0
@hit9
hit9 / update_nested_dict.py
Created May 20, 2013 12:35
Update a nested dict with another one.
a = {
'a': {
'x': 1,
'y': 2
},
'b': 3
}
b = {
'a': {
@hit9
hit9 / gist:5429402
Last active December 16, 2015 11:39
个人用以重装Ubuntu操作系统的记录

准备镜像,显卡驱动

1.. 准备系统Ubuntu 11.04 (我发现这是我最喜欢的ubuntu版本) 2. 准备好ati 11-04 版本的catalyst驱动 3. 准备好

初始系统

  1. 开始重装, 装好后,安装驱动:
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {