Skip to content

Instantly share code, notes, and snippets.

View pemre's full-sized avatar

Emre Piskin pemre

View GitHub Profile

NFS (Network File System) kurulumu

Sunucu (server)

  1. Paylasilacak dizini erisime ac: sudo chmod ugo+rwx /run/media/nuc/kirmizi
  2. NFS icin kullanilacak dizini olustur: sudo mkdir -p /srv/nfs/kirmizi
  3. fstab dosyasini ac: sudo xed /etc/fstab
  4. Mount komutunu dosyaya ekle: /run/media/nuc/kirmizi /srv/nfs/kirmizi none bind 0 0
  5. Dizinleri tekrar bagla: sudo mount -a
  6. exports dosyasini ac: sudo xed /etc/exports
// @source answer https://stackoverflow.com/a/27363569/7325594
// @source question https://stackoverflow.com/questions/5202296/add-a-hook-to-all-ajax-requests-on-a-page
(function () {
var origOpen = XMLHttpRequest.prototype.open
XMLHttpRequest.prototype.open = function () {
console.log('request started!')
this.addEventListener('load', function () {
console.log('request completed!')
console.log(this.readyState) // will always be 4 (ajax is completed successfully)
console.log(this.responseText) // whatever the response was

Useful Linux commands

Utility

  • Compress a pdf file: gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
  • Resize a pdf file (e.g. from US letter) to A4: gs -o output.pdf -sDEVICE=pdfwrite -sPAPERSIZE=a4 -dFIXEDMEDIA -dPDFFitPage -dCompatibilityLevel=1.4 input.pdf
  • Show a summary of the running hardware: inxi -Fxz
  • Convert mp4 to gif: ffmpeg -i example.mp4 -r 15 -vf scale=512:-1 -ss 00:00:02 -to 00:00:06 example.gif
  • Split video into smaller chunks: ffmpeg -i *.mp4 -c copy -map 0 -segment_time 00:02:00 -f segment -reset_timestamps 1 output_%03d.mp4
@pemre
pemre / .gitignore
Created July 5, 2018 09:54
My global .gitignore file
# Created by https://www.gitignore.io/api/git,node,linux,phpstorm
# Edited by Emre Piskin <piskin.emre@gmail.com>
### Git ###
*.orig
### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file