Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
'''logfomat:2012-07-19 13:50:39,playerId:68719476740,operFlow:1,operType:0,indentify:ws:shanbiP110,sampleId:ws:shanbiP1,Level:1,Exp:
0,Num:1'''
import re
import time
Time="2012-07-31 12:43:40"
time_str=time.mktime(time.strptime(Time,"%Y-%m-%d %H:%M:%S"))
def grep(file,exp):
fd=open(file,'r')
@syshack
syshack / urlcheck.py
Created August 16, 2012 02:53
urlchecker
#!/usr/bin/env python
"""
This is a multiprocess URLchecker
"""
import urllib
from multiprocessing import Process, Queue
def checker(url):
try:
code = urllib.urlopen(url).getcode()
return code
@syshack
syshack / gist_tag.rb
Created August 16, 2012 08:02 — forked from imathis/gist_tag.rb
A Liquid tag for Jekyll sites that allows embedding Gists and showing code for non-JavaScript enabled browsers and readers.
require 'cgi'
require 'digest/md5'
require 'net/https'
require 'uri'
module Jekyll
class GistTag < Liquid::Tag
def initialize(tag_name, text, token)
super
@text = text
@syshack
syshack / MT-URLChecker.py
Created August 17, 2012 11:32
多线程URLChecker
from threadpool import *
import sys
import threading
import Queue
import traceback
import urllib
import time
if __name__ =="__main__":
def checker(urls):
try:
@syshack
syshack / wingdb.py
Created August 18, 2012 03:07
wingide远程调试
#!/usr/bin/env python
#########################################################################
""" wingdb.py -- Top-level command used internally by Wing IDE to
start a debug process.
Copyright (c) 2000-2012, Archaeopteryx Software, Inc. All rights reserved.
Written by Stephan R.A. Deibel and John P. Ehresman
"""
@syshack
syshack / agent_daemon.py
Created September 1, 2012 03:38
服务器批量执行命令
#!/bin/env python
#-*- coding:utf-8 -*-
import os,sys
import socket
import subprocess
import shlex
#----------------------------------------------------------------------
def serve(HOST="",PORT=50007):
"""建立socket"""
try:
@syshack
syshack / login.py
Created September 7, 2012 15:25
login
#!/usr/bin/python
import urllib2
import cookielib
#登录URL
login_url = 'http://www.buildhr.com/enterprise/login.php'
#cookie处理器
cookies = urllib2.HTTPCookieProcessor()
@syshack
syshack / 2.c
Created September 10, 2012 08:17
链表
#include <stdio.h>
#include <stdlib.h>
#ifdef DEBUG
#define my_printf(fmt, args...) printf("[%s: %d]"fmt, __FUNCTION__, __LINE__, ##args)
#else
#define my_printf(fmt, args...)
#endif
typedef int ElemType;
typedef int status;
@syshack
syshack / lahr.py
Created September 12, 2012 12:36
lahr简历爬虫
#!/usr/bin/python
#-*- coding:utf-8 -*-
import urllib2
import urllib
import cookielib
import sys
import re
from multiprocessing import Process, Queue
#----------------------------------------------------------------------
def login():
@syshack
syshack / MP_spider.py
Created September 13, 2012 03:45
多进程虫子
#!/usr/bin/python
#-*- coding:utf-8 -*-
import urllib2
import urllib
import cookielib
import sys
import re
from multiprocessing import Process, Queue
#----------------------------------------------------------------------
def login():