Skip to content

Instantly share code, notes, and snippets.

@zxt5105515
zxt5105515 / checkDiskSpace.sh
Created August 3, 2023 06:14
get disk free space in gigabytes
diskFree=`df -g / |sed -n '2p'|awk '{print $4}'`
echo "diskFree :$diskFree"
if ((diskFree<5)); then
echo "warning, disk is less then 5GB! please check your disk!"
fi
@zxt5105515
zxt5105515 / protobufjs_enum_convert.js
Created February 23, 2023 08:48
protobufjs enum to string ,string to enum
const ProtoBuf = require('protobufjs');
//create proto root
const myProtoRoot = new ProtoBuf.Root()
//load proto file
/*
one of the proto file
enum Test_Enum
@zxt5105515
zxt5105515 / check_dist.sh
Created July 20, 2021 06:45
get remain dist space in macos
#!/bin/bash
usedDisk=`df -H |sed -n '2p'|awk '{print $5}'|cut -f 1 -d '%'`
if ((usedDisk>97)); then
echo "disk used is $usedDisk"
fi