Skip to content

Instantly share code, notes, and snippets.

Avatar
🐌
Focus

soolaugust soolaugust

🐌
Focus
View GitHub Profile
@soolaugust
soolaugust / md5.go
Created Jul 23, 2021
get self md5 in Golang
View md5.go
// GetSelfMD5 get md5 of current program
func GetSelfMD5() string {
path, e := exec.LookPath(os.Args[0])
if e != nil {
log.Println(`Self md5sum error: look path fail:`, e)
return ""
}
bs, e := ioutil.ReadFile(path)
if e != nil {
log.Println(`SelfMd5sum error: read file fail:`, e)
@soolaugust
soolaugust / 📊 Weekly development breakdown
Last active Oct 29, 2020
📊 Weekly development breakdown
View 📊 Weekly development breakdown
Still Gathering Statistics...
View RestartApp.java
public class RestartApp {
public static void restartApp(Context context) {
Intent intent = new Intent(context, SplashActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
android.os.Process.killProcess(android.os.Process.myPid());
}
}
@soolaugust
soolaugust / AppStatus.java
Last active Jan 10, 2022
Android fix app crash when kill by system in background; Android项目长时间在后台运行后,再次打开程序崩溃问题完美解决(APP在后台被系统回收后,如何重新启动)
View AppStatus.java
public class AppStatus {
public static final int STATUS_RECYCLE =-1; //被回收
public static final int STATUS_NORMAL=1; //正常
}
@soolaugust
soolaugust / TimeUtils.java
Created May 29, 2020
get current timestamp with timezone, 获取当前时区的时间戳。
View TimeUtils.java
public class TimeUtils {
public static long getCurrentTimeWithTimeZone(){
java.util.Calendar cal = java.util.Calendar.getInstance();
return cal.getTimeInMillis() + cal.getTimeZone().getRawOffset();
}
}
@soolaugust
soolaugust / index.md
Created Apr 14, 2020
User "system:serviceaccount:kube-system:default" cannot get resource "namespaces" in API group "" in the namespace "default"
View index.md

see: helm/helm#3130

helm init --upgrade --service-account tiller

or

kubectl --namespace kube-system create serviceaccount tiller
@soolaugust
soolaugust / k8s-notebook.md
Last active Sep 11, 2019
document for problem & solution of k8s
View k8s-notebook.md

Kubernetes use apparmor file error

reference

The annotation should go on the template, since you want it to end up on the pod object:

spec:
  template: 

> metadata:

@soolaugust
soolaugust / proxy-with-k8s.md
Created Jan 8, 2019
docker, k8s上配置代理
View proxy-with-k8s.md

Refer to: HTTP/HTTPS proxy

有时我们需要在服务器上配置代理才能访问google的官方镜像,网上找了很多,不是太麻烦就是不清晰。其实很简单,配置一下docker的代理就可以了。

参考上面的链接,然后将地址配成自己使用可以访问google的客户端地址,比如使用shadowsocks的windows电脑,IP为xx.xx.xx.xx,则可以配置成下面的

[Service]
Environment="HTTP_PROXY=http://xx.xx.xx.xx:1080/" "HTTPS_PROXY=https://xx.xx.xx.xx:1080/"
View how-to-deploy-kubeflow.md

Refer to: Getting Started with Kubeflow

Pre-requires: k8s cluster

mkdir kubeflow
cd kubeflow/
export KUBEFLOW_TAG=v0.3.5
curl https://raw.githubusercontent.com/kubeflow/kubeflow/${KUBEFLOW_TAG}/scripts/download.sh | bash
@soolaugust
soolaugust / tensorflow_note.md
Last active Dec 3, 2017
take notes for studying tensorflow
View tensorflow_note.md

Recommand: Cuda 8.0, cudnn 6.0

1. why cannot I use tensorboard?

  • before start tensorboard, make sure add following codes:

file_writer = tf.summary.FileWriter('log_path', sess.graph)

  • then start tensorboadrd:

tensorboard --logdir log_path

  • when you see a promote site, copy it and open in browser.