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
| import os | |
| import socket | |
| import struct | |
| from typing import Any | |
| """ | |
| ref: https://gfiber.googlesource.com/vendor/google/platform/+/master/cmds/stun.py | |
| """ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| import itertools | |
| def solution(items): | |
| print(items) | |
| for i in range(len(items)): | |
| positions = list(range(len(items))) | |
| positions.remove(i) | |
| # print('pos', positions) | |
| for j in range(1, len(items)): | |
| for pers in itertools.combinations(positions, j): |
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 selectors import DefaultSelector, EVENT_READ, EVENT_WRITE | |
| import socket | |
| class Future: | |
| def __init__(self): | |
| self.result = None | |
| self.callbacks = [] | |
| def set_result(self, result=None): | |
| self.result = result |
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
| class MyMetaClass(type): | |
| def __init__(cls, name, bases, attrs): | |
| """ | |
| initial class after __new__ | |
| """ | |
| print '__init__ in the metaclass' | |
| print 'cls:', cls | |
| print 'name:', name | |
| print 'bases:', bases |
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 thread import get_ident | |
| from threading import RLock, Thread | |
| class GlobalContext(object): | |
| def __init__(self): | |
| self._rlock = RLock() | |
| self._store = {} | |
| def _lock(self): |
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
| # -*- coding: utf8 -*- | |
| """ | |
| source:https://github.com/donnemartin/system-design-primer/blob/master/solutions/object_oriented_design/lru_cache/lru_cache.ipynb | |
| """ | |
| class Node(object): | |
| def __init__(self, key, val): | |
| self.key = key |
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
| yum install -y zsh git | |
| sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" | |
| # ZSH_THEME="amuse" | |
| # plugins=( | |
| # zsh-autosuggestions | |
| # ) | |
| git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions |
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
| // ==UserScript== | |
| // @name Zimuzu | |
| // @namespace zimuzu | |
| // @include http://www.zimuzu.tv/resource/list/* | |
| // @version 1 | |
| // @grant none | |
| // allow pasting | |
| // ==/UserScript== | |
| Zimuzu = function(){ |
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
| (?s)<li [^<]*format="1080P" season="8"[^<]*>.*?<a href="(ed2k.*?)">.*?</li> |