Skip to content

Instantly share code, notes, and snippets.

View GeraldHost's full-sized avatar
🏴‍☠️
Focusing

Gerald Host GeraldHost

🏴‍☠️
Focusing
View GitHub Profile
#! /usr/bin/env python
from string import punctuation
from string import ascii_lowercase
from string import ascii_uppercase
from random import randint
import numpy as np
nums = '0123456789'
@GeraldHost
GeraldHost / server.js
Created January 28, 2021 13:37
simple-node-server
const http = require("http");
const port = 3000;
let count = 1;
const requestHandler = (request, response) => {
console.log(count);
count++;
response.end("Hello Node.js Server!");
};
@GeraldHost
GeraldHost / main.go
Created January 28, 2021 12:21
go-lang-conn-pool
package main
import (
"github.com/valyala/fasthttp"
"net"
"time"
"sync"
"fmt"
)
@GeraldHost
GeraldHost / basic-idea.go
Created January 27, 2021 20:14
basic-go-faster-http-idea
// This is obviously shit code but you get the idea
// we use a connection and when it closes we open a new one
// but we want this to run concurrently so we need some kind of connection
// pool that all the go routines can dip into
func Dial() net.Conn {
conn, _ := net.Dial("tcp", "localhost:3000")
return conn
}
@GeraldHost
GeraldHost / basic-idea.go
Created January 27, 2021 19:48
basic-go-faster-http-idea
// This is obviously shit code but you get the idea
// we use a connection and when it closes we open a new one
// but we want this to run concurrently so we need some kind of connection
// pool that all the go routines can dip into
func Dial() net.Conn {
conn, _ := net.Dial("tcp", "localhost:3000")
return conn
}
@GeraldHost
GeraldHost / main.go
Last active January 27, 2021 13:39
http-benchmark
package main
import (
"github.com/valyala/fasthttp"
"net"
"os"
"sync"
"time"
"fmt"
)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>The HTML5 Herald</title>
<meta name="description" content="The HTML5 Herald" />
<meta name="author" content="SitePoint" />
@GeraldHost
GeraldHost / lazy-pipe.js
Created July 9, 2020 08:40
Lazy Pipeline with Iterators
function* itOne(it) {
let current = it.next()
while(current.done == false){
console.log("ONE");
yield current.value + 2;
current = it.next();
}
}
function* itTwo(it) {