Skip to content

Instantly share code, notes, and snippets.

View shanezhiu's full-sized avatar
🎯
Focusing

shane shanezhiu

🎯
Focusing
View GitHub Profile
@draveness
draveness / benchmark_foreign_key.go
Last active October 14, 2020 07:42
Benchmark Foreign Key
package main
import (
"testing"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/mysql"
)
type Post struct {
@bonniss
bonniss / github-search-cheatsheet.md
Last active April 9, 2025 18:54
Github search cheatsheet from official docs.

Github Search Cheat Sheet

GitHub’s search supports a variety of different operations. Here’s a quick cheat sheet for some of the common searches.

For more information, visit our search help section.

Basic search

@noamtamim
noamtamim / README.md
Last active April 23, 2025 16:57
Markdown with PlantUML

How to use PlantUML with Markdown

PlantUML is a really awesome way to create diagrams by writing code instead of drawing and dragging visual elements. Markdown is a really nice documentation tool.

Here's how I combine the two, to create docs with embedded diagrams.

Step 0: Setup

Get the command-line PlantUML from the download page or your relevant package manager.

@ross-spencer
ross-spencer / kind-code-review.md
Last active April 24, 2025 18:31
Code Review (CR) Guidelines and Principles
Status: Work in progress
Use: Unofficial
Language: Python

Kind code review

Summary

@baymaxium
baymaxium / content.md
Created October 18, 2017 09:12
趣味解析,斗鱼直播大数据的玩法儿

原文:CSDN大数据

↑ 点击上方蓝字关注我们,和小伙伴一起聊技术!

作者 | 吴瑞诚

文章来源GitChat,CSDN独家合作发布,点击「阅读原文」查看交流实录

@nickbclifford
nickbclifford / auto-deploying.md
Last active May 15, 2023 09:02
How to automatically deploy code to a server using Travis CI

Auto-Deploying via Travis CI

Because Travis CI can automatically execute scripts after successfully (or unsuccessfully!) executing tests, it is an obvious choice for a deployment tool. In order to deploy to a Git repository on a remote server, the process generally is as follows:

  • Set up SSH keys
  • Add the server's copy of the repository as a Git remote
  • Push to the remote
  • SSH into the server and execute any installation/compilation/miscellaneous commands

Before even touching .travis.yml...

Users

@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 13, 2025 07:56
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@robertpainsi
robertpainsi / commit-message-guidelines.md
Last active May 7, 2025 20:05
Commit message guidelines

Commit Message Guidelines

Short (72 chars or less) summary

More detailed explanatory text. Wrap it to 72 characters. The blank
line separating the summary from the body is critical (unless you omit
the body entirely).

Write your commit message in the imperative: "Fix bug" and not "Fixed
bug" or "Fixes bug." This convention matches up with commit messages
@dailc
dailc / weichat-tips.js
Created April 27, 2017 06:44
[二维码扫码登录] 二维码扫码登录的原理 #tags: 扫码登录
1.打开网页,网页跳出一个登陆二维码
* 这时候网页已经和服务器建立了一个阻塞的长连接(或者是轮询也可以),此时会有一个唯一UUID(并且这个UUID嵌到了登录二维码中)
* 网页和服务器会通信(长连接或轮询)
2.用户看到二维码后,会用手机扫码(譬如微信登录就用微信扫码)
* 这时候对应的APP会把用户信息token和UUID(二维码中识别的)打包发送到相应的服务器
* 虽然二维码是暴露的,但是用户信息是只有这个APP能获取的,因此不用担心第三方可以直接登录
3.服务器验证通过后,得知这个UUID登陆成功,则会允许网页登录
* 这时候就登录成功了,会为这个UUID网页对应的Session分配一个token,(在限定的条件下)可以访问服务
4.登录成功后,对应的APP可以给出相应的提示,提升体验
@danielv99
danielv99 / l2tpclient.sh
Last active May 13, 2025 08:43
L2TP VPN client on Linux Debian
# Requirements
# debian/ubuntu
apt-get -y update && apt-get -y upgrade
apt-get -y install strongswan xl2tpd libstrongswan-standard-plugins libstrongswan-extra-plugins
VPN_SERVER_IP=''
VPN_IPSEC_PSK='y'
VPN_USER=''
VPN_PASSWORD=''