Skip to content

Instantly share code, notes, and snippets.

View lesismal's full-sized avatar
😁

lesismal lesismal

😁
View GitHub Profile
@lesismal
lesismal / queue.go
Last active December 16, 2023 11:41
queue based on arrays/buffer blocks
package main
import (
"fmt"
"sync"
"time"
)
func main() {
q := &Queue{}
@lesismal
lesismal / cpu_cache_consistancy.go
Created December 13, 2023 14:43
cpu cache一致性、volatile、编译器优化
package main
func main() {
flag := true
// 协程 A
go func() {
println("Goroutine start\n")
for flag {
println("Goroutine flag:", flag)
@lesismal
lesismal / tasktree.go
Created May 4, 2023 16:19
TaskTree.go
package main
import (
"log"
"sync"
"sync/atomic"
"time"
)
type Node struct {
@lesismal
lesismal / netbuffer_test.go
Last active December 13, 2023 18:11
go net.Buffers vs user buffer append
package test
import (
"bufio"
"io"
"log"
"net"
"sync"
"testing"
"time"
@lesismal
lesismal / go_generics_performance.md
Last active December 13, 2023 18:11
go generics performance

看了下简单的基础类型泛型汇编

// main.go
package main

func SumInt8(a, b int8) int8 {
	return a + b
}
@lesismal
lesismal / class.go
Last active February 21, 2022 10:58
use go like class
package main
type IAB interface {
FooA()
FooB()
}
type A struct{}
func (a *A) FooA() {
@lesismal
lesismal / converter.py
Last active November 10, 2021 19:31
pi_nums.py
# -*- coding:utf-8 -*-
#!/usr/bin/python3
import os
import datetime
class PIConverter:
def __init__(self, maxRead=0, minNum=100000, maxNum=99999999):
self.maxRead = maxRead
self.minNum = minNum
@lesismal
lesismal / bench.go
Last active July 4, 2023 03:04
nbio sendfile on linux
package main
import (
"fmt"
"io"
"io/ioutil"
"net"
"os"
"time"
@lesismal
lesismal / 2019-https-localhost.md
Created February 22, 2021 07:56 — forked from cecilemuller/2019-https-localhost.md
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).