Find duplicates: fdupes (fdupes . -r > ~/duplicates.dat)
fdupes
fdupes . -r > ~/duplicates.dat
create archive: tar -cvf name-of-archive.tar /path/to/directory-or-file create archive with compression: tar -czvf name-of-archive.tar.gz /path/to/directory-or-file create archive and delete files after archive would be created tar -cvf name-of-archive.tar.gz --remove-files /path/to/directory-or-file
tar -cvf name-of-archive.tar /path/to/directory-or-file
tar -czvf name-of-archive.tar.gz /path/to/directory-or-file
rsync by default uses ssh to transfer files between machines --remove-source-files - To MOVE files from one machine to another (delete source after moving file) use: rsync --remove-source-files <source> <destination > where destination is another directory or another directory on another machine --partial This is another switch that is particularly useful when transferring large files over the internet. If rsync gets interrupted for any reason in the middle of a file transfer, the partially transferred file is kept in the destination directory and the transfer is resumed where it left off once the rsync command is executed again. When transferring large files over the internet (say, a couple of gigabytes), theres nothing worse than having a few second internet outage, blue screen, or human error trip up your file transfer and having to start all over again. -P this switch combines --progress and --partial, so use it instead and it will make your rsync command a little neater. -z or --compress This switch will make rsync compress file data as its being transferred, reducing the amount of data that has to be sent to the destination. Its actually a fairly common switch but is far from essential, only really benefiting you on transfers between slow connections, and it does nothing for the following types of files: 7z, avi, bz2, deb, g,z iso, jpeg, jpg, mov, mp3, mp4, ogg, rpm, tbz, tgz, z, zip. -h or --human-readable - If youre using the --progress switch, youll definitely want to use this one as well. That is, unless you like to convert bytes to megabytes on the fly. The -h switch converts all outputted numbers to human-readable format, so you can actually make sense of the amount of data being transferred.
rsync
--remove-source-files
rsync --remove-source-files <source> <destination >
--partial
-P
--progress
-z
--compress
-h
--human-readable
Join two lines: J ([shift] J) Display status line: ^g Undo: u Write part of the file: :12,15w NewFileName Forward search: /string Backward search: ?string
date +"%Y-%m-%d %T" The result: 2017-06-27 14:30:18
date +"%Y-%m-%d %T"
2017-06-27 14:30:18
Autossh is a program to start a copy of ssh and monitor it, restarting it as necessary should it die or stop passing traffic. Typical use: autossh -M 0 -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" pi@hampton.ddns.net -L 4000:localhost:3389 Details
autossh -M 0 -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" pi@hampton.ddns.net -L 4000:localhost:3389
crontab file location: /var/spool/cron/crontabs. Each user has separate file timing syntax: <minute> <hour> <day of month> <month> <day of week> Example: 10 * * * * /usr/bin/php /www/virtual/username/cron.php > /dev/null 2>&1 You can use multiple numbers separated by commas. E.g.: to run three times every hour, at minutes 0, 10 and 20: 0,10,20 * * * * [command] Division operator is also used. This will run 12 times per hour, i.e. every 5 minutes: */5 * * * * [command] Dash can be used to specify a range. This will run once every hour between 5:00am and 10:00am: 0 5-10 * * * [command] Also there is a special keyword that will let you run a cron job every time the server is rebooted: @reboot [command] Details
10 * * * * /usr/bin/php /www/virtual/username/cron.php > /dev/null 2>&1
0,10,20 * * * * [command]
*/5 * * * * [command]
0 5-10 * * * [command]
@reboot [command]
To enaable read/write access to NTFS device, install ntfs-3g package: sudo apt-get update sudo apt-get install ntfs-3g Then you will need to power cycle the Raspberry Pi. I'm not yet sure why there is a difference between a reboot and a power cycle, but you must power cycle the Raspberry Pi. That means turn it off, wait 5+ seconds, then turn it back on. Since my drive was powered by the same USB hub-thingey as my Pi, I used the switch to turn off the Pi and the drive, waited 5 seconds, and then turned both of them back on. Details
sudo apt-get update
sudo apt-get install ntfs-3g
Then you will need to power cycle the Raspberry Pi. I'm not yet sure why there is a difference between a reboot and a power cycle, but you must power cycle the Raspberry Pi. That means turn it off, wait 5+ seconds, then turn it back on. Since my drive was powered by the same USB hub-thingey as my Pi, I used the switch to turn off the Pi and the drive, waited 5 seconds, and then turned both of them back on.
NFS on RPi - including troubleshooting
Virtual Linux on Windows
Youtube instructions Start diskpart as administrator start cmd ad administrator and type diskpart type list disk progran will diskpay list of physical disks attached to the computer Select disk which you are going to mess in my case it is "Disk 1" type: select disk 1 CHECK THAT YOU SELECTED correct disk detail disk program will display information about selected disk - check it Delete all partitions: clean create partition primary active format fs=ntfs quick (instead of ntfs can be another format) exit
diskpart
cmd
list disk
select disk 1
detail disk
clean
create partition primary
active
format fs=ntfs quick
exit
nginx tutorial How to install SSL certificate for nginx on Debian How To Set Up Password Authentication with Nginx on Ubuntu How to extract some value from cookie in nginx - Stack Overflow can you set up cookies in nginx? Cookie-based authentication with nginx GitHub
tidy - html text formatter/checker w3school how to, including menu, google map and many other useful staf Another example of html menu
ffmpeg -i original.mp4 -vf "transpose=1" -codec:v libx264 -preset slow -crf 25 -codec:a copy flipped.mp4 options for transpose: 0 = 90CounterCLockwise and Vertical Flip (default) 1 = 90Clockwise 2 = 90CounterClockwise 3 = 90Clockwise and Vertical Flip
ffmpeg -i original.mp4 -vf "transpose=1" -codec:v libx264 -preset slow -crf 25 -codec:a copy flipped.mp4
transpose:
First run ffmpeg -i file.mp4 to see which streams exists in your file. You should see something like this: Stream #0.0: Video: mpeg4, yuv420p, 720x304 [PAR 1:1 DAR 45:19], 23.98 tbr, 23.98 tbn, 23.98 tbc Stream #0.1: Audio: ac3, 48000 Hz, 5.1, s16, 384 kb/s Stream #0.2: Audio: ac3, 48000 Hz, 5.1, s16, 384 kb/s Then run: ffmpeg -i file.mp4 -map 0:0 -map 0:2 -acodec copy -vcodec copy new_file.mp4 to copy video stream and 2nd audio stream to new_file.mp4
ffmpeg -i file.mp4
Stream #0.0: Video: mpeg4, yuv420p, 720x304 [PAR 1:1 DAR 45:19], 23.98 tbr, 23.98 tbn, 23.98 tbc Stream #0.1: Audio: ac3, 48000 Hz, 5.1, s16, 384 kb/s Stream #0.2: Audio: ac3, 48000 Hz, 5.1, s16, 384 kb/s
ffmpeg -i file.mp4 -map 0:0 -map 0:2 -acodec copy -vcodec copy new_file.mp4
#!/bin/sh avconv -i $1 -c copy -bsf:v h264_mp4toannexb -f mpegts temp1.ts avconv -i $2 -c copy -bsf:v h264_mp4toannexb -f mpegts temp2.ts avconv -f mpegts -i "concat:temp1.ts|temp2.ts" -c copy -bsf:a aac_adtstoasc output.mp4
Details - For now I do not need it: h.265 files with the same quality are smaller but on RPi3 they are a bit choppy. May be with next generation of RPi or new RPi competetors (which have h.265 decoders on board) I'll start conversion.
Details: ffmpeg -i LostInTranslation.mkv -codec copy LostInTranslation.mp4 Here, you are copying the video codec and audio codec so nothing is being encoded. for i in *.mkv; do ffmpeg -i "$i" -codec copy "${i%.*}.mp4" done
ffmpeg -i LostInTranslation.mkv -codec copy LostInTranslation.mp4
for i in *.mkv; do ffmpeg -i "$i" -codec copy "${i%.*}.mp4" done
./configure --enable-libx265 --enable-gpl --enable-libkvazaar make make check sudo make install
The same operations can be done using AviDemux (which works not only with avi, but with mp4 files)