Skip to content

Instantly share code, notes, and snippets.

View solarhell's full-sized avatar
🐽
Focusing

jiaxin solarhell

🐽
Focusing
  • Nanking
  • 06:34 (UTC +08:00)
View GitHub Profile
@solarhell
solarhell / main.go
Created December 2, 2024 10:31
go-rod generate pdf from html
package main
import (
"fmt"
"os"
"path"
"github.com/go-rod/rod"
"github.com/go-rod/rod/lib/launcher"
"github.com/go-rod/rod/lib/proto"

表达式

表达式是操作符将操作数组合起来形成的。操作符除了我们熟知的加减乘除二元的和正负号这种一元的外,还有像函数调用使用的()和数组,map索引使用的[]等等, 所以foo()v_map[index]都是一个表达式。而像已经定义的变量,例如x,它其实可以理解成(x),所以它也是一个表达式。

赋值语句

参考了了一下 Go 的文档,赋值语句应该和 标识符 没有关系,它的定义是这样的:

@solarhell
solarhell / graceful.go
Created July 7, 2018 06:38 — forked from peterhellberg/graceful.go
*http.Server in Go 1.8 supports graceful shutdown. This is a small example.
package main
import (
"context"
"log"
"net/http"
"os"
"os/signal"
"time"
)
@solarhell
solarhell / npm.taobao.sh
Created July 4, 2018 02:10 — forked from 52cik/npm.taobao.sh
npm 淘宝镜像配置
npm set registry https://registry.npm.taobao.org # 注册模块镜像
npm set disturl https://npm.taobao.org/dist # node-gyp 编译依赖的 node 源码镜像
## 以下选择添加
npm set sass_binary_site https://npm.taobao.org/mirrors/node-sass # node-sass 二进制包镜像
npm set electron_mirror https://npm.taobao.org/mirrors/electron/ # electron 二进制包镜像
npm set puppeteer_download_host https://npm.taobao.org/mirrors # puppeteer 二进制包镜像
npm set chromedriver_cdnurl https://npm.taobao.org/mirrors/chromedriver # chromedriver 二进制包镜像
npm set operadriver_cdnurl https://npm.taobao.org/mirrors/operadriver # operadriver 二进制包镜像
npm set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs # phantomjs 二进制包镜像
@solarhell
solarhell / nginx-tls.conf
Last active January 10, 2018 09:41 — forked from gavinhungry/nginx-tls.conf
Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Name: nginx-tls.conf
# Auth: Gavin Lloyd <gavinhungry@gmail.com>
# Desc: Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Enables SPDY, PFS, HSTS and OCSP stapling. Configuration options not related
# to SSL/TLS are omitted here.
#
# Example: https://www.ssllabs.com/ssltest/analyze.html?d=gavinhungry.io
#
#!/bin/bash
cd ~/scripts/nsq
pkill -f nsq
nohup nsqlookupd 1>>nsqlookupd.log 2>>nsqlookupd_stderr.log &
nohup nsqd --lookupd-tcp-address=127.0.0.1:4160 1>>nsqd.log 2>>nsqd_stderr.log &
nohup nsqadmin --lookupd-http-address=127.0.0.1:4161 1>>nsqadmin.log 2>>nsqadmin_stderr.log &
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/Users/solarhell/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="robbyrussell"
@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)
@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 / aria2.conf
Created November 22, 2017 16:12
~/.aria2/aria2
## '#'开头为注释内容, 选项都有相应的注释说明, 根据需要修改 ##
## 被注释的选项填写的是默认值, 建议在需要修改时再取消注释 ##
## 文件保存相关 ##
# 文件的保存路径(可使用绝对路径或相对路径), 默认: 当前启动位置
dir=/Users/solarhell/Downloads/aria2
# 启用磁盘缓存, 0为禁用缓存, 需1.16以上版本, 默认:16M
#disk-cache=32M
# 文件预分配方式, 能有效降低磁盘碎片, 默认:prealloc