里程碑及产出
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def import_submodules(package) -> None: | |
package = importlib.import_module(package) | |
for _, name, is_pkg in pkgutil.iter_modules(package.__path__): | |
full_name = package.__name__ + '.' + name | |
if is_pkg: | |
import_submodules(full_name) | |
else: | |
importlib.import_module(full_name) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Any, Iterable, List, Dict | |
from decimal import Decimal | |
from datetime import datetime | |
from sqlalchemy import Row | |
from sqlalchemy.orm import DeclarativeMeta | |
def row_to_dict(row) -> dict: | |
if isinstance(row, Row): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.json4s._ | |
object JsonUtils { | |
implicit class AugmentJValue(val jvalue: JValue) { | |
implicit val formats = DefaultFormats | |
def getString(key: String): String = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
NewerOlder