Skip to content

Instantly share code, notes, and snippets.

View yixiaoyx's full-sized avatar

Yi Xiao yixiaoyx

View GitHub Profile

Keybase proof

I hereby claim:

  • I am yixiaoyx on github.
  • I am yixiaoyx (https://keybase.io/yixiaoyx) on keybase.
  • I have a public key ASBuZttF4Hs-DL43kptn9V91Co57ol75ZnionNukh0OLmgo

To claim this, I am signing this object:

@yixiaoyx
yixiaoyx / price_watcher.py
Last active June 12, 2020 00:21
A script to detect price drop
#!/usr/bin/python3
# This script is supposed to be run on a linux machine with a mail server, i.e. can send emails via the `mail` command.
# Can use cron to set up a schedule to run the script.
import re
import requests
import subprocess
import time
// generates an image in grayscale
package main
import "golang.org/x/tour/pic"
// my solution
func Pic(dx, dy int) [][]uint8 {
p := make([][]uint8, dy)
for i := range p {
@yixiaoyx
yixiaoyx / sqrt.go
Last active May 26, 2019 02:33
A Tour of Go exercise
// Implement square root calculation
package main
import (
"fmt"
"math"
)
// my solution
@yixiaoyx
yixiaoyx / word-count.go
Last active May 26, 2019 02:33
A Tour of Go Exercise
// count occurrences of words in a sentence
package main
import (
"golang.org/x/tour/wc"
"strings"
)
// my solution here
func WordCount(s string) map[string]int {
@yixiaoyx
yixiaoyx / fibonacci-closure.go
Last active May 26, 2019 02:33
A Tour of Go exercise
// generates a series of fibonacci numbers
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
// my solution here
func fibonacci() func() int {