Skip to content

Instantly share code, notes, and snippets.

View vanleantking's full-sized avatar
🤣

Le Van vanleantking

🤣
  • U
  • Binh Thanh
View GitHub Profile
@vanleantking
vanleantking / cookie_jar_golang
Created November 3, 2018 08:53 — forked from varver/cookie_jar_golang.go
Login to a website with this golang code using persistent cookies or cookie jar .
@vanleantking
vanleantking / gocookies.go
Created November 3, 2018 08:56 — forked from border/gocookies.go
go cookiejar demo
package main
import (
"io/ioutil"
"log"
"net/http"
"net/http/cookiejar"
)
var gCurCookies []*http.Cookie
@vanleantking
vanleantking / main.go
Created November 9, 2018 09:05 — forked from alexmullins/main.go
Goquery Remove Child Elements
// Stackoverflow Answer
// Original Question: http://stackoverflow.com/questions/32635943/get-text-from-div-without-child-elements/32640258#32640258
package main
import (
"fmt"
"strings"
"github.com/PuerkitoBio/goquery"
@vanleantking
vanleantking / AES-256 encryption and decryption in PHP and C#.md
Created November 15, 2018 12:03
AES-256 encryption and decryption in PHP and C#
@vanleantking
vanleantking / go-os-arch.md
Created November 19, 2018 04:24 — forked from asukakenji/0-go-os-arch.md
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.8.3 darwin/amd64.

A list of valid GOOS values

(Bold = supported by go out of the box, ie. without the help of a C compiler, etc.)

  • android
  • darwin
@vanleantking
vanleantking / Stopwords_vi.txt
Created December 3, 2018 07:14
Danh sách các stop words trong Tiếng Việt (phổ biến)
# Tạo trên tập dữ liệu 2 triệu tài liệu Tiếng Việt
# Xây dựng bằng cách tính IDF và chọn ra các từ có IDF nhỏ.
bị
bởi
cả
các
cái
cần
càng
chỉ
package mapreduce
func MapReduce(mapper func(interface{}, chan interface{}),
reducer func(chan interface{}, chan interface{}),
input chan interface{},
pool_size int) interface{}
{
reduce_input := make(chan interface{});
reduce_output := make(chan interface{});
worker_output := make(chan chan interface{}, pool_size);
@vanleantking
vanleantking / gist:b45ab950d10c4b778a65e59a0627d109
Created December 26, 2018 14:07 — forked from fj/gist:1597544
Slightly nicer way of writing large files to disk with PHP
// Copy big file from somewhere else
$src_filepath = 'http://example.com/all_the_things.txt'; $src = fopen($src_filepath, 'r');
$tmp_filepath = '...'; $tmp = fopen($tmp_filepath, 'w');
$buffer_size = 1024;
while (!feof($src)) {
$buffer = fread($src, $buffer_size); // Read big file/data source/etc. in small chunks
fwrite($tmp, $buffer); // Write in small chunks
}
@vanleantking
vanleantking / mgoExample.go
Created January 14, 2019 08:53 — forked from border/mgoExample.go
mgo example
package main
import (
"fmt"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"time"
)
type Person struct {
@vanleantking
vanleantking / GoMgoSample-1.go
Created January 16, 2019 13:14 — forked from ardan-bkennedy/GoMgoSample-1.go
Sample Go and MGO example
type (
// BuoyCondition contains information for an individual station.
BuoyCondition struct {
WindSpeed float64 `bson:"wind_speed_milehour"`
WindDirection int `bson:"wind_direction_degnorth"`
WindGust float64 `bson:"gust_wind_speed_milehour"`
}
// BuoyLocation contains the buoy's location.
BuoyLocation struct {