Skip to content

Instantly share code, notes, and snippets.

View dengyunsheng250's full-sized avatar

邓云升 dengyunsheng250

  • northwest university
  • 15:37 (UTC -12:00)
View GitHub Profile
@jauhararifin
jauhararifin / redis.go
Last active January 10, 2024 15:10
Simple redis implementation in Golang supporting only GET and SET operations
package main
import (
"bufio"
"errors"
"fmt"
"io"
"log/slog"
"net"
"os"
@alexedwards
alexedwards / cache.go
Last active June 4, 2024 08:01
Generic in-memory cache implementation in Go
package cache
import (
"sync"
"time"
)
// Cache is a basic in-memory key-value cache implementation.
type Cache[K comparable, V any] struct {
items map[K]V // The map storing key-value pairs.
@jiacai2050
jiacai2050 / podcast-fetcher.go
Created November 27, 2023 13:55
Download podcasts
package main
import (
"encoding/xml"
"flag"
"fmt"
"go-apps/pkg/flagx"
"go-apps/pkg/util"
"io"
"log"
@eatonphil
eatonphil / btree.py
Created August 27, 2023 16:47
Python In-memory B-Tree
import math
import uuid
class BTree:
def __init__(self, order=3):
self.root = BTreeNode(order)
def insert(self, toinsert):
all_elements = self.list()
@StephanTLavavej
StephanTLavavej / videos.md
Last active June 30, 2024 20:13
C++ Videos by Stephan T. Lavavej
@graninas
graninas / What_killed_Haskell_could_kill_Rust.md
Last active June 22, 2024 07:05
What killed Haskell, could kill Rust, too

At the beginning of 2030, I found this essay in my archives. From what I know today, I think it was very insightful at the moment of writing. And I feel it should be published because it can teach us, Rust developers, how to prevent that sad story from happening again.


What killed Haskell, could kill Rust, too

What killed Haskell, could kill Rust, too. Why would I even mention Haskell in this context? Well, Haskell and Rust are deeply related. Not because Rust is Haskell without HKTs. (Some of you know what that means, and the rest of you will wonder for a very long time). Much of the style of Rust is similar in many ways to the style of Haskell. In some sense Rust is a reincarnation of Haskell, with a little bit of C-ish like syntax, a very small amount.

Is Haskell dead?

@nixpulvis
nixpulvis / ping.rs
Created November 18, 2015 21:38
A simple Ping implementation in Rust.
#![feature(ip_addr, raw)]
extern crate pnet;
use std::net::{IpAddr, Ipv4Addr};
use pnet::transport::TransportChannelType::Layer4;
use pnet::transport::TransportProtocol::Ipv4;
use pnet::transport::transport_channel;
use pnet::packet::ip::IpNextHeaderProtocols;
use pnet::packet::Packet;
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs