275篇 Default中的文章

short names for Kubernetes resources

Most common short names for Kubernetes resources which was used in command kubectl get:

po or pod: Pods
deploy or deployment: Deployments
svc or service: Services
cm or configmap: ConfigMaps
secret: Secrets
pv or persistentvolume: Persistent Volumes
pvc or persistentvolumeclaim: Persistent Volume Claims
sts or statefulset: StatefulSets
job: Jobs
cronjob: CronJobs

More ~

linux process stat meaning

main ps:

Here are the different values that the s, stat and state output specifiers (header "STAT" or "S") will display to describe the state of a process:

D    uninterruptible sleep (usually IO)
I    Idle kernel thread
R    running or runnable (on run queue)
S    interruptible sleep (waiting for an event to complete)
T    stopped by job control signal
t    stopped by debugger during the tracing
W    paging (not valid since the 2.6.xx kernel)
X    dead (should never be seen)
Z    defunct ("zombie") process, terminated but not reaped by its parent

For BSD formats and when the stat keyword is used, additional characters may be displayed:

<    high-priority (not nice to other users)
N    low-priority (nice to other users)
L    has pages locked into memory (for real-time and custom IO)
s    is a session leader
l    is multi-threaded (using CLONE_THREAD, like NPTL pthreads do)
+    is in the foreground process group
More ~

macOS Xcode清理空间

用过Xcode的同学可能遇到过这种情况, 有个CoreSimulator目录 /Users/<name>/Library/Developer/CoreSimulator/Devices非常大, 像我的就已经达到二三十G,对于256G的小硬盘来说太占空间了。

这个原因可能是因为不断升级Xcode版本,有些老的Device已经不用了,但是仍占据空间。

可以使用如下命令快速清理已经不能用的Device:

xcrun simctl delete unavailable
More ~

android上浏览器中过滤广告

浏览器用google play下载三星Internet;

  1. 在三星浏览器里打开
    internet://debug/

  2. 右下角打开设置,点开最下面的“Debug settings”

  3. 点开“Feature variation test”

  4. 修改“Sales code”、“Country code”、“Country iso code”到你想要的区。以港区为例,分别在“Other”里填上“TGY”、“Hong Kong”、“HK”

  5. 重启浏览器

  6. 在浏览器右下脚中打开广告拦截器, 下载ABP : 到google play中下载三星浏览器专用ABP;

  7. 在ABP中更新广告筛选清单,可接受广告选 否,我想禁用可接受广告。完事。

More ~

golang random with range

package main

import (
    "fmt"
    "math/rand"
    "time"
)
        
func main() {
    rand.Seed(time.Now().UnixNano())
    min := 10
    max := 30
    fmt.Println(rand.Intn(max - min + 1) + min)
}

More ~

macos上的启动项管理

守护进程目录

/System/Library/LaunchDaemons/
/Library/LaunchDaemons/

启动项Agent目录

/System/Library/LaunchAgents
/Library/LaunchAgents
~/Library/LaunchAgents
More ~

用firewall-cmd阻止某个IP访问

Question: How tp add a rule using firewall-cmd to drop/reject specific IP connecting to the server? This can be used as an added security on the server.

firewall-cmd is the most common method of managing firewalld configurations (both running as well as permanent). This tool is a part of the firewalld package.

More ~

docker 容器安全与firewalld

docker 容器暴露的端口不会因 firewalld 防火墙策略阻断!

最近发现一个问题,docker run 了几个容器,暴雷了 8080, 9090 等等几个端口,一直以为 CentOS 有 firewalld 防火墙在,加了这些端口只允许内网访问,就可以高枕无忧了。
结果有次查看 netstat,居然有一些国外的 IP 连接。这才知道原来有防火墙,容器也不安全!

More ~