Skip to content

Instantly share code, notes, and snippets.

View huzhifeng's full-sized avatar

Zhifeng Hu huzhifeng

View GitHub Profile
@huzhifeng
huzhifeng / csdn_blog.py
Created November 2, 2014 11:52
A python script used to download CSDN blog as PDF files
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Usage:
pip install requests
pip install beautifulsoup4
python csdn_blog.py
'''
@huzhifeng
huzhifeng / huzhifeng.py
Last active August 29, 2015 14:08
A python script used to download all HTML articles on http://www.ruanyifeng.com/blog/ and save as PDF files
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# huzhifeng's Python Lib
import os
import re
import time
import json
import requests
@huzhifeng
huzhifeng / coolshell.py
Last active August 29, 2015 14:08
A python script used to download all HTML articles on http://coolshell.cn and save as PDF files
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Usage:
pip install requests
pip install beautifulsoup4
python coolshell.py
'''
@huzhifeng
huzhifeng / crifan.py
Last active August 29, 2015 14:08
A python script used to download PDFs from http://www.crifan.com/files/doc/docbook/
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Usage:
pip install requests
pip install pyquery
pip install beautifulsoup4
pip install wget
python crifan.py
@huzhifeng
huzhifeng / http_sniffer.c
Last active August 29, 2015 14:07
A linux kernel module to snoop HTTP based on Netfilter
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/ip.h>
#include <linux/tcp.h>
#include <linux/netfilter_ipv4.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("[email protected]>");
MODULE_DESCRIPTION("Netfilter HTTP sniffer module");
@huzhifeng
huzhifeng / AutoReboot.ttl
Created October 13, 2014 02:26
A TTL(Tera Term Language) script used for automatic reboot test
; TTL Script used for automatic reboot test
username = 'root'
password = 'root'
usernamePrompt = 'login'
passwordPrompt = 'Password'
oopsPrompt = 'Oops'
panicPrompt = 'Kernel panic'
maxLoop = 1000
@huzhifeng
huzhifeng / cscope.sh
Created August 2, 2014 18:35
Automatic cscope
#!/bin/sh
cs_install() {
echo "installing ..."
if [ ! -e cscope.files ]
then
find ./ -name "*.[hc]" > cscope.files
else
echo "cscope.files exist"
fi
@huzhifeng
huzhifeng / html2pdf.py
Created July 14, 2014 10:54
Convert html page to PDF file online and download
# -*- coding: utf-8 -*-
import json
import os
import requests
def pdfcrowd(url):
download_url = ''
pdfcrowd_post_url = 'http://pdfcrowd.com/form/json/convert/uri/'
headers = {
'Host': 'pdfcrowd.com',
#include <stdio.h>
#include <string.h>
extern void hexdump(FILE * stream, void const * data, unsigned int len)
{
unsigned int i;
unsigned int r,c;
if (!stream)
return;
var request = require('request');
var cheerio = require('cheerio');
var util = require('util');
var baseUrl = 'http://www.tehcute.com';
var options = {
'url': '',
'method': 'GET',
'headers': {
'User-Agent': 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36',