This file contains hidden or 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
### Keybase proof | |
I hereby claim: | |
* I am ma233 on github. | |
* I am ma233 (https://keybase.io/ma233) on keybase. | |
* I have a public key ASC7oq0hBzwv4Q1YUTwBqN8jdNaYUS8ubBYgaRq6QrZ98Qo | |
To claim this, I am signing this object: |
This file contains hidden or 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
async fn test_croath() -> Result<()> { | |
let croath = Did::from_str("0xf7fea1722f9b27b0666919a5664bab486a4b18d3")?; | |
let no_41d = Did::from_str("0x0298ba2b72ef040bbd99398f96594e8d8c0d0607")?; | |
let vnode = Did::from_str("0xec472b3b5e00a33cd3b8ce91159e4d43350c3098")?; | |
let croath_dht = PeerRing::new(croath).await?; | |
{ | |
let mut successors = croath_dht.lock_successor()?; | |
successors.update(no_41d); |
This file contains hidden or 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 sqlalchemy.orm import load_only | |
def model_query(M, *, select_=None, order_by_=None, conditions_=None, **kwargs): | |
q = M.query | |
if select_: | |
q = q.options(load_only(*select_)) | |
if conditions_: |
This file contains hidden or 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 | |
# encoding: utf-8 | |
import re | |
LOG = '''\ | |
192.168.20.16 - - [28/Sep/2016:15:55:43 +0800] "GET /v2/dae-rasha/manifests/dc26e9e9873baf1af7dc0169496f4de373e4fc01__1d374a6a93125b5bddc57b0b1c34243a5cdcd9586c19ad0b432133b7d81ef123 HTTP/1.1" 200 2008 "-" "docker/1.10.3 go/go1.5.3 git-commit/20f81dd kernel/3.18.10-gentoo os/linux arch/amd64" "-" 0.011 | |
192.168.20.16 - - [28/Sep/2016:15:55:43 +0800] "GET /v2/dae-lunar/manifests/3137109cad460d22d6585ebbe90f3f31b6db5c77__9046a5f27c39cb2f8c110f7c6599f945648e55acf4979c3e6af42f92ad67143a HTTP/1.1" 200 2007 "-" "docker/1.10.3 go/go1.5.3 git-commit/20f81dd kernel/3.18.10-gentoo os/linux arch/amd64" "-" 0.011 | |
192.168.20.16 - - [28/Sep/2016:15:55:43 +0800] "GET /v2/dae-lunar/blobs/sha256:fb781d214197779f45d002c20ff3f5084b817389889c6f9057ca02e9ef34dc85 HTTP/1.1" 200 2839 "-" "docker/1.10.3 go/go1.5.3 git-commit/20f81dd kernel/3.18.10-gentoo os/linux arch/amd64" "-" 0.010 | |
192.168.20.16 - - [28/Sep/2016:15:55:43 +0800] "GET /v2/dae-rasha/blobs/sha256:b80ae88db4 |
This file contains hidden or 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
# encoding: utf-8 | |
import os | |
import sys | |
import time | |
import atexit | |
from signal import SIGTERM | |
''' | |
A daemon class referred from | |
`http://www.jejik.com/files/examples/daemon.py` |
This file contains hidden or 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 | |
# encoding: utf-8 | |
from functools import partial | |
import requests | |
class URLAgent(object): | |
def __init__(self, host, handler=None, actions=set()): | |
self._host = host |
This file contains hidden or 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 | |
# encoding: utf-8 | |
import sys | |
import subprocess | |
def convert_git_url(git_url): | |
if git_url.startswith('git@'): | |
git_url = 'http://' + '/'.join(git_url[4:].split(':')) | |
return git_url |
This file contains hidden or 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/python | |
import re | |
import sys | |
from DictionaryServices import DCSCopyTextDefinition | |
split_re = re.compile(r"\s+(?=[A-Z]\.\s)") | |
_split_re = re.compile(r"(?=" + u"[\u2460-\u2473]" + r")") | |
def search(word): |