Rabu, 28 Oktober 2020
Label:
text-tools,
tools
Selasa, 27 Oktober 2020
# File access permission
<Files .htaccess>
order allow,deny
deny from all
</Files>
# Redirect
Redirect /path/to/web/file.html /path/to/web/target/file.html
Minggu, 20 September 2020
# If you want only the remote URL, or referential integrity has been broken:
git config --get remote.origin.url
# If you require full output or referential integrity is intact:
git remote show origin
# Set url
git remote set-url origin new.git.url/here
#/usr/bin/bash
pwd
# output:
# /home/user
ls
# output:
# repo_1.git
# repo_2.git
# repo_3.git
# single line below "for i in `ls`; do cd $i && git init --bare && cd ../; done;"
for i in `ls`
do
cd $i && git init --bare && cd ../;
done
# output:
# Initialized empty Git repository in /home/user/repo_1.git
# Initialized empty Git repository in /home/user/repo_2.git
# Initialized empty Git repository in /home/user/repo_3.git
Minggu, 13 September 2020
#!/usr/bin/node
module.paths.push('/usr/lib/node_modules');
Minggu, 06 September 2020
MP4 to Webm
ffmpeg -i video.mp4 -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis video.webm
MP4 to Webm
ffmpeg -i input.mp4 -c:v libtheora -q:v 7 -c:a libvorbis -q:a 4 output.ogv
MP4 to MP3
ffmpeg -i input.mp4 output.mp3
MKV to MP3
ffmpeg -i input.mkv -vn -c:a libmp3lame -y output.mp3
MOV to MP4 (Compressed)
ffmpeg -i my-video.mov -vcodec h264 -acodec mp2 my-video.mp4
Sabtu, 14 Maret 2020
Filter by response code:
#!/usr/bin/node
module.paths.push('/usr/lib/node_modules');
const fs = require('fs');
var data = {};
var params = process.argv[2];
function read(config={}){
fs.readFile(params,'utf8',function(err,data){
if(err) throw err;
data = JSON.parse(data).log.entries;
if(config.by.length>0){
if(config.by[0]=='status'){
data = data.filter(function(v){return v.response.status==config.by[1]}).map(function(v){return v.request.url});
}
};
if(config.save){
save()
}else{
console.log(data)
}
})
};
function save(){
fs.writeFile(params.replace(/(\.har)$/,"-output$1"),JSON.stringify(data),function(err){if(err) throw err})
};
read({
save:false,
by:['status',404]
})
Selasa, 10 Maret 2020
Separate string by character length
"This is String".replace(/(.{4})/,"$1\n")
Result:
This is Stri ng