Linux
Elasticsearch
Elasticsearch
Delete Index
curl -XDELETE localhost:9200/[index]?master_timeout=5m
Elasticsearch
allocate unassigned shards
range=2
IFS=$'\n'
for line in $(curl -s 'localhost:9200/_cat/shards' | fgrep UNASSIGNED); do
INDEX=$(echo $line | (awk '{print $1}'))
SHARD=$(echo $line | (awk '{print $2}'))
number=$RANDOM
let "number %= ${range}"
curl -H 'Content-Type:application/json' -XPOST http://localhost:9200/_cluster/reroute? -d '{
"commands" : [ {
"allocate_empty_primary" :
{
"index" : '\"${INDEX}\"',
"shard" : '\"${SHARD}\"',
"node" : "tigger-1",
"accept_data_loss" : true
}
}
]
}'
done
Elasticsearch
Truncate Corrupted Translog of Index
You should run the following command to allocate this shard:
curl -XPOST --header 'Content-Type: application/json' http://localhost:9200/_cluster/reroute -d '
{
"commands" : [
{
"allocate_stale_primary" : {
"index" : "graylog_9",
"shard" : 0,
"node" : "zYNG7nZMRWCNCDlqsDhKkw",
"accept_data_loss" : true
}
}
]
}'
FFMpeg
FFMpeg
add Timestamp to Video
ffmpeg -i <video_in>.mp4 \
-vf "drawtext = fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf: text = '%{pts:gmtime:0:%M\\\\:%S}':\x=80: y=125: fontsize=48: fontcolor=white@1.0: box=1: boxcolor=black@1.0" \
<video_out>.mp4
FFMpeg
convert all files of type in directory
for i in *.ts; do ffmpeg -i "${i}" -c:v libx264 -c:a copy -c:s mov_text "${i%%.*}.mp4"; done
FFMpeg
Find video Codec of Video
ffprobe -select_streams v0 -show_entries "format:stream" \
-of json -v quiet \
-i ./path/to/videofile.extension \
| grep -w "format_name" | cut -d "\"" -f4
mpegts
OpenSSH
OpenSSH
compile from source
./configure --exec-prefix=/usr/ --bindir=/bin/ --sbindir=/sbin/ --prefix=/ --datarootdir=/usr/share/ --with-pam --with-privsep-user=nobody --with-md5-passwords