Skip to content

Instantly share code, notes, and snippets.

View solarhell's full-sized avatar
🐽
Focusing

jiaxin solarhell

🐽
Focusing
  • Nanking
  • 20:46 (UTC +08:00)
View GitHub Profile
@solarhell
solarhell / bezier.js
Created July 28, 2016 07:11 — forked from LiuJi-Jim/bezier.js
De Casteljau Bezier
function DeCasteljauBezier(points, density, step){
//if (points.length < 3) return null;
console.time('bezier');
var ps = points.map(function(p){
return {
x: p.x,
y: p.y
};
}),
results = [],
@solarhell
solarhell / config.fish
Last active November 28, 2017 03:36
~/.config/fish/config.fish
alias glgg='git log --graph --max-count=5'
alias glgga='git log --graph --decorate --all'
set -g fish_user_paths "/usr/local/sbin" $fish_user_paths
set -x GOPATH $HOME/Documents/go
set -x PATH $PATH $GOPATH/bin
'use strict';
function randomColor() {
return '#' + function co(lor) {
return (lor += [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'a', 'b', 'c', 'd', 'e', 'f'][Math.floor(Math.random() * 16)]) && lor.length === 6 ? lor : co(lor);
}('');
}
@solarhell
solarhell / conf.md
Last active September 21, 2017 07:56
Some configuration files for linux software

nginx.conf

worker_processes auto;

events {
    worker_connections 65536;
    use epoll;
    multi_accept on;
}
@solarhell
solarhell / buyao.py
Created August 27, 2017 02:49
不要音乐
#!/usr/local/bin/python3
# -*- coding: utf-8 -*-
import os
from pathlib import Path
import requests
appkey = 'BYMUSICOFFVN0DtKGcebowgEPLtASJfBBn6iOTQ'
ac = 'list'
@solarhell
solarhell / golang, ubuntu go get in china.md
Created November 7, 2017 06:56 — forked from alexniver/golang, ubuntu go get in china.md
ubuntu下, 使用shadowsock和Privoxy帮助你在命令行中, 无障碍进行go get

#前言 由于大家都懂的, 国内使用go get的时候, 经常会各种失败, 如果有vpn的话, 打开vpn, 问题就解决了, 但vpn其实挺不灵活的.

相对来说shadowsock则灵活得多.

#解决方案 shadowsock + Privoxy

思路就是, 使用shadowsock建立一个本地sock5代理, 但因为go get 需要http代理, 所以需要使用privoxy把sock5代理转为http代理.

@solarhell
solarhell / vineScrape.go
Created November 8, 2017 15:04 — forked from cryptix/vineScrape.go
extract a javascript object value from a html page using goquery and otto
package main
import (
"errors"
"log"
"os"
"github.com/PuerkitoBio/goquery"
"github.com/robertkrimen/otto"
)
@solarhell
solarhell / aria2.conf
Created November 22, 2017 16:12
~/.aria2/aria2
## '#'开头为注释内容, 选项都有相应的注释说明, 根据需要修改 ##
## 被注释的选项填写的是默认值, 建议在需要修改时再取消注释 ##
## 文件保存相关 ##
# 文件的保存路径(可使用绝对路径或相对路径), 默认: 当前启动位置
dir=/Users/solarhell/Downloads/aria2
# 启用磁盘缓存, 0为禁用缓存, 需1.16以上版本, 默认:16M
#disk-cache=32M
# 文件预分配方式, 能有效降低磁盘碎片, 默认:prealloc
@solarhell
solarhell / demo.go
Last active December 6, 2017 02:56
package main
import (
"fmt"
"io/ioutil"
"net/http"
"os"
"golang.org/x/net/proxy"
)
@solarhell
solarhell / ChinaPhoneNumber.js
Created December 22, 2017 06:09
RegEx Based Verify China Phone Number
// includes China Mobile, China Unicom, China Telecom
const isChinaPhoneNumber = phone => /^1(?:70\d|(?:9[89]|8[0-24-9]|7[135-8]|66|5[0-35-9])\d|3(?:4[0-8]|[0-35-9]\d))\d{7}$/.test(phone)