extern crate image;
extern crate rand;
use rand::Rng;
use std::fs::File;
use std::path::Path;
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
class Client(): | |
def __init__(self, evt_loop): | |
self.event_loop = evt_loop | |
self.reader = None | |
self.writer = None | |
async def execute(self, cmd): | |
if self.reader == None: | |
if cmd.startswith('.connect'): | |
cmd = cmd.replace('.connect', '').strip() |
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 | |
from resp import Client | |
async def main_client(prompt, evt_loop): | |
print(f'{prompt} Welcome to pyRedis') | |
running = True | |
cl = Client(evt_loop) | |
while running: | |
cmd = input(f'{prompt} ') |
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
/* | |
Given a linked list where each node has two pointers, one to the next node and one to a random node in the list, clone the linked list. | |
1 -> 2 -> 3 -> 4 -> null | |
| | | | | |
v v v v | |
3 1 3 2 | |
*/ | |
// Private node class | |
private static class Node { |
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
# https://www.geeksforgeeks.org/bubble-sort | |
def bubbleSort(arr): | |
n = len(arr) | |
# Traverse through all array elements | |
for i in range(n) : | |
# Last i elements are already in place | |
for j in range(0, n-i-1) : | |
# traverse the array from 0 to n-i-1 | |
# Swap if the element found is greater than the next element |
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 queue import Queue | |
class Node(object): | |
def __init__(self, data = None, left = None, right = None): | |
self.data = data | |
self.left = left | |
self.right = right | |
class BinaryTree(object): | |
def __init__(self, data=None): |
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
public static void removeChars(StringBuilder str, String remove){ | |
boolean flags[] = new boolean[128]; | |
int src, dst = 0; | |
for(char c : remove.toCharArray()){ | |
flag[c] = true; | |
} | |
for(src=0; src<str.length(); ++src){ | |
char c = str.charAt(src); |
A list of programming tutorials in which learners build an application from scratch. These tutorials are divided into different primary programming languages. Some have intermixed technologies and languages.
To get started, simply fork this repo. Please refer to CONTRIBUTING.md for contribution guidelines.
A list of tutorials that work towards the making of small to large projects in C.