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
var defaultPaths = []string { | |
"/.ethereum/geth.ipc", //unix | |
"/Library/Ethereum/geth.ipc", //macos | |
"\\\\.\\pipe\\geth.ipc", //win | |
} | |
type SocketResolver interface { | |
GetSocket() string | |
Connect() |
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
func (c *IPCSocket) Listen() { | |
buffer := bytes.Buffer{} | |
for { | |
reader := bufio.NewReader(c.Connect) | |
line, prefix, err := reader.ReadLine() | |
if err != nil { | |
fmt.Printf("error: can't read form socket:", err) | |
log.Fatal(err) | |
} | |
buffer.Write(line) |
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 decor(func): | |
def wrapped(a, b): | |
a = 'deco' | |
b = 'rated' | |
return func(a, b) | |
return wrapped # not calling yet | |
@decor # init decor here |
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 asyncio | |
class _AsyncObject(object): | |
"""Inheriting this class allows you to define an async __init__. | |
So you can create objects by doing something like `await MyClass(params)` | |
""" | |
@asyncio.coroutine | |
def __new__(cls, *a, **kw): |
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 contains(self, element, list_wrap=False): | |
""" | |
Recursively seeks for requested keyword or list of keywords | |
:param data: json-type dict | |
:param element: str or list | |
:return: list or None | |
""" | |
collected_elements = [] | |
def _recursively_seek(data): |
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 regroup_response(self): | |
""" | |
Groups elements of request by keys and references on keys. | |
NOTE that those keys and references actually have meaning of primary and foreign key | |
in the terms of SQL. | |
:param data: json like request (actually dicts with lists and strings) | |
:return: None | |
""" | |
keys = {} |
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
testmodules = [ | |
'cogapp.test_makefiles', | |
'cogapp.test_whiteutils', | |
'cogapp.test_cogapp', | |
] | |
suite = unittest.TestSuite() | |
for t in testmodules: | |
try: |
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
func multiparseText() string { | |
collectedTexts := "" | |
ch := make(chan string, parseThreadsNum) | |
defer close(ch) | |
for i := 0; i < parseThreadsNum; i++ { | |
go parseText(&ch) | |
} | |
for { | |
unreadData := len(ch) | |
if unreadData == parseThreadsNum { |
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 selenium import webdriver | |
from selenium.webdriver.common.by import By | |
from selenium.webdriver.support.ui import WebDriverWait | |
from selenium.webdriver.support import expected_conditions as EC | |
import datetime | |
import time | |
while True: | |
# opening_browser |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Джанго</title> | |
<link rel="stylesheet" type="text/css" href="/static/css/bootstrap.min.css"> | |
<script src="/static/js/bootstrap.min.js"></script> | |
</head> |