Skip to content

Instantly share code, notes, and snippets.

View AlbertChanX's full-sized avatar
🎯
Focusing

AC AlbertChanX

🎯
Focusing
View GitHub Profile
@wjy20030407
wjy20030407 / SER6 Pro Vest 7735HS.md
Last active May 9, 2024 11:44
SER6 Pro Vest 7735HS
@AlbertChanX
AlbertChanX / redis_pubsub.py
Created May 1, 2019 09:10
Redis pub/sub aiohttp (aioredis) example
"""
Example of redis channels pub/sub for aiohttp microservices using aioredis
Another example - https://aioredis.readthedocs.io/en/latest/examples.html#pub-sub-example
"""
"""
Service pub.
Publish some json test data into channel by api call
@pknowledge
pknowledge / math_func.py
Created October 16, 2018 22:26
Python Unit Testing With PyTest - Getting started with pytest run with following command: pytest test_math_func.py -v or py.test
def add(x, y=2):
return x + y
def product(x, y=2):
return x * y
@rfikki
rfikki / constantinople-ropsten-peers.txt
Last active March 30, 2025 21:48
Updated November 25, 2019: Ropsten Latest Peers with Istanbul - IMPORTANT RUN THE LATEST RELEASE OF THE CLIENT - https://geth.ethereum.org/downloads/ and use this flag --whitelist=6485846=0x43f0cd1e5b1f9c4d5cda26c240b59ee4f1b510d0a185aa8fd476d091b0097a80
admin.addPeer("enode://cd24a0c66055d788ce2bb77c2525915724a56de577b3e39c1a4dde347e60c83f082285a9d43a5ba0d7efc929699106d147e8d3612baafcaeb8f3075f36a82670@180.64.84.98:51044");
admin.addPeer("enode://86fb5f9e216c9fef5f97d3140d8d30ba13e2cc615ebb0b8e22975d296486e1f589baa6a2a4db6e0a1482f9b27a9e472efd94ec01cefc6e1d7e687dcdda0af5cc@46.105.118.30:30333");
@wallyqs
wallyqs / aiohttp-example-thread-pool-executor.py
Created August 30, 2018 07:04
aiohttp-example-thread-pool-executor.py
import asyncio
import json
import logging
import signal
import aiohttp
import platform
from aiohttp import web
from datetime import datetime
from nats.aio.client import Client as NATS
@sawara7
sawara7 / data_receiver.py
Last active May 1, 2019 08:44
bitFlyerのRealtime API(JSON-RPC 2.0 over WebSocket)をaiohttpのWebsokectで利用する
# -*- coding: utf-8 -*-
"""
+++ bitFlyerのRealtime API(JSON-RPC 2.0 over WebSocket)をaiohttpのWebsokectを用いて取得する
"""
import aiohttp
import asyncio
import json
class bfDataReceiver(object):
from flask import Flask
from flask_restful import Api, Resource, reqparse
app = Flask(__name__)
api = Api(app)
users = [
{
"name": "Nicholas",
"age": 42,
@aunyks
aunyks / snakecoin-server-full-code.py
Last active May 6, 2026 09:39
The code in this gist isn't as succinct as I'd like it to be. Please bare with me and ask plenty of questions that you may have about it.
from flask import Flask
from flask import request
import json
import requests
import hashlib as hasher
import datetime as date
node = Flask(__name__)
# Define what a Snakecoin block is
class Block:
@appeltel
appeltel / pubsub.py
Last active January 21, 2026 21:32
asyncio pubsub example
import asyncio
import random
class Hub():
def __init__(self):
self.subscriptions = set()
def publish(self, message):
@aparrish
aparrish / understanding-word-vectors.ipynb
Last active April 30, 2026 09:31
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.