Skip to content

Instantly share code, notes, and snippets.

View gmailzj's full-sized avatar

lake gmailzj

View GitHub Profile
@gmailzj
gmailzj / Install-php5.6-on-Centos7.md
Created November 22, 2022 09:23 — forked from ayonliu/Install-php5.6-on-Centos7.md
Install php5.6 on Centos 7
@gmailzj
gmailzj / 00_README.md
Created October 31, 2022 18:02 — forked from YumaInaura/00_README.md
Golang — Understanding channel, buffer, blocking, deadlock and happy groutines.

Golang — Understanding channel, buffer, blocking, deadlock and happy groutines.

I was so confused to understand behaviior of Golang channels, buffer, blocking, deadlocking and groutines.

I read Go by Example topics.

@gmailzj
gmailzj / semantic-commit-messages.md
Created October 30, 2022 05:53 — forked from joshbuchea/semantic-commit-messages.md
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

@gmailzj
gmailzj / rgrow.c
Created July 4, 2022 15:54 — forked from lecram/rgrow.c
Region Growing (C)
#include <stdlib.h>
#include <stdio.h>
#include <opencv/cv.h>
#include <opencv/highgui.h>
typedef struct {
unsigned char r;
unsigned char g;
unsigned char b;
package main
import (
"database/sql"
"strconv"
"log"
"net/http"
"fmt"
"bytes"
"gopkg.in/gin-gonic/gin.v1"
@gmailzj
gmailzj / gist:025cb296eaa22e597e76877a01bb4cb6
Created December 3, 2018 04:28 — forked from joho/gist:3735740
PostgreSQL 9.2 upgrade steps
Steps to install and run PostgreSQL 9.2 using Homebrew (Mac OS X)
(if you aren't using version 9.1.5, change line 6 with the correct version)
1. launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
2. mv /usr/local/var/postgres /usr/local/var/postgres91
3. brew update
4. brew upgrade postgresql
5. initdb /usr/local/var/postgres -E utf8
6. pg_upgrade -b /usr/local/Cellar/postgresql/9.1.5/bin -B /usr/local/Cellar/postgresql/9.2.0/bin -d /usr/local/var/postgres91 -D /usr/local/var/postgres
7. cp /usr/local/Cellar/postgresql/9.2.0/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
@gmailzj
gmailzj / markdownhere.css
Created November 21, 2018 12:53 — forked from xiaolai/markdownhere.css
markdown-here-css
.markdown-here-wrapper {
font-size: 16px;
line-height: 1.8em;
letter-spacing: 0.1em;
}
pre, code {
font-size: 14px;
font-family: Roboto, 'Courier New', Consolas, Inconsolata, Courier, monospace;
@gmailzj
gmailzj / exercise.tour.go
Created November 9, 2018 10:27 — forked from zyxar/exercise.tour.go
tour.golang exercise solutions
/* Exercise: Loops and Functions #43 */
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
z := float64(2.)
@gmailzj
gmailzj / jwt-expiration.md
Created November 7, 2018 04:56 — forked from soulmachine/jwt-expiration.md
How to deal with JWT expiration?

First of all, please note that token expiration and revoking are two different things.

  1. Expiration only happens for web apps, not for native mobile apps, because native apps never expire.
  2. Revoking only happens when (1) uses click the logout button on the website or native Apps;(2) users reset their passwords; (3) users revoke their tokens explicitly in the administration panel.

1. How to hadle JWT expiration

A JWT token that never expires is dangerous if the token is stolen then someone can always access the user's data.

Quoted from JWT RFC:

@gmailzj
gmailzj / interface.go
Created October 29, 2018 06:24 — forked from zhyq0826/interface.go
go interface description
package main
import (
"fmt"
)
//1
type I interface {
Get() int
Set(int)