Skip to content

Instantly share code, notes, and snippets.

View dongweiming's full-sized avatar
:octocat:
🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔

Weiming Dong dongweiming

:octocat:
🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔
View GitHub Profile
#coding=utf-8
import re
from collections import defaultdict
from datetime import datetime
import requests
# https://github.com/livid/v2ex/blob/master/api.py#L247
url = 'https://www.v2ex.com/api/replies/show.json'
rs = requests.get(url, params={'topic_id': 313225, 'page': 11})
@dongweiming
dongweiming / resume.py
Created October 11, 2016 02:56
Python版本简历
#/usr/bin/env python
# coding=utf-8
import random
import re
def color(messages):
color = '\x1B[%d;%dm' % (1,random.randint(30,37))
return '%s %s\x1B[0m' % (color,messages)
@dongweiming
dongweiming / test1.py
Last active September 20, 2016 03:00
test
import threading
count = 0
def incre():
global count
count += 1
# coding=utf-8
from mapreduce import SimpleMapReduce
from simple import FILES, file_parser
def count_err_log(item):
word, occurances = item
return (word, sum(occurances))
@dongweiming
dongweiming / cn_participation.py
Last active September 5, 2019 15:57
Get chinese contributor
# coding=utf-8
# Note:
# 1. 使用Redis缓存用户信息,减少重复调用
# 2. 只通过用户的location字段看是否包含beijing、shanghai、guangzhou、
# shenzhen、china这几个关键词判断是否是国人
from collections import defaultdict
import redis
import requests
USENAME = '<YOUR USERNSME>'
❯ ps -ef | grep openvpn
0 35727 1 0 1:48PM ?? 0:00.07 /Applications/Tunnelblick.app/Contents/Resources/openvpn/openvpn-2.2.1/openvpn --daemon --log /Library/Application Support/Tunnelblick/Logs/-SLibrary-SApplication Support-STunnelblick-SShared-Sdouban.tblk-SContents-SResources-Sconfig.ovpn.9_0_3_1_305.1337.openvpn.log --cd /Library/Application Support/Tunnelblick/Shared/douban.tblk/Contents/Resources --config /Library/Application Support/Tunnelblick/Shared/douban.tblk/Contents/Resources/config.ovpn --cd /Library/Application Support/Tunnelblick/Shared/douban.tblk/Contents/Resources --management 127.0.0.1 1337 --management-query-passwords --management-hold --script-security 2 --up /Applications/Tunnelblick.app/Contents/Resources/client.2.up.tunnelblick.sh -w -d -f -ptADGNWradsgnw --down /Applications/Tunnelblick.app/Contents/Resources/client.2.down.tunnelblick.sh -w -d -f -ptADGNWradsgnw
501 35772 92964 0 1:49PM ttys007 0:00.00 grep openvpn
❯ ping 10.8.0.1
PING 10.8.0.1 (10.8.0.1):
(defun get-repo-url (arg)
(let* ((remote (if arg "upstream" (nth 2 (s-split "/" (magit-get-tracked-ref)))))
(remote-url (magit-get "remote" remote "url"))
(fragments (s-split "[:/@]/?/?" (s-chop-suffix ".git" remote-url))))
(concat "http://" (s-join "/" (cdr fragments)))))
(defun open-in-repo (arg)
(interactive "P")
(let* ((url (get-repo-url arg))
(branch (if arg "master" (magit-get-current-branch)))
@dongweiming
dongweiming / homebrew.mxcl.redis.plist
Created March 27, 2015 04:05
homebrew.mxcl.redis.plist
$cat /usr/local/Cellar/redis/2.8.8/homebrew.mxcl.redis.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<false/>
</dict>
@dongweiming
dongweiming / benchmarks.ipynb
Created March 16, 2015 02:27
benchmarks.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.