Skip to content

Instantly share code, notes, and snippets.

View toannd96's full-sized avatar

Nguyễn Đắc Toàn toannd96

View GitHub Profile
@toannd96
toannd96 / StreamToString.go
Created April 15, 2021 08:29 — forked from dixudx/StreamToString.go
Golang: io.Reader stream to string or byte slice
import "bytes"
func StreamToByte(stream io.Reader) []byte {
buf := new(bytes.Buffer)
buf.ReadFrom(stream)
return buf.Bytes()
}
func StreamToString(stream io.Reader) string {
buf := new(bytes.Buffer)
@toannd96
toannd96 / jobstreet.go
Last active January 6, 2022 16:44
crawl jobstreet use channel, colly and goquery
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"os"
"strconv"
"sync"
@toannd96
toannd96 / masothue.go
Last active January 8, 2022 08:48
crawl masothue.com
package main
import (
"encoding/json"
"fmt"
"net/http"
"os"
"sync"
"time"
@toannd96
toannd96 / main.go
Created July 28, 2022 04:37 — forked from brunoluiz/main.go
rrweb-server-ui-hack
package main
// ☢️ WARNING: If you are alergic to messy cowboy codes, please don't read the code below ☢️
//
// # Intro:
//
// This snippet of magic is to test rrweb as a possible replacement to FullStory. It uses badger as storage because I
// didn't want to deal with setting up a container and migrations for storage.
// > FullStory is a tool to record user sessions for further analysis (can be for debugging, UX etc)
//
@toannd96
toannd96 / main.go
Created January 18, 2023 04:41 — forked from aliforever/main.go
telegram-bot-api pagination example
package main
import (
"fmt"
"strconv"
"strings"
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api"
)