Skip to content

Instantly share code, notes, and snippets.

Avatar

Sun Wuan s5unty

View GitHub Profile
@s5unty
s5unty / weight.elv
Last active Aug 25, 2022
带权重的超强快码的单字字典
View weight.elv
#!/usr/bin/env elvish
##
# 生成一份带权重的、单字版的超强快码字典
#
# [1]: https://elv.sh/get/
# [2]: (单字字频) https://lingua.mtsu.edu/chinese-computing/statistics/char/list.php?Which=MO
# [3]: (五笔字典) https://github.com/rime/rime-wubi/ (wubi86.dict.yaml)
####
use str
View gist:7cb3a144920ad5f5b852f6041b8d24e7
### Keybase proof
I hereby claim:
* I am s5unty on github.
* I am s5unty (https://keybase.io/s5unty) on keybase.
* I have a public key ASBD3QCGaxQ9fP9I0DDGtw7UPo1S07dr1rfh29oTXsV4hAo
To claim this, I am signing this object:
@s5unty
s5unty / pack.sh
Last active Sep 8, 2020
pack huge directory(billion files) to multiple tar files
View pack.sh
#!/bin/bash
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"
export PACK_ROOT="${PACK_ROOT:-/}"
export PACK_NAME="${PACK_NAME:-$(shuf -zer -n5 {a..z})}"
export PACK_SIZE="${PACK_SIZE:-10000}"
export PACK_JOBS="${PACK_JOBS:-16}"
while [[ "$#" -gt 1 ]]; do
case $1 in
@s5unty
s5unty / scm.conf
Created Jul 23, 2020
日志定期清理
View scm.conf
/home/scm/.logrotate.dummy {
daily
su scm scm
rotate 0
create
ifempty
lastaction
cd /home/scm/instance/
/usr/bin/find . -path "*/logs/*old*" -type f -mtime +90 -delete
/usr/bin/find . -path "*/logs/*log*" -type f -mtime +90 -delete
@s5unty
s5unty / mfs.mtail
Last active May 5, 2020
parse the mfscli output and write the metrics
View mfs.mtail
# usage:
# $ mfscli -np -SIM -SIG | mtail -one_shot -progs mfs.mtail -logs -
# OR
# $ mtail -progs mfs.mtail -logs mfscli.log
# $ mfscli -np -SIM -SIG > mfscli.log
#
# -SIM {{{
text metadata_servers_state by ip, version
gauge metadata_servers_cpu_all by ip, version
@s5unty
s5unty / mfscli2prom.awk
Last active Dec 8, 2022
parse the mfscli output and write the metrics
View mfscli2prom.awk
#!/usr/bin/awk -f
#
# usage:
#
# % /usr/bin/mfscli -ns"#" -SIM -SMU -SIG -SCS -SIC -SSC -SQU | ./mfscli2prom.awk
#
# moosefs >= v3.0.105
#
BEGIN {
@s5unty
s5unty / error.log
Created Dec 5, 2019
sqlite 2 postgresql
View error.log
mmonit=> INSERT INTO messageformat VALUES(
mmonit(> 1,
mmonit(> 'Default',
mmonit(> 'mmonit@verns-worktop',
mmonit(> 'M/Monit report ($HOST: $EVENT $SERVICE on $DATE)',
mmonit(> 'M/Monit report ($COUNT events)',
mmonit(> NULL,
mmonit(> replace('Date: $DATE\nHost: $HOST\nService: $SERVICE\nAction: $ACTION\nDescription: $DESCRIPTION\n\n','\n',char(10)),
mmonit(> replace('\nYour faithful employee,\nM/Monit','\n',char(10)),
mmonit(> replace('<html>\n <table style=''border-collapse:collapse;border:1px solid #eee; padding:5px;''>\n <tr>\n <th style=''border: 1px solid #eee; padding:5px;''><b>Date</b></th>\n <th style=''border: 1px solid #eee; padding:5px;''><b>Host</b></th>\n <th style=''border: 1px solid #eee; padding:5px;''><b>Service</b></th>\n <th style=''border: 1px solid #eee; padding:5px;''><b>Action</b></th>\n <th style=''border: 1px solid #eee; padd
@s5unty
s5unty / ical2rem.pl
Last active Nov 25, 2019
A script to convert from the iCal / ICS format the format used by Remind
View ical2rem.pl
#!/usr/bin/perl -w
my $debug = 0;
#
# ical2rem.pl -
# Reads iCal files and outputs remind-compatible files. Tested ONLY with
# calendar files created by Mozilla Calendar/Sunbird. Use at your own risk.
# Copyright (c) 2005, 2007, Justin B. Alcorn
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@s5unty
s5unty / powerline.bdf
Created Mar 10, 2019
vim-powerline symbols
View powerline.bdf
COMMENT #####################
COMMENT vim-powerline symbols
COMMENT - <U2B60>...<U2B62>
COMMENT - <U2B80>...<U2B83>
COMMENT #####################
STARTCHAR U+2B60
ENCODING 11104
SWIDTH 360 0
DWIDTH 10 0
BBX 10 20 0 -6
View goaccess.conf
# 贴到 $HOME/.goaccessrc
color COLOR_MTRC_HITS color27:color254
color COLOR_MTRC_VISITORS color161:color254
color COLOR_MTRC_DATA color28:color254
color COLOR_MTRC_BW color173:color254
color COLOR_MTRC_AVGTS color240:color254
color COLOR_MTRC_CUMTS color130:color254
color COLOR_MTRC_MAXTS color92:color254
color COLOR_MTRC_PROT color161:color254
color COLOR_MTRC_MTHD color75:color254