Skip to content

Instantly share code, notes, and snippets.

View chanjarster's full-sized avatar
🎯
Focusing

Daniel Qian chanjarster

🎯
Focusing
  • Shanghai, China
View GitHub Profile
@chanjarster
chanjarster / daye.go
Created August 3, 2020 05:58
极客时间大爷胡同口优化
// https://time.geekbang.org/column/article/126504
// 张大爷在胡同口等着 ...
// 碰见一个李大爷:127.0.0.1:59668
// 耗时: 40.354851ms
package main
import (
"bytes"
"encoding/binary"
@chanjarster
chanjarster / demo.log
Last active February 19, 2020 03:59
servicecomb-java-chassis release check issue
##################################
# cd demo
# mvn clean install -Pdocker -Pstaging
##################################
[ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.20.0:start (start) on project pojo-client: Execution start of goal io.fabric8:docker-maven-plugin:0.20.0:start failed: Start-Job failed with unexpected exception: [pojo-server:2.0.0] "pojo-server": Timeout after 120669 ms while waiting on log out 'Register microservice instance success' and on tcp port '[/172.17.0.4:8080]' -> [Help 1]
##################################
# pojo-server:2.0.0 container log
##################################
@chanjarster
chanjarster / style-check-rules.properties
Last active November 19, 2019 09:00
oas validator style check rules
# OpenAPI Object
openAPI.openapi.gte=3.0.2
openAPI.tags.size.gte=1
openAPI.security.size.eq=0
# Info Object
info.description.required=true
# Tag Object
tag.name.case=upper-camel-case
@chanjarster
chanjarster / init-tiller-sa.sh
Created October 11, 2019 06:43
Initialize Tiller Service Account For Each Namespace
#!/bin/bash
if [ -z "$1" ]; then
echo 'usage: init-tiller-sa.sh <namespace>'
exit 1
fi
namespace=$1
cat <<EOF | kubectl apply -f -
@chanjarster
chanjarster / iphone-sms-xml.php
Created October 4, 2019 06:40
Convert Iphone sms db to xml file
#!/usr/bin/php5
<?php
if (count($argv) <> 2) {
print "Usage: ".$argv[0]." iPhone-SMS-DB (Usually 3d0d7e5fb2ce288813306e4d4636395e047a3d28.*)\n";
exit -1;
}
$DBfile = $argv[1];
@chanjarster
chanjarster / ConsolePrint.java
Created February 22, 2019 05:20
Test stdout performance
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
public class ConsolePrint {
private static String line1 = "[stdout] very very long line very very long line very very long line very very long line very very long line very very long line very very long line very very long line";
private static String line2 = "[file] very very long line very very long line very very long line very very long line very very long line very very long line very very long line very very long line\n";
private static String line3 = "[/dev/stdout] very very long line very very long line very very long line very very long line very very long line very very long line very very long line very very long line\n";
@chanjarster
chanjarster / ConsolePrint.java
Created February 21, 2019 07:55
Writing to stdout vs writing to file
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
public class ConsolePrint {
private static String line = "very very long line very very long line very very long line very very long line very very long line very very long line very very long line very very long line";
public static void main(String[] args) throws IOException {
@chanjarster
chanjarster / docker-stack.yml
Last active February 1, 2019 03:22
Docker prometheus stack
version: '3.7'
# 基于 https://github.com/vegasbrianc/prometheus/ 修改
# Prometheus:http://<任意swarm node ip>:9000
# Node-exporter:http://<任意swarm node ip>:9010
# Alertmanager:http://<任意swarm node ip>:9020
# cAdvisor:http://<任意swarm node ip>:9030
# Grafana:http://<任意swarm node ip>:9040,用户名admin,密码foobar
x-logging:
@chanjarster
chanjarster / scrape-data.txt
Created December 28, 2018 06:49
Prometheus mock data
# HELP x fake metric
# TYPE x gauge
x 1
---
# HELP x fake metric
# TYPE x gauge
x 2
---
# HELP x fake metric
# TYPE x gauge
@chanjarster
chanjarster / Jenkinsfile
Created November 28, 2018 08:56
Maven+Docker的Jenkins pipeline
pipeline {
agent any
triggers {
pollSCM '*/5 * * * *'
}
options {
// 禁止因Multibranch pipeline index动作触发构建
overrideIndexTriggers false