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
" All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by | |
" the call to :runtime you can find below. If you wish to change any of those | |
" settings, you should do it in this file (/etc/vim/vimrc), since debian.vim | |
" will be overwritten everytime an upgrade of the vim packages is performed. | |
" It is recommended to make changes after sourcing debian.vim since it alters | |
" the value of the 'compatible' option. | |
" This line should not be removed as it ensures that various options are | |
" properly set to work with the Vim-related packages available in Debian. | |
runtime! debian.vim |
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
/***************************************************************************** | |
* QuantCup 1: Price-Time Matching Engine | |
* | |
* Submitted by: voyager | |
* | |
* Design Overview: | |
* In this implementation, the limit order book is represented using | |
* a flat linear array (pricePoints), indexed by the numeric price value. | |
* Each entry in this array corresponds to a specific price point and holds | |
* an instance of struct pricePoint. This data structure maintains a list |
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 random import random | |
def generate_infinite_random_nos(): | |
yield random() | |
yield from generate_infinite_random_nos() | |
#https://eddmann.com/posts/merge-sort-in-scala-using-tail-recursion-and-streams/ |
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 asyncio | |
import random | |
async def handle_echo(reader, writer): | |
while True: | |
data = await reader.readline() | |
message = data.decode() | |
addr = writer.get_extra_info('peername') | |
print(f"Received {message!r} from {addr!r}") | |
message = f'pong{random.randint(0,10)}\n' |
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 asyncio | |
async def client(message): | |
message = message + '\n' + message + '\n' | |
reader, writer = await asyncio.open_connection( | |
'127.0.0.1', 8888) | |
print(f'Send: {message!r}') | |
writer.write(message.encode()) | |
while True: |
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 aioredis.pubsub import Receiver | |
REDIS_URL = 'localhost' | |
REDIS_PORT = 6379 | |
async def redis_relay(websocket): | |
conn = aioredis.create_connection((REDIS_URL, REDIS_PORT)) | |
receiver = Receiver() | |
connection.execute_pubsub('subscribe', receiver.channel(‘updates’)) | |
while (await receiver.wait_message()): |
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 def beat1(websocket): | |
while True: | |
await asyncio.sleep(1) | |
await websocket.send('💚') | |
async def beat2(websocket): | |
while True: | |
await asyncio.sleep(2) | |
await websocket.send('💓') | |
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 def beat1(websocket): | |
while True: | |
await asyncio.sleep(1) | |
await websocket.send('💚') | |
async def beat2(websocket): | |
while True: | |
await asyncio.sleep(2) | |
await websocket.send('💓') |
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 asyncio | |
import websockets | |
async def heartbeat(websocket): | |
while True: | |
await asyncio.sleep(1) | |
await websocket.send('💚') | |
async def ws_handler(websocket, path): |
NewerOlder