Skip to content

Instantly share code, notes, and snippets.

@keegoo
keegoo / config.py
Last active December 4, 2023 13:30
This is the code example for blog - An implementation of Config class
import os
import yaml
from mergedeep import merge
from functools import reduce
class Config:
class ValueDesc:
def __init__(self, env_var, type=str, required=True, default=None):

说明

我买的Khadas型号是VIM1S。它的[用户手册][4]在官网产品的购买界面。[这里][5]可以找到自带的OOWOW嵌入式系统的文档。

这里介绍一下安装Kubernetes的过程。

[Specification][3]
SOC [Amlogic S905Y4 SoC][2]
内存 2GB

面试前浏览一遍。。。每项只维持100个

记录下接下来要了解的问题:

  • Pytest如何并行运行测试,pytest-xdist是如何实现的;
  • 由于k8s和redis的基本知识的总结;因为他们太常用到了;使用ps命令时,是否可以看到docker container里面运行的进程;
  • Kibana和watchdog这种log实现的原理是啥,如何保证速度?
  • 服务在cloud中如何被发现。

目录

@keegoo
keegoo / http_proxy_notes.md
Last active August 27, 2022 16:10
记录如何写一个http proxy in Rust的学习笔记

Briefing

在Mac和Linux下感觉没有好用的http capture的工具。

其实需求很简单:可以monitor某个ip,监控其中发生的http的traffice,并实时的在Web UI中显示出来。

用过Windows平台的Fiddler,感觉非常易用。

想用Rust来写,不过之前对于Rust和网络编程都没有什么经验。

macOS Printer

根据wiki的定义,[CUPS][wiki-CUPS] (Common Unix Printing System) 是一个专为类Unix系统开发的模块化打印系统。 它把运行CUPS的本地机器当作一个打印服务器。这个打印服务器接收来自同网络的其他client computers发来的print jobs,然后处理并把jobs发送给打印机。

在处理这些jobs的时候,CUPS会使用最佳的程序(filters, printer driveres, port monitors and backends)来把当前的页面转换成可打印的格式。

打印服务器、client computers和打印机之间的沟通就用到了[IPP][wiki-IPP] (Internet Printing Protocol)协议。根据wiki,协议的内容简单如下:

  • 支持client端(computers, mobile phones, tablets等)向打印机或打印服务器发送print jobs。
  • 查询打印机的状态。
@keegoo
keegoo / notes_locust.md
Created January 27, 2021 03:52
Notes for Locust, a Python load test library

Event Hook example

The original code is from line 7 to 47 in event.py.

class EventHook:
    def __init__(self):
        self._handlers = []
 

shortcuts

j, k, h, l                # - up, down, left and right

w                         # - jump by words(seperated by punctuation)
W                         # - jump by words(seperated by space)
b                         # - jump backward by words(seperated by punctuation)
B                         # - jump backward by words(seperated by space)

puzzle 01

# Description: 
# given a list of integer(no duplicate), find all pairs that add up to a target number
# example: list=[1,3,5,7] target=8, result = 1,7 3,5
# requirement: as fast as possible
require 'set'

def find_pair(ary, sum)
from locust import HttpUser, task, between
import uuid
class User(HttpUser):
wait_time = between(5, 9)
@task
def scenario_01(self):
self.view_computer()
self.create_computer()