Skip to content

Instantly share code, notes, and snippets.

View joeke80215's full-sized avatar
:octocat:

jokie.ke joeke80215

:octocat:
  • Taipei City, Taiwan
View GitHub Profile
@joeke80215
joeke80215 / client.go
Created February 15, 2019 14:39
Golang http request demo
package main
import (
"bytes"
"encoding/json"
"io/ioutil"
"log"
"net/http"
"net/url"
"strings"
@joeke80215
joeke80215 / string_combine.c
Created February 16, 2019 06:58
Combine New String with C
#include <stdio.h>
#include <stdlib.h>
char* CombineNewString(char *w1,char *w2)
{
size_t count1,count2;
int index;
char *t,*t1,*t2;
count1 = 0;
@joeke80215
joeke80215 / main.c
Created February 16, 2019 14:00
Mysql With C Demo
#include <stdio.h>
#include <my_global.h>
#include <mysql.h>
int main(void)
{
MYSQL *conn;
conn = mysql_init(NULL);
if (conn == NULL)
{
@joeke80215
joeke80215 / btree.c
Created February 17, 2019 13:29
btree with C
#include <stdio.h>
#include <stdlib.h>
struct Node
{
int Val;
struct Node *left;
struct Node *right;
};
@joeke80215
joeke80215 / atomicTest.go
Last active February 25, 2019 05:08
Golang http atomic vs mutex
package main
import (
"log"
"net/http"
"sync/atomic"
)
type redirector struct {
counter uint32
@joeke80215
joeke80215 / main.go
Created April 20, 2019 13:01
golang max duplicate element
package main
import "fmt"
// MaxDup input a random slice and return max duplicate element and lenght
func MaxDup(a []int) (int, int) {
maxV := 0
max := 0
b := make(map[int]int)
@joeke80215
joeke80215 / main.go
Created April 21, 2019 09:04
Golang 最常連續數組
package main
import "fmt"
// longestSlice Longest Consecutive Sequence
func longestConsSeq(sorted []int) ([]int, int) {
max := 1
head := 0
for i := 0; i < len(sorted); i++ {
cur := 1
@joeke80215
joeke80215 / main.go
Last active October 12, 2022 00:38
golang fanout example
package main
import (
"fmt"
)
func testP(in <-chan string) {
for v := range in {
fmt.Println(v)
}
@joeke80215
joeke80215 / .settings.json
Last active October 12, 2022 00:38
vscode vue config
{
"vetur.format.defaultFormatter.js": "vscode-typescript",
"vetur.validation.template": true,
"eslint.validate": [
{
"language": "vue",
"autoFix": true
},
{
"language": "html",
@joeke80215
joeke80215 / gen_rand_string.go
Created August 9, 2019 01:20
generate random string with golang
package auth
import (
"crypto/hmac"
"crypto/rand"
"crypto/sha256"
"encoding/hex"
"log"
)