Skip to content

Instantly share code, notes, and snippets.

View escoffier's full-sized avatar
🏠
Working from home

robbie escoffier

🏠
Working from home
  • tensorsecurity
  • chengdu
View GitHub Profile
package main
import (
"context"
"fmt"
"os"
"os/signal"
"syscall"
"time"
)

requirements:

install bookinfo application in namespace mesh install httpbin application

kubectl apply -n mesh -f samples/httpbin/httpbin.yaml
kubectl apply -n mesh -f samples/bookinfo/platform/kube/bookinfo.yaml

create headless service for httpbin

@escoffier
escoffier / csr.conf.md
Created July 8, 2022 14:21 — forked from yidas/csr.conf.md
Certificate(CSR) configuration file

Openssl commands:

openssl genrsa -out self-ssl.key
openssl req -new -key self-ssl.key -out self-ssl.csr -config csr.conf
openssl x509 -req -days 365 -in self-ssl.csr -signkey self-ssl.key -out self-ssl.crt -extensions req_ext -extfile csr.conf

Sign from Root CA: openssl x509 -req -days 365 -extensions req_ext -extfile csr.conf -CA RootCA.crt -CAkey RootCA.key -in self-ssl.csr -out self-ssl.crt

@escoffier
escoffier / k8s-code-gen-tags
Created March 2, 2022 10:46 — forked from liangrog/k8s-code-gen-tags
kubernetes code generator tags
// +genclient - generate default client verb functions (create, update, delete, get, list, update, patch, watch and depending on the existence of .Status field in the type the client is generated for also updateStatus).
// +genclient:nonNamespaced - all verb functions are generated without namespace.
// +genclient:onlyVerbs=create,get - only listed verb functions will be generated.
// +genclient:skipVerbs=watch - all default client verb functions will be generated except watch verb.
// +genclient:noStatus - skip generation of updateStatus verb even thought the .Status field exists.
:%s/r//g 删除DOS方式的回车^M
:%s= *$== 删除行尾空白
:%s/^(.*)n1/1$/ 删除重复行
:%s/^.{-}pdf/new.pdf/ 只是删除第一个pdf
:%s/<!--_.{-}-->// 又是删除多行注释(咦?为什么要说「又」呢?)
:g/s*^$/d 删除所有空行 :这个好用有没有人用过还有其他的方法吗?

Best Practices for Azure Redis

Below are a set of best practices that I recommend for most customers. This information is based on my experience helping hundreds of Azure Redis customers investigate various issues.

Configuration and Concepts

  1. Use Standard or Premium Tier for Production systems. The Basic Tier is a single node system with no data replication and no SLA. Also, use at least a C1 cache. C0 caches are really meant for simple dev/test scenarios since they have a shared CPU core, very little memory, are prone to "noisy neighbor", etc.
  2. Remember that Redis is an In-Memory data store. Read this article so that you are aware of scenarios where data loss can occur.
  3. Configure your client library to use a "connect timeout" of at least 10 to 15 seconds, giving the system time to connect even under higher CPU conditions. If your client or server tend to be under high load
@escoffier
escoffier / Dockerfile
Created April 24, 2019 18:04
media dockerfile
FROM ubuntu:16.04
MAINTAINER qunfengqiu
COPY ./CH_HCNetSDK_V5.3.5.2_build20171124_Linux64 /opt/CH_HCNetSDK_V5.3.5.2_build20171124_Linux64
ENV ICEGRID_VERSION 3.7.2
RUN buildDeps=' \
wget \
@escoffier
escoffier / main.cpp
Created April 24, 2019 02:12
class member function pointer
#include <iostream>
#include <functional>
using namespace std;
struct Foo
{
Foo (int num):num_ (num)
{
}
void print_add (int i) const