Skip to content

Instantly share code, notes, and snippets.

go mod edit -module {NEW_MODULE_NAME}
-- rename all imported module
find . -type f -name '*.go' \
-exec sed -i -e 's,{OLD_MODULE},{NEW_MODULE},g' {} \;
@ydp
ydp / dynamic-create-update-delete-deployment.go
Created July 21, 2022 00:49
test readyReplicas in unstructured object with client-go
/*
Copyright 2019 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,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and

Beginner

Introductory, no previous programming experience

  1. Programming: Principles and Practice Using C++ (Bjarne Stroustrup) (updated for C++11/C++14) An introduction to programming using C++ by the creator of the language. A good read, that assumes no previous programming experience, but is not only for beginners.

Introductory, with previous programming experience

  1. C++ Primer * (Stanley Lippman, Josée Lajoie, and Barbara E. Moo) (updated for C++11) Coming at 1k pages, this is a very thorough introduction into C++ that covers just about everything in the language in a very accessible format and in great detail. The fifth edition (released August 16, 2012) covers C++11. [Review]
@ydp
ydp / custom_estimator.py
Created June 12, 2018 08:40
tensorflow custom DNN estimator support serving default signature
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# 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,
@ydp
ydp / grpc_source_activate.sh
Created June 11, 2018 10:23
grpc cpp cannot find pkg_config
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export PATH=$PATH:$DIR/bins/opt:$DIR/bins/opt/protobuf
export CPATH=$DIR/include:$DIR/third_party/protobuf/src
export LIBRARY_PATH=$DIR/libs/opt:$DIR/libs/opt/protobuf
export PKG_CONFIG_PATH=$DIR/libs/opt/pkgconfig:$DIR/third_party/protobuf
export LD_LIBRARY_PATH=$DIR/libs/opt
@ydp
ydp / create_namspace_and_serviceaccount.sh
Created April 23, 2018 09:18
创建k8s的namespace和sa,并分配给单独的pod权限
#!/bin/bash
ns=$1
sa=$ns
API_SERVER="https://10.87.52.188:6443"
kubectl create ns $ns
kubectl -n $ns create sa $sa
SECRET=$(kubectl -n $ns get sa $sa -o go-template='{{range .secrets}}{{.name}}{{end}}')
@ydp
ydp / InstallingAgOnCentOS.md
Last active April 11, 2018 05:19 — forked from rkaneko/InstallingAgOnCentOS.md
Installing ag: the silver searcher on CentOS.

Installing ag on CentOS

Prerequistes

  • libpcre
  • liblzma

Download, build and install

@ydp
ydp / latency.txt
Created April 3, 2018 10:27 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@ydp
ydp / TENSORFLOW_DEBUG.md
Created April 3, 2018 10:05 — forked from Mistobaan/TENSORFLOW_DEBUG.md
Tensorflow Internals Debugging Techniques

Machine Setup August 2016

Linux Ubuntu 2016.

  • 1080 GTX
  • SDK 8.0
  • CuDNN 5.1

ENABLE Core dumps

ulimit -c unlimited
@ydp
ydp / dockertags.sh
Created March 26, 2018 02:30
list tags for image in docker hub
#!/bin/bash
if [ $# -lt 1 ]
then
cat << HELP
dockertags -- list all tags for a Docker image on a remote registry.
EXAMPLE:
- list all tags for ubuntu: