This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# === Optimized my.cnf configuration for MySQL/MariaSQL (on Ubuntu, CentOS etc. servers) === | |
# | |
# by Fotis Evangelou, developer of Engintron (engintron.com) | |
# | |
# ~ Updated February 2021 ~ | |
# | |
# | |
# The settings provided below are a starting point for a 8-16 GB RAM server with 4-8 CPU cores. | |
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage. | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# sync src to git repository. | |
# src is file | |
src=$1 | |
# dest is dir | |
dest=$2 | |
cp $src $dest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# run command: hdfs dfs -ls /cdn-logs/<pvdName>/raw/*/*/*|awk -f ./clean.awk | |
BEGIN{ | |
# file expiration date | |
remaining = 25 * 24 * 3600 | |
} | |
{ | |
# $8 is filepath, get datetime from filepath |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# clean the same relative path in echo disk. the disk name like /disk/sata01, /disk/sata02 | |
for i in {1..12};do | |
if [ $i -lt 10 ]; then | |
i=0$i | |
fi | |
rm -rf /disk/sata$i/<filepath> | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# delete images that contains none. | |
docker images|grep none|awk '{print $3}'|xargs -n1 -I{} docker rmi {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM golang:1.6 as builder | |
RUN mkdir -p /home/filex | |
RUN mkdir -p /disk/ssd1 | |
WORKDIR /home/filex | |
ARG project | |
COPY ./filex/$project . | |
FROM builder as job | |
# 注意,如果 stage 中想要使用 ARG 需要重新在此重新定义 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void toUpyunLog2() throws Exception { | |
InputStream in = getClass().getResourceAsStream("/aliyun-3"); | |
BufferedReader in2 = new BufferedReader(new InputStreamReader(in)); | |
String lineTxt; | |
// System.getProperty("user.home") 获取用户主目录 | |
File file = new File(System.getProperty("user.home") + "/aliyun-3-wanted"); | |
// 文件不存在则创建 | |
file.createNewFile(); | |
FileWriter fw = new FileWriter(file); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func Difference(a, b []string) []string { | |
res := make([]string, 0) | |
for _, aItem := range a { | |
var same bool | |
for _, bItem := range b { | |
if aItem == bItem { | |
same = true | |
break | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.flink.api.java.io.TextOutputFormat; | |
import org.apache.flink.core.fs.Path; | |
import java.io.IOException; | |
public class GZIPOutputFormat<T> extends TextOutputFormat<T> { | |
public GZIPOutputFormat(Path outputPath) { | |
super(outputPath); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dataUnitPattern, _ = regexp.Compile(`(\d+)\s*([a-zA-Z]+)`) | |
func ParseDataStorage(s string) (int64, error) { | |
all := dataUnitPattern.FindAllStringSubmatch(s, -1) | |
if len(all) != 1 || len(all[0]) != 3 { | |
return 0, fmt.Errorf("invalid %s", s) | |
} | |
d, u := all[0][1], all[0][2] | |
num, err := strconv.ParseInt(d, 10, 32) | |
if err != nil { |