Skip to content

Instantly share code, notes, and snippets.

Avatar
😁

An0nymous An0nymous0

😁
View GitHub Profile
@An0nymous0
An0nymous0 / base62.java
Created May 22, 2019
[short url] #java #sort url
View base62.java
package nice.shorturl.utils;
import com.google.common.base.Charsets;
import com.google.common.hash.Hashing;
public class ShortUrlGenerator {
private static final String ALPHABET = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
private static final int BASE = ALPHABET.length();
public static String encode(int num) {
@An0nymous0
An0nymous0 / RetrofitApiSingleton.java
Created Apr 26, 2019
[RetrofitApiSingleton] #Retrofit #okhttp #Singleton #DesignPattern
View RetrofitApiSingleton.java
public class RetrofitApiSingleton {
private RetrofitApiSingleton() {
}
public static Retrofit getServiceMesh2ApiInstance() {
return ServiceMesh2ApiEnum.INSTANCE.getInstance();
}
@Getter
@An0nymous0
An0nymous0 / GlobalExceptionHandler.java
Created Apr 24, 2019
[Spring RestFul GlobalExceptionHandler] Spring全局异常处理 #java #spring #common
View GlobalExceptionHandler.java
package com.demo.servicemesh1.config;
import com.demo.servicemesh1.common.ResponseMessage;
import lombok.extern.log4j.Log4j2;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
@An0nymous0
An0nymous0 / ResponseMessage.java
Last active Apr 24, 2019
[JAVA RestFul Response] java返回工具类 #java #util #common
View ResponseMessage.java
package com.demo.servicemesh1.common;
import com.alibaba.fastjson.JSON;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.util.*;
public class ResponseMessage<T> implements Serializable {
private static final long serialVersionUID = 8992436576262574064L;
View elasticsearch-新增字段
POST productindex/product/_mapping?pretty
{
"product": {
"properties": {
"saleType":{
"type":"integer"
}
}
}
}
View docker-k8s-pull-china
#!/bin/bash
images=(kube-apiserver:v1.13.1 kube-controller-manager:v1.13.1 kube-scheduler:v1.13.1 kube-proxy:v1.13.1 pause:3.1 etcd:3.2.24 coredns:1.2.6)
for imageName in ${images[@]} ; do
docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/$imageName
docker tag registry.cn-hangzhou.aliyuncs.com/google_containers/$imageName k8s.gcr.io/$imageName
docker rmi registry.cn-hangzhou.aliyuncs.com/google_containers/$imageName
done
View gist:8b399d436b6d1132dc0cf9bc28c24d18
images=$(cat <<EOF
k8s.gcr.io/kube-apiserver:v1.13.0
k8s.gcr.io/kube-controller-manager:v1.13.0
k8s.gcr.io/kube-scheduler:v1.13.0
k8s.gcr.io/kube-proxy:v1.13.0
k8s.gcr.io/pause:3.1
k8s.gcr.io/etcd:3.2.24
k8s.gcr.io/coredns:1.2.6
EOF
)
View kubernetes-dashboard.yaml
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
View cloud-config.yaml
#cloud-config
hostname: coreos1
coreos:
etcd:
addr: $private_ipv4:4001
peer-addr: $private_ipv4:7001
units:
- name: etcd.service
View cloud-config.yaml
#cloud-config
hostname: coreos1
coreos:
etcd:
addr: $private_ipv4:4001
peer-addr: $private_ipv4:7001
units:
- name: etcd.service
You can’t perform that action at this time.