Skip to content

Instantly share code, notes, and snippets.

@reiki4040
reiki4040 / validator.go
Created December 1, 2014 14:47
validation memo
package main
import (
"errors"
"fmt"
"net/url"
"reflect"
"strconv"
"strings"
)
@reiki4040
reiki4040 / rune_count_in_string_bench_test.go
Created December 17, 2014 14:53
benchmark utf8.RuneCountInString()
package benchrunecount
import (
"testing"
"unicode/utf8"
)
func BenchmarkRunCountInString16ascii(b *testing.B) {
str := "abcdefghijklmnop"
for i := 0; i < b.N; i++ {
@reiki4040
reiki4040 / genpr.sh
Created March 8, 2017 12:44
auto generate pull request sample.
#!/bin/bash
function usage() {
cat <<_EOB
Create Pull Request that homebrew-rnzoo for new version.
Usage:
$(basename $0) <version> <sha256hash>
_EOB
}
@reiki4040
reiki4040 / inventory_replcacer.go
Created March 10, 2017 15:09
replace inventory file block for tool.
package main
import (
"bufio"
"fmt"
"io/ioutil"
"os"
"strings"
)
@reiki4040
reiki4040 / main.go
Created July 2, 2017 13:51
post slack with apex-go
package main
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
"os"
@reiki4040
reiki4040 / close_channel_messages.go
Created April 2, 2021 14:59
closed channel is not also send message to receivers only once but send to channel until release all receivers or program finished.
package main
import (
"fmt"
"time"
)
/*
closed channel is not also send message to receivers only once
but send to channel until release all receivers or program finished.