Pank: September 2017 Archives

BASH regular expression

user-pic
Vote 0 Votes

e.g. Get http://mirror01.idc.hinet.net/CentOS/ first 7.x dir name

RE=">(7[0-9\.]+)"
[[ `curl -s http://mirror01.idc.hinet.net/CentOS/` =~ $RE ]]
echo ${BASH_REMATCH[1]}

Output:
7.0.1406

Screen reattach a session

user-pic
Vote 0 Votes

Useful when connection drop

screen -Dr
Reattach a session. If necessary detach and logout remotely first.

screen -DR
Attach here and now. In detail this means: If a session is running, then reattach.
If necessary detach and logout remotely first.
If it was not running create it and notify the user. This is the author's favorite.

curl -T to PUT file to PHP

user-pic
Vote 0 Votes

Sender
curl -T file http://host/upload.php

Receiver upload.php code
if ($_SERVER["REQUEST_METHOD"]=="PUT") file_put_contents(date("YmdHis") ,file_get_contents("php://input"));
// date("YmdHis") is output filename

Eanble tftp server in CentOS7

user-pic
Vote 0 Votes

yum -y install tftp-server

Edit /etc/xinetd.d/tftp, add -c if need create (put file in)
server_args = -cs /var/lib/tftpboot

systemctl enable tftp.socket
systemctl start tftp.socket

PS. xinetd is not necessary

set D=%date:/=%
set YMD=%D:~0,8%
echo %YMD%

Example: record desktop for 1 hour
ffmpeg -f gdigrab -framerate 10 -i desktop -t 01:00:00 file.mp4

ref. Download FFmpeg for Windows

About this Archive

This page is an archive of recent entries written by Pank in September 2017.

Pank: May 2017 is the previous archive.

Pank: October 2017 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Monthly Archives