Books/PDF/Vector images manipulations
manipulation-pdfgs file.pdf # show pdf file
pdftk 1.pdf 2.pdf 3.pdf cat output out.pdf # preserves bookmarks
gs -sDEVICE=pdfwrite -dColorConversionStrategy=/LeaveColorUnchanged -dDownsampleMonoImages=false -dDownsampleGrayImages=false -dDownsampleColorImages=false -dAutoFilterColorImages=false -dAutoFilterGrayImages=false -dColorImageFilter=/FlateEncode -dGrayImageFilter=/FlateEncode -o out.pdf in.pdf
gs -sDEVICE=pdfwrite -o merged.pdf in1.pdf in2.pdf # does not preserve bookmarks
gs -sDEVICE=pdfwrite -dNoOutputFonts -o out.pdf in.pdf # text to path
rsvg-convert -f pdf -o file.pdf file.svg
cpdf -twoup in.pdf -o out.pdf # merges 2 pages into one
qpdf --pages . 2-z -- in.pdf out.pdf # remove page 1
qpdf --pages in.pdf 2-z -- --empty out.pdf # remove page 1 and discards metadata
pdftk a.pdf dump_data > info.txt pdftk out.pdf update_info info.txt output final.pdf
pdftk A=a.pdf B=b.pdf cat A1-[N] B A[N+1]-end output out.pdf
eval `/Applications/DjView.app/Contents/setpath.sh` djvused -e print-outline book.djvu > toc.txt djvused -e 'set-outline toc.txt' book.djvu
scantailor
pdfimages -j -jp2 in.pdf out
for x in *.jpg; do c44 -dpi 300 $x; done; djvm -c out.djvu *.djvu # convert & merge greyscale images to djvu
Audio/Video
audio-videoffmpeg -i videoplayback.mp4 -i audio.mp4 -c copy -map 0:0 -map 1:0 -shortest output.mp4
youtube-dl --extract-audio --audio-format flac https://www.youtube.com/watch?v=
cd ~/Downloads/ && scdl -l https://soundcloud.com/[user]/[track]
ffmpeg -framerate 24 -f image2 -s 1280x700 -start_number 80 -i pic%05d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p output.mp4
ffmpeg -i input.ts -acodec copy -vcodec copy out.mp4 # re-warp video flux (broken container)
ffmpeg -i video.mp4 -vcodec copy -acodec copy -t 00:42:42 video.a.mp4 -vcodec copy -acodec copy -ss 00:42:42 video.b.mp4 # split video in two
echo "file 'video1.a.mp4'" >> vidlist.txt && echo "file 'video2.b.mp4'" >> vidlist.txt && ffmpeg -f concat -i vidlist.txt -c copy output1.mp4 && rm vidlist.txt # concatenate videos with same codec
Sysadmin
sysadminlsof -i
sync && echo 3 > /proc/sys/vm/drop_caches
df -h
du -hd 2 [folder]
sudo journalctl -f # <- "follow" (realtime)
sudo journalctl -f _COMM=smtpd
journalctl --vacuum-time=1h
sudo find / -nogroup -nouser
WINEARCH=win32 wine wineboot && winetricks dotnet462
wine program.exe
pacman -Syu --ignore=miniupnpc --ignore=nodejs --ignore=npm
sudo pacman -Rns $(pacman -Qtdq) # apt-get autoremove equivalent for arch
certbot certonly --manual -d '*.xif.fr'
iptables -A INPUT -s xxx.xxx.xxx.xxx -j DROP # ban ip (-D pour deban)
Shell/Files
shellstty sane
alias ls='ls --color=auto' && alias ll='ls -Al'
find . -name ._* -exec rm -v {} \;
wilcards : `ls *.???`
Bash et les raccourcis clavier
https://linuxfr.org/users/postroutine/journaux/bash-et-les-raccourcis-claviergrep -RF "the string to search" .
touch -m -a -t [YYYYMMDDhhmm.ss] [file]
Better than 'which' : command -v [command name]
Dev
devsudo dtruss
otool -L executable
nm --demangle --defined-only --dynamic libfoo.so
PYTHONDONTWRITEBYTECODE=0 jupyter notebook notebook.ipynb --NotebookApp.token=
python3 -m cProfile -o program.prof my_program.py && snakeviz program.prof
pip3 install --user --editable path/to/library
git rebase --interactive HEAD~2
git archive --format=zip HEAD -o ../[name].zip
zip -r catlist catlist -x *.git*
install_name_tool -change /usr/local/lib/libblah.0.dylib @rpath/libblah.dylib monsuperprogramme
Network
networkIncoming SSH tunnels
http://wiki.xif.fr/xifnet/procedures/ssh_tunnelioslaves-master xif nashorn -C --open-port=T8081 ssh -f -N -T -R8081:localhost:8080 sshtun@nashorn.net.xif.fr -o IdentityFile=~/.ssh/sshtun -p 2222
Outgoing SSH tunnel : ssh -ND 3128 xif@nashorn.net.xif.fr -p 2222 -4 -o CheckHostIP=no -o IdentityFile=~/.ssh/xif@-xifnet-generic- # Then in Firefox proxy settings : SOCKSv5 localhost:3128
Start build machines : xif@el-presidente$ sudo ./parpsu-o9-trigger ioslaves-master xif satanas --on=GATEWAY el-presidente /!\ L'USB-keep-powered est branché sur bam-bam -> éteindre satanas avant /!\
Procédure Wireguard
Misc Xif / OS X
misc-xifgit clone https://github.com/qTox/qTox.git cd qTox && LDFLAGS="-framework CoreVideo -framework AudioToolbox -framework VideoToolbox" cmake . -DSMILEYS=MIN
diskutil unmount force /Volumes/[Volume]
defaults write NSGlobalDomain NSAppSleepDisabled -bool YES
diskutil list
mkdir /Volumes/UPSUD && sshfs -o nolocalcaches -o volname="UPSUD" -o idmap=file -o nomap=ignore -o modules=iconv,from_code=UTF-8,to_code=UTF-8-MAC -o uidfile=~/.ssh/sshfs-uids "felix.faisant@tp-ssh1.dep-informatique.u-psud.fr:/home/tp-home004/ffaisan" "/Volumes/UPSUD" -o CheckHostIP=no && open "/Volumes/UPSUD"
rsync -rlt --delete --progress --partial -e "ssh -p 2222 -i /Users/xif/.ssh/http@nashorn" /Volumes/BigData/Photos http@nashorn.net.xif.fr:/srv/http/photos
cmake ../VTK-7.1.0 -DVTK_USE_QVTK:BOOL=ON -DVTK_USE_CARBON:BOOL=OFF -DCMAKE_INSTALL_PREFIX=/usr/local -DVTK_USE_GUISUPPORT:BOOL=ON -DQT_QMAKE_EXECUTABLE:PATH=/Library/Qt/5.7/clang_64/bin/qmake -DVTK_QT_VERSION:STRING=5 -DBUILD_SHARED_LIBS:BOOL=ON -DVTK_USE_CXX11_FEATURES:BOOL=ON -DBUILD_TESTING:BOOL=ON -DVTK_WRAP_PYTHON:BOOL=ON -DVTK_PYTHON_VERSION:STRING=3.4 -DVTK_USE_N_WAY_ARRAYS:BOOL=ON -DVTK_USE_CHARTS:BOOL=ON
./bootstrap.sh --with-libraries=[...boost libraries...] --with-python=python3.6 sudo ./b2 install -j2 link=shared,static toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++"
sudo pip install --upgrade youtube-dl
Xod Wiki
https://srv01.silvercraft.fr/wiki/doku.php?id=linuxXif Wiki
https://wiki.xif.fr/procedures/index