Skip to content

Instantly share code, notes, and snippets.

View pemre's full-sized avatar

Emre Piskin pemre

View GitHub Profile
@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 <[email protected]>
### Git ###
*.orig
### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file

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
// @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

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
@pemre
pemre / how to backup manjaro.md
Last active November 7, 2022 23:02
Instructions to backup/restore my Manjaro Linux setup. Also contains my adblock filters, radios, Firefox extensions.
@pemre
pemre / batch-download-yt-dlp.sh
Last active May 12, 2024 08:03
Download a list of URLs with custom name using yt-dlp (formerly youtube-dl)
#!/bin/bash
# Title : batch-download-yt-dlp.sh
# Description : Download a list of URLs with custom name using yt-dlp (formerly youtube-dl)
# Author : Emre
# Date : 2021.09.26 - 2024.05.12
# Version : 1.0 - 1.1
# Based on : https://github.com/pemre/mazi/blob/master/batch-downloader-with-custom-name.sh
# Example "urls.txt":
@pemre
pemre / leyla-ile-mecnun-dizisi-bolum-ozetleri.txt
Created September 26, 2021 17:16
Leyla ile Mecnun dizisinin TRT İzle sitesindeki tek satirlik bolum ozetleri... Her bir satir bir bolum...
Aileleri tarafından beşik kertmesi yapılan bebekler, isimlerini efsane aşıklar Leyla ve Mecnun'dan alır.
Mecnun, Leyla'yı kazanmak için her şeyi yapmaya hazırdır.
Metin, kızının işlerine burnunu sokmaya çalışır, fakat Mecnun'u kandırmak kolay olmaz.
Mecnun tam Leyla'nın güvenini kazanacakken, ortalık fena karışır.
Mecnun'nun yeni kişiliğine alışamayan Leyla, akıl almak için Aksakallı Dede'ye gider.
Mecnun'un dünyasını altüst edecek olan olay ne?
Aksakallı Dede, Mecnun'a bir dizi rüya aracılığıyla rehberlik eder.
Mecnun, Leyla'nın hafızasını geri kazanması için her şeyi dener.
Mecnun ve Leyla'nın ilişkisi yeni bir boyuta taşınır.
Leyla ile Mecnun mutluluk sarhoşudur.
@pemre
pemre / leyla-ile-mecnun-dizisi-indirme-linkleri.txt
Last active October 3, 2021 15:56
Leyla ile Mecnun dizisinin TRT İzle sitesindeki URLleri. Bir bash dosyasi yardimiyla indirilebilir: https://gist.github.com/pemre/c080f6bc94a5c7b949d420cd63100857 Yalnizca 33. bolum (S02E13.mp4) eksik cunku sitede de yanlislikla 32. bolum linki konulmus. Dorduncu sezon 720p.
S01E01.mp4 https://cdn-v.pr.trt.com.tr/trttv/website/cdb5a44a-0e07-4a6d-b733-b2d8fd7222ac/master.m3u8
S01E02.mp4 https://cdn-v.pr.trt.com.tr/trttv/website/7107ffc0-6a58-4b22-aaea-bacd24571b2e/master.m3u8
S01E03.mp4 https://cdn-v.pr.trt.com.tr/trttv/website/81d600d7-d450-4530-8cbd-3969b2db6fc9/master.m3u8
S01E04.mp4 https://cdn-v.pr.trt.com.tr/trttv/website/21b5421e-28d3-4d57-a72b-49a1df841f4c/master.m3u8
S01E05.mp4 https://cdn-v.pr.trt.com.tr/trttv/website/452e1a33-1454-4065-9744-637778f13056/master.m3u8
S01E06.mp4 https://cdn-v.pr.trt.com.tr/trttv/website/1c27ca83-06f2-42b2-bef9-e87faddd521d/master.m3u8
S01E07.mp4 https://cdn-v.pr.trt.com.tr/trttv/website/7491cb69-0dfa-4a0a-a714-fff326f843e3/master.m3u8
S01E08.mp4 https://cdn-v.pr.trt.com.tr/trttv/website/d5d057fb-61ce-47c6-abbc-5439113a3ad4/master.m3u8
S01E09.mp4 https://cdn-v.pr.trt.com.tr/trttv/website/323c43ea-558c-4e6b-9e29-a39498e8ae1d/master.m3u8
S01E10.mp4 https://cdn-v.pr.trt.com.tr/trttv/website/33b1db09-512e-4b36-a937-42485db1373d/master.m3u8
// TODO You may put them under an npm package one day...
// --------------------------------------------------
const fs = require('fs');
const deleteFile = (filename) => {
try {
fs.unlinkSync(filename);
} catch (err) {

How to convert mkv from VOB or ISO files

From ISO

ffmpeg -fflags +genpts -i *.iso -acodec copy -vcodec copy out.mkv

From VOB