Skip to content

Instantly share code, notes, and snippets.

View kelby's full-sized avatar
💭
lalala...

kelby

💭
lalala...
View GitHub Profile
@kelby
kelby / stocks_exchange.rb
Last active January 24, 2019 13:22
StocksExchange API Integration
require 'openssl'
require 'httparty'
url = "https://stocks.exchange/api2"
api_key = "your_api_key"
api_secret = "your_api_secret"
nonce = Time.now.to_i
method = "GetInfo"
@kelby
kelby / schnorr.go
Created September 14, 2018 06:44
Schnorr Signatures in Go
package main
import (
"fmt"
"gopkg.in/dedis/kyber.v2"
"gopkg.in/dedis/kyber.v2/group/edwards25519"
)
var curve = edwards25519.NewBlakeSHA256Ed25519()
var sha256 = curve.Hash()
@kelby
kelby / schnorr.go
Created September 14, 2018 06:44
Schnorr Signatures in Go
package main
import (
"fmt"
"gopkg.in/dedis/kyber.v2"
"gopkg.in/dedis/kyber.v2/group/edwards25519"
)
var curve = edwards25519.NewBlakeSHA256Ed25519()
var sha256 = curve.Hash()
@kelby
kelby / main.go
Created September 22, 2018 02:05
Parsing JSON files With Golang
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"strconv"
)
@kelby
kelby / goroutine_channel.go
Created October 7, 2018 00:28
Go 模拟生产者消费者
package main
import (
"fmt"
"math/rand"
"time"
)
type producer struct {
id int
@kelby
kelby / timeout.go
Created October 7, 2018 00:32
Golang 让 for 循环运行一段时间超时自动退出
package main
import (
"fmt"
"time"
)
func main() {
timeout := time.After(time.Second * 10)
finish := make(chan bool)
@kelby
kelby / binary-search-tree.go
Last active October 10, 2018 00:31
Go 实现常见数据结构
// Package binarysearchtree creates a ItemBinarySearchTree data structure for the Item type
package binarysearchtree
import (
"fmt"
"sync"
"github.com/cheekybits/genny/generic"
)
@kelby
kelby / Bulletproofs.go
Created October 22, 2018 16:46
This project implements Bulletproofs in Go.
package bp
import (
"crypto/elliptic"
"crypto/rand"
"crypto/sha256"
"encoding/binary"
"math/big"
"fmt"
@kelby
kelby / google_plus.go
Created October 26, 2018 01:38
Crawl google plus activities.
require 'google_plus'
api_key = "your api key"
user_id = "google plus user id"
GooglePlus.api_key = api_key
person = GooglePlus::Person.get(user_id, :key => api_key)
cursor = person.list_activities
@kelby
kelby / dota2.py
Last active November 5, 2023 09:53
Python 实现:连接 Steam 客户端,登录账号,启动 Dota2 客户端,抓取实时比赛数据。
from steam import SteamClient
from dota2 import Dota2Client
client = SteamClient()
dota = Dota2Client(client)
LOGON_DETAILS = {
'username': "your-steam-username",
'password': "your-steam-password",