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 selectors | |
import socket | |
import types | |
class ServerWithSelect: | |
def __init__(self, host_name="localhost", port_num=6379, reuse_port=True): | |
self.host_name = host_name | |
self.port_num = port_num | |
self.reuse_port = reuse_port |
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 socket | |
import threading | |
class ThreadedServer: | |
def __init__(self, host_name="localhost", port_num=6379, reuse_port=True): | |
self.host_name = host_name | |
self.port_num = port_num | |
self.reuse_port = reuse_port | |
self.init_server() |
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 | |
import socket | |
from asyncio import AbstractEventLoop | |
class AsyncSocketServer: | |
def __init__(self, host_name="localhost", port_num=6379, reuse_port=True): | |
self.host_name = host_name | |
self.port_num = port_num | |
self.reuse_port = reuse_port |
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 AsyncIOServer: | |
def __init__(self, host_name="localhost", port_num=6379, reuse_port=True): | |
self.host_name = host_name | |
self.port_num = port_num | |
self.reuse_port = reuse_port | |
async def __start_server(self): |
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
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*- | |
;; Place your private configuration here! Remember, you do not need to run 'doom | |
;; sync' after modifying this file! | |
;; Some functionality uses this to identify you, e.g. GPG configuration, email | |
;; clients, file templates and snippets. It is optional. | |
(setq user-full-name "Deepanshu lulla" | |
user-mail-address "deepanshu.lulla@gmail.com") |
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
;;; init.el -*- lexical-binding: t; -*- | |
;; This file controls what Doom modules are enabled and what order they load | |
;; in. Remember to run 'doom sync' after modifying it! | |
;; NOTE Press 'SPC h d h' (or 'C-h d h' for non-vim users) to access Doom's | |
;; documentation. There you'll find a link to Doom's Module Index where all | |
;; of our modules are listed, including what flags they support. | |
;; NOTE Move your cursor over a module's name (or its flags) and press 'K' (or |
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
#include <iostream> | |
#include <string> | |
template <class T> | |
class Array2D { | |
public: | |
Array2D(int dim1, int dim2) :d_container(new Array1D(dim1)) { | |
for (int i=0; i< dim1; ++i) { | |
Array1D array1(dim2); |
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
#include <exception> | |
#include <memory> | |
#include <mutex> | |
#include <queue> | |
struct EmptyQueueException : std::exception { | |
const char * what() const throw() { | |
return "Empty queue"; | |
} | |
}; |
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
#include<iostream> | |
#include <cstring> | |
using namespace std; | |
template <typename T=char> | |
class MyString { | |
public: | |
MyString();//default constructor |
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
// Type your code here, or load an example. | |
#include <string> | |
#include <iostream> | |
using namespace std; | |
template<typename T, size_t N> | |
constexpr size_t arraySize(T (&)[N]) noexcept { | |
return N; |
NewerOlder