Skip to content

Instantly share code, notes, and snippets.

View cctor's full-sized avatar
🎯
Focusing

cctor

🎯
Focusing
View GitHub Profile
@cctor
cctor / Makefile
Created September 29, 2020 03:11
cpp basic makefile with clang++ on unix-like system
cc = "clang++"
deps = $(shell find ./ -name "*.h")
src = $(shell find ./ -name "*.cpp")
obj = $(src:%.cpp=%.o)
out = "main"
$(out) : $(obj)
$(cc) -std=c++2a $(obj) -o $(out)
@cctor
cctor / cpp_delete_pointer
Created September 29, 2020 03:14
delete pointer and array pointer
#include <cstdio>
void test_dynamic_alloc_ptr_and_arr_ptr() {
int* int_ptr = new int(10);
printf("the int_ptr is: %p\t the value is: %d\n", int_ptr, *int_ptr);
int* int_ptr_arr = new int[2];
int_ptr_arr[0] = 1;
int_ptr_arr[1] = 2;
printf("the int ptr arr is: %p\t the value is: %d\n", int_ptr_arr, *int_ptr_arr);
// 手动删除
@cctor
cctor / go_simple_http_server.go
Created November 9, 2020 06:58
simple http server in go-lang
package main
import (
"fmt"
"log"
"net/http"
)
const resp = `
Hello, world
@cctor
cctor / go_simple_http_server_with_cors.go
Created November 9, 2020 07:49
go simple http server with CORS
package main
import (
"fmt"
"log"
"net/http"
)
const resp = `
Hello, world
@cctor
cctor / 01_folds.fs
Created February 25, 2025 10:07 — forked from cloudRoutine/01_folds.fs
F# Transducers - they work for the most part
open System.Collections.Generic
open Microsoft.FSharp.Collections
[<RequireQualifiedAccess>]
module Folds =
// These are the fast implementations we actually want to use