Skip to content

Instantly share code, notes, and snippets.

@lidawn
lidawn / merge_log.py
Last active May 15, 2017 14:25
日志合并
#!/usr/bin/python
#coding:utf-8
#python version: 2.7
import sys
import os
from datetime import datetime as dt
import time
@lidawn
lidawn / remove_notes.cpp
Created September 26, 2016 04:04
删除C语言注释(亚马逊面试题)
#include<iostream>
#include<stack>
using namespace std;
bool check(char a,stack<char> &v)
{
//继续输出,返回true
//栈里只有A或B
bool ret = true;
if(!v.empty())
@lidawn
lidawn / dijkstra_and_prim.cpp
Last active September 18, 2016 03:55
dijkstra and prim
#include <iostream>
using namespace std;
#define MAX_N 1000
#define MAX_I 6
int G[MAX_I][MAX_I]={
{MAX_N,6,1,5,MAX_N,MAX_N},
{6,MAX_N,5,MAX_N,3,MAX_N},
{1,5,MAX_N,5,6,4},
{5,MAX_N,5,MAX_N,MAX_N,2},
@lidawn
lidawn / epoll_server.c
Last active August 26, 2016 14:27
select/poll/epoll (socket included) code examples
/*
(server) $ epoll_server 8888
(client) $ telnet host 8888
*/
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<errno.h>
@lidawn
lidawn / test_get.html
Created November 19, 2015 14:20
JavaScript 区分关闭和刷新事件
<!DOCTYPE html>
<html>
<head>
<title>get</title>
<script type="text/javascript">
function checkRefresh()
{
if( document.refreshForm.visited.value == "" )
{
document.refreshForm.visited.value = "1";
@lidawn
lidawn / baidu_crawler.py
Created May 24, 2015 11:51
百度图片爬虫
#coding:utf-8
import re
import urllib2
import urllib
import datetime
import socket
import os
from threading import Thread
@lidawn
lidawn / brand.txt
Last active November 12, 2017 07:29
汽车之家外观图片爬虫
134,ABT
34,阿尔法罗密欧
35,阿斯顿·马丁
221,安凯客车
33,奥迪
180,BAC
231,Borgward
140,巴博斯
120,宝骏
15,宝马