Skip to content

Instantly share code, notes, and snippets.

I may be slow to respond.

Darkness navono

I may be slow to respond.
Block or report user

Report or block navono

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
navono / drawCurve.js
Created Aug 14, 2018
draw a custom control points curve in canvas
View drawCurve.js
function drawCurve(points, tension) {
var ctx = layer.getContext()._context;
ctx.moveTo(points[0].x, points[0].y);
var t = (tension != null) ? tension : 1;
for (var i = 0; i < points.length - 1; i++) {
var p0 = (i > 0) ? points[i - 1] : points[0];
var p1 = points[i];
var p2 = points[i + 1];
navono / git log statistics
Last active Aug 22, 2018
用来统计git log中的每个人的 【新增】【删除】【总行数】信息
View git log statistics
git log --author="navono" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }' -
navono / Dockerfile
Last active Sep 7, 2018
Dockerfile for golang
View Dockerfile
FROM golang:1.11 AS builder
# Download and install the latest release of dep
ADD /usr/bin/dep
RUN chmod +x /usr/bin/dep
# Copy the code from the host and compile it
COPY Gopkg.toml Gopkg.lock ./
RUN dep ensure --vendor-only
navono / pathSector.js
Last active Sep 13, 2018
使用坐标,获取扇形(Sector)的Path data(起始点、结束点、半径、开启角度、结束角度)
View pathSector.js
function describeArc(x, y, radius, startAngle, endAngle) {
var start = polarToCartesian(x, y, radius, endAngle);
var end = polarToCartesian(x, y, radius, startAngle);
console.log('start: ', start);
console.log('end: ', end);
var largeArcFlag = Math.abs(endAngle - startAngle) <= 180 ? "0" : "1";
const clockwise = endAngle < 0 ? 1 : 0;
navono /
Created Sep 18, 2018 — forked from osowski/
Install Minikube, Kubectl, and Virtualbox on Ubuntu
#Installing VirtualBox
echo "Installing VirtualBox........................"
sudo apt-get install virtualbox
#Installing kubectl
echo "Installing kubectl..........................."
chmod +x kubectl
sudo mv kubectl /usr/local/bin/kubectl
navono / react-resizable.d.ts
Created Sep 28, 2018
A demo declaration file of react-resizable
View react-resizable.d.ts
declare module 'react-resizable' {
import * as React from 'react';
type Axis = 'both' | 'x' | 'y' | 'none';
type ResizeCallbackData = {
node: HTMLElement,
size: {width: number, height: number}
interface IResizableProps {
navono / parsePathData.js
Created Nov 16, 2018
Canvas path render with pathdata
View parsePathData.js
define(function (require) {
// come from
function getLineLength(x1, y1, x2, y2) {
return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
function getPointOnCubicBezier(
navono / jsonParser.bat
Last active Dec 3, 2019
parse JSON file by windows batch
View jsonParser.bat
:: Read file "package.json" into variable string, removing line breaks.
set string=
for /f "delims=" %%x in (package.json) do set "string=!string!%%x"
rem Remove quotes
set string=%string:"=%
rem Remove braces
set "string=%string:~2,-2%"
rem Change colon+space by equal-sign
set "string=%string:: ==%"
navono /
Created Dec 10, 2018
Install proto in ubuntu
# Make sure you grab the latest version
curl -OL
# Unzip
unzip -d protoc3
# Move protoc to /usr/local/bin/
sudo mv protoc3/bin/* /usr/local/bin/
# Move protoc3/include to /usr/local/include/
View gist:1b97f623087184bbdea279478d791488
  • What do Etcd, Consul, and Zookeeper do?
    • Service Registration:
      • Host, port number, and sometimes authentication credentials, protocols, versions numbers, and/or environment details.
    • Service Discovery:
      • Ability for client application to query the central registry to learn of service location.
    • Consistent and durable general-purpose K/V store across distributed system.
      • Some solutions support this better than others.
      • Based on Paxos or some derivative (i.e. Raft) algorithm to quickly converge to a consistent state.
      • Centralized locking can be based on this K/V store.
You can’t perform that action at this time.