A Pen by Muhammad Syuqri on CodePen.
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
# single_pub_coro.py | |
# This is a reimplementation of the https://gist.github.com/Dansyuqri/3b533d0f11f3ddd53da34686434309d7 gist | |
# which allows for all functions to run asynchronously using coroutines. | |
import asyncio | |
import time | |
import zmq | |
from zmq.asyncio import Context | |
host = "127.0.0.1" |
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
# multi_pub_coro.py | |
# This is a reimplementation of the https://gist.github.com/Dansyuqri/93b8df592946cf5ec2158aa10c13bbcc gist | |
# which allows for all functions to run asynnchronously using coroutines. | |
import asyncio | |
import time | |
import zmq | |
from zmq.asyncio import Context, Poller | |
host = "127.0.0.1" |
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
# multi_pub.py | |
import time | |
import zmq | |
from threading import Thread | |
host = "127.0.0.1" | |
port = "5001" | |
ctx = zmq.Context() |
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
# multi_sub.py | |
import zmq | |
from threading import Thread | |
host = "127.0.0.1" | |
port = "5001" | |
ctx = zmq.Context() |
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
# simple_pub.py | |
import zmq | |
import time | |
host = "127.0.0.1" | |
port = "5001" | |
# Creates a socket instance | |
context = zmq.Context() | |
socket = context.socket(zmq.PUB) |
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
# multipart_pub.py | |
import zmq | |
import time | |
host = "127.0.0.1" | |
port = "5001" | |
# Creates a socket instance | |
context = zmq.Context() | |
socket = context.socket(zmq.PUB) |
I hereby claim:
- I am dansyuqri on github.
- I am dansyuqri (https://keybase.io/dansyuqri) on keybase.
- I have a public key ASCyYhqIrmTFbPjWdXpVuQd0WHtAw62An70p4WS6BHTuygo
To claim this, I am signing this object:
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
#!/bin/bash | |
# Update existing list of packages | |
sudo apt update | |
# Install packages required to allow apt install over HTTPS | |
sudo apt install apt-transport-https ca-certificates curl software-properties-common | |
# Get official GPG key from Docker | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - |
In pandas
it is much faster to query a row independently of the headers and then using dict
and zip
to convert into header to column value mapping rather than using the in-built to_dict
method.
import pandas as pd
import os, time
dataframe = pd.read_csv("data.csv", index_col=False)
start_time = time.time()
row = dataframe.loc[[25], list(dataframe)].to_dict("records")[0]
print("TIME: {}".format(time.time() - start_time))
NewerOlder