Skip to content

Instantly share code, notes, and snippets.

@azhao1981
azhao1981 / docker-registry-mirrors.md
Created March 10, 2021 03:53 — forked from y0ngb1n/docker-registry-mirrors.md
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized

Docker Hub 镜像加速器

国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Docker 官方和国内很多云服务商都提供了国内加速器服务。

配置加速地址

Ubuntu 16.04+、Debian 8+、CentOS 7+

创建或修改 /etc/docker/daemon.json

@azhao1981
azhao1981 / pre-commit
Created June 20, 2019 02:04 — forked from tinogomes/pre-commit-complete
Git Hook pre-commit to pass Rubocop and Brakeman on Rails application for validations
#!/bin/sh
#
# Check for ruby style errors
red='\033[0;31m'
green='\033[0;32m'
yellow='\033[0;33m'
NC='\033[0m'
if git rev-parse --verify HEAD >/dev/null 2>&1
@azhao1981
azhao1981 / README.md
Last active August 27, 2018 02:50 — forked from MarkMurphy/README.md
ActiveRecord: Store Milliseconds (or Microseconds) in Timestamps with Rails / MySQL

ActiveRecord: Store Milliseconds (or Microseconds) in DateTimes or Timestamps with Rails / MySQL

Milliseconds in your DateTimes or Timestamps.

We got 'em, you want 'em.

NOTE: only MySQL 5.6.4 and above supports DATETIME's with more precision than a second. For reference see MySQL 5.6.4 Changelog

Why

Shit needs to be PRECISE

@azhao1981
azhao1981 / add_milliseconds_to_mysql_and_activerecord_timestamps.md ActiveRecord: Store Milliseconds (or Microseconds) in Timestamps/Datetimes with Rails / MySQL

ActiveRecord: Store Milliseconds (or Microseconds) in Timestamps with Rails / MySQL

Milliseconds in your Timestamps.

We got 'em, you want 'em.

Why

Shit needs to be PRECISE

LICENSE

MIT

@azhao1981
azhao1981 / tab-trigger.js
Last active July 25, 2017 16:25 — forked from wesbos/tab-trigger.js
How to properly get a TAB trigger working with Emmet inside of JSX
{
"keys": ["tab"],
"command": "expand_abbreviation_by_tab",
// put comma-separated syntax selectors for which
// you want to expandEmmet abbreviations into "operand" key
// instead of SCOPE_SELECTOR.
// Examples: source.js, text.html - source
"context": [
{
@azhao1981
azhao1981 / Twelve_Go_Best_Practices.md
Created October 31, 2016 17:47 — forked from pzurek/Twelve_Go_Best_Practices.md
Twelve Go Best Practices
@azhao1981
azhao1981 / nginx
Created October 30, 2016 13:48 — forked from alexblom/nginx
Golang Websocket Nginx
#Golang Websocket Server
server {
listen 8080;
server_name wss.morse.io;
access_log /var/log/nginx/access_log.log;
error_log /var/log/nginx/error.log;
#ssl config
ssl on;
#Cert Info
@azhao1981
azhao1981 / map.go
Created October 23, 2016 17:31 — forked from drnic/map.go
Conversion of Ruby Array#map to some Golang equivalents
package main
import "fmt"
/**
* Ruby code below. How to do equivalent in Go?
people = [
{
first: "Nic",
last: "Williams"
@azhao1981
azhao1981 / mgoExample.go
Created October 18, 2016 08:35 — forked from border/mgoExample.go
mgo example
package main
import (
"fmt"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"time"
)
type Person struct {