Skip to content

Instantly share code, notes, and snippets.

View runningzyp's full-sized avatar
💭
we say ~~~

YunpengZhan runningzyp

💭
we say ~~~
View GitHub Profile
@mchirico
mchirico / gzipWriter.go
Created August 3, 2013 19:34
Example of writing a gzip file in go (golang). This appends data to the same file every time it is run. It is important to Flush() the data before closing the file.
/*
This is an example of a golang gzip writer program,
which appends data to a file.
*/
package main
@PumpkinSeed
PumpkinSeed / memory.go
Created July 21, 2017 11:23
Visual example how golang GC and memory usage working.
package main
import (
"log"
"runtime"
"time"
)
var counter int
@lelandbatey
lelandbatey / assign_struct_field_by_tag_name.go
Last active February 28, 2025 19:53
Golang reflection; assign to struct field by tag name
package main
import (
"fmt"
"reflect"
"strings"
)
// The goal: allow assignment to a go struct field based on the name that field
// is tagged with (specifically it's json-tagged name).
@tigerhawkvok
tigerhawkvok / poetry-convert.py
Last active December 11, 2024 16:22
Convert a requirements.txt file to a Poetry project
#!python3
"""
Convert a requirements.txt file to a Poetry project.
Just place in the root of your working directory and run!
"""
sourceFile = "./requirements.txt"
import re
import os