Skip to content

Instantly share code, notes, and snippets.

@jemygraw
jemygraw / wxwork_robot.go
Created June 19, 2020 09:13
企业微信机器人接口调用代码
package wechat
// See doc at https://work.weixin.qq.com/api/doc/90000/90136/91770
import (
"bytes"
"crypto/md5"
"encoding/base64"
"encoding/json"
"fmt"
@jemygraw
jemygraw / context_demo.go
Created September 17, 2018 00:42
golang context demo
package main
import (
"context"
"fmt"
"sync"
"time"
)
func main() {
import scala.collection.mutable.ListBuffer
import scala.util.control.Breaks
def parseCdnLogLineV2(line: String): Array[String] = {
val itemBuffer = new ListBuffer[String]()
val length = line.length
var startIndex = 0
var delimiter = " "
var elemStart = ""
val loop = new Breaks
@jemygraw
jemygraw / qiniu_put_file.go
Created September 19, 2017 10:05
qiniu_put_file.go
package main
import (
"context"
"flag"
"fmt"
"net/url"
"os"
"time"
@jemygraw
jemygraw / iptc_jpeg_meta_info_viewer.c
Created August 29, 2017 07:37
JPEG file IPTC meta info read example
#include <libiptcdata/iptc-data.h>
#include <libiptcdata/iptc-jpeg.h>
#include <jpeglib.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void iptc_dataset_foreach_handler(IptcDataSet *dataset, void *datasetName) {
IptcFormat format = iptc_dataset_get_format(dataset);
printf("filter: %s\n\n", (char *) datasetName);
@jemygraw
jemygraw / getip.go
Created May 23, 2017 03:35
load ip from the qip file
package main
import (
"bufio"
"flag"
"fmt"
"os"
"os/exec"
"sync"
)
@jemygraw
jemygraw / golang_regexp_group.go
Created January 17, 2017 06:39
golang regexp group
package main
import (
"fmt"
"regexp"
)
func main() {
rule := `^/upload/photo/(\w+)/(\w+)/(\w+)/(70|60|48|32|16|80|150)\_(.*)$`
str := "/upload/photo/0/0/0/70_u57313833790062233714.jpg"
@jemygraw
jemygraw / compareflow.py
Last active December 20, 2016 09:55
compare flow
import sys
fname1 = sys.argv[1]
fname2 = sys.argv[2]
first_dict = {}
second_dict = {}
fp1 = open(fname1)
for line in fp1:
@jemygraw
jemygraw / get-kodo-space-usage-info.go
Created December 16, 2016 10:06
get kodo space usage info
package main
import (
"fmt"
"golang.org/x/net/context"
"qiniupkg.com/api.v7/conf"
"qiniupkg.com/api.v7/kodo"
)
const (
@jemygraw
jemygraw / split-cdn-access-log-items.go
Last active December 14, 2016 09:58
split the cdn access log items
package main
import (
"bufio"
"fmt"
"os"
"strings"
)
/*