Skip to content

Instantly share code, notes, and snippets.

View alcnsahin's full-sized avatar

Alican Sahin alcnsahin

View GitHub Profile
@TakahikoKawasaki
TakahikoKawasaki / EchoClient.java
Last active August 14, 2020 09:39
A sample WebSocket client application using nv-websocket-client library.
/*
* Copyright (C) 2015 Neo Visionaries Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
@gioper86
gioper86 / cassandra_to_pandas.py
Last active December 18, 2023 11:29
Get a Pandas DataFrame from a Cassandra query
from cassandra.cluster import Cluster
from cassandra.auth import PlainTextAuthProvider
import pandas as pd
def pandas_factory(colnames, rows):
return pd.DataFrame(rows, columns=colnames)
cluster = Cluster(
contact_points=['127.0.0.1'],
auth_provider = PlainTextAuthProvider(username='cassandra', password='cassandra')
@okeehou
okeehou / outline-server-setup.md
Last active May 8, 2024 05:27
How to setup an Outline VPN Server on Ubuntu 16.04

How to setup an Outline VPN Server on Ubuntu 16.04 Server

This guide will show you how to install Outline Server on an Ubuntu 16.04 Server, use Outline Manager for Windows and connect to your Outline Server on Windows and Anroid.

Install Outline Manager

Outline Manager supports Windows, macOS and Linux.

Outline Manager for Windows

@anand2312
anand2312 / pymongo-to-motor.md
Last active May 24, 2024 09:15
pymongo vs Motor

pymongo vs Motor

Motor is an async Python driver for MongoDB.

When should I use Motor?

You should use Motor when you're trying to interact with a MongoDB database in an asynchronous context. When you're making something that needs to be asynchronous (like a web server, or most commonly from what I've seen here, Discord bots), you also want all the database calls to be done asynchronously. But pymongo is synchronous, i.e it is blocking, and will block the execution of your asynchronous program for the time that it is talking to the database.

Okay, How do I switch now?!

Thankfully for us, switching from pymongo to Motor isn't too hard, and won't need you to change much code. This process can be roughly summarized as:

Step 1: Install Motor, and import it

Installing can be done with pip - pip install motor