Skip to content

Instantly share code, notes, and snippets.

Avatar

Jerry jizhang

View GitHub Profile
@jizhang
jizhang / csdn.py
Created August 9, 2017 22:21
Crawl CSDN Blog's Page Views
View csdn.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import urllib2
import datetime
html = urllib2.urlopen('http://blog.csdn.net/zjerryj').read()
mo = re.search(r'访问:<span>(\d+)次</span>', html)
@jizhang
jizhang / server.py
Created March 22, 2017 09:39
Log Tailer with WebSocket and Python
View server.py
# -*- coding: utf-8 -*-
import time
import os.path
import asyncio
import logging
import argparse
import websockets
from collections import deque
from urllib.parse import urlparse, parse_qs
View pm.md

xx项目

项目目标

本周进展(yyyy-mm-dd)

里程碑及产出

View .bash_profile
alias gl='git log --graph --pretty=format:'\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\'' --abbrev-commit --date=relative'
@jizhang
jizhang / add_route.py
Created June 11, 2015 15:05
Add Route in Windows
View add_route.py
import re
import subprocess
ipconfig = subprocess.check_output(['ipconfig'])
mo = re.search(r'192\.168\.189\.[0-9]+', ipconfig)
vpn = mo.group()
ips = [
['192.168.1.100'],
['192.168.1.61'],
@jizhang
jizhang / config
Last active January 3, 2017 12:40
GFW
View config
# Linux
Host github.com
ProxyCommand socat STDIO PROXY:192.168.1.101:%h:%p,proxyport=8118
# Mac
Host github.com
ProxyCommand nc -X 5 -x 127.0.0.1:1086 %h %p
ServerAliveInterval 10
@jizhang
jizhang / JsonUtils.scala
Created January 26, 2015 02:53
json4s opt methods
View JsonUtils.scala
import org.json4s._
object JsonUtils {
implicit class AugmentJValue(val jvalue: JValue) {
implicit val formats = DefaultFormats
def getString(key: String): String = {
@jizhang
jizhang / wordstream.py
Created January 18, 2015 06:28
simple word stream
View wordstream.py
import SocketServer
import random
import time
words = ('cat', 'dog', 'monkey', 'horse', 'rabbit')
class MyTCPHandler(SocketServer.BaseRequestHandler):
def handle(self):
while True:
self.request.sendall(' '.join(random.sample(words, 3)) + '\n')
@jizhang
jizhang / pom-package-plugin.xml
Last active December 25, 2015 13:59
A sample Maven configuration for packaging. I usually use assembly, but when it comes to spring framework, you have to use shade.
View pom-package-plugin.xml
<!-- project / build / plugins/ plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
@jizhang
jizhang / log4j.properties
Created September 25, 2013 01:20
basic log4j.properties
View log4j.properties
# Root logger option
log4j.rootLogger=INFO, stdout
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %-5p %c{1} - %m%n