Skip to content

Instantly share code, notes, and snippets.

View tianweidut's full-sized avatar
🎯
Focusing

tianwei tianweidut

🎯
Focusing
View GitHub Profile
# 清除starwhale(执行完,需要稍等几分钟,执行minikube kubectl -- get pods -n starwhale 没有任何输出再进行重新安装)
helm uninstall my-starwhale -n starwhale
# 重新安装starwhale
export SWNAME=starwhale SWNS=starwhale
helm upgrade --install $SWNAME starwhale/starwhale --namespace $SWNS --create-namespace --set minikube.enabled=true --set mysql.primary.persistence.storageClass=$SWNAME-mysql --set minio.persistence.storageClass=$SWNAME-minio --set image.registry=docker-registry.starwhale.cn --set minio.global.imageRegistry=docker-registry.starwhale.cn --set mysql.global.imageRegistry=docker-registry.starwhale.cn
@tianweidut
tianweidut / install-python.sh
Created July 26, 2022 14:26
python install
#!/usr/bin/env bash
set -e
if [[ ! -z ${DEBUG} ]]; then
set -x
fi
ulimit -n 65535 || true
rootdir=/opt/python-workdir
@tianweidut
tianweidut / cloudSettings
Created July 30, 2020 11:47 — forked from yetone/cloudSettings
vscode-settings-public
{"lastUpload":"2020-05-13T10:46:00.823Z","extensionVersion":"v3.4.3"}
@tianweidut
tianweidut / proxy.go
Created February 9, 2020 11:58
golang proxy with unix domain socket
package main
import (
"crypto/tls"
"fmt"
"golang.org/x/net/proxy"
"io/ioutil"
"net"
"net/http"
"os"
@tianweidut
tianweidut / client.go
Created July 5, 2018 06:41
unix domain socket for golang
package main
import (
"net"
"github.com/sirupsen/logrus"
"net/http"
"io/ioutil"
)
func dial(){
@tianweidut
tianweidut / linkerd.yaml
Last active September 15, 2017 11:16
linkerd 1.12 config example
admin:
port: 4400
namers:
- kind: io.l5d.serversets
zkAddrs:
- host: zk1
port: 2181
- host: zk2
port: 2181
@tianweidut
tianweidut / nth_percentile.py
Created April 1, 2016 06:09 — forked from ageron/nth_percentile.py
Explanation of 90th percentile
def nth_percentile(dataset, percentile = 90):
sorted_dataset = sorted(dataset)
new_length = len(sorted_dataset) * percentile / 100
return sorted_dataset[0:new_length]
def mean(dataset):
return sum(dataset)/float(len(dataset))
dataset = [5, 9, 7, 101, 4, 8, 109, 104, 6, 1, 110, 106, 3, 107, 105, 2, 102, 10, 103, 108]
percentile_90 = nth_percentile(dataset)
#coding: utf-8
class Solution(object):
def fullJustify(self, words, maxWidth):
"""
:type words: List[str]
:type maxWidth: int
:rtype: List[str]
@tianweidut
tianweidut / inherit.py
Created November 18, 2015 12:38
python 继承的小例子,使用子类的key
#coding: utf-8
class Base(object):
def __init__(self):
print 'Base __init__'
def update(self):
print 'Base update'
@tianweidut
tianweidut / check_container
Created July 17, 2015 06:31
shell 技巧: 1. exec 一个shell func: export -f func_name; exec bash -c “func_name” 2. 判断命令输出是否为空 if [[ -n $(docker ps -f name=test)]]; 3. 判断命令的返回码是否为0(即是否正确执行exit 0) if docker ps ;
#!/bin/sh
ulimit -n 65536
exec 2>&1
create_container () {
echo 'try to create container'
sudo docker create --name 'gentoo_with_portage' \
-v /usr/portage/ \
-v /var/lib/layman/ \