segunda-feira, 7 de maio de 2018
Afterinstall for Ubuntu 18.04 LTS
Moved here: https://github.com/joaocgreis/post-install
It will keep evolving while I have Ubuntu 18.04 installed.
terça-feira, 24 de abril de 2018
sexta-feira, 13 de abril de 2018
Split podcasts and prepend part number
for i in *; do
TITLEBASE=$(echo "$i" | sed "s/\..*//")
TITLE=$(echo "$TITLEBASE" | sed "s/_/ /g;s/\(20[0-9]\{2\}\)\([0-1][0-9]\)\([0-3][0-9]\)/\1-\2-\3/")
DUR=$(ffprobe -v quiet -show_format "$i" | sed -n "/duration/{s/.*=//;s/\..*//;p}")
PARTSIZE=300
OVERSHOOT=5
PARTS=$((($DUR + $PARTSIZE - 1) / $PARTSIZE))
PARTSIZE=$((($DUR / $PARTS) + 1))
mplayer -ao pcm:file=tmp_file.wav -af volnorm=1:1,resample=44100:1:2,format=s16le,channels=2 -novideo -really-quiet -noconsolecontrols "$i" &&
normalize-audio -v -a 1.0 tmp_file.wav &&
for p in $(seq -w $PARTS); do
pp=$(echo $p | sed "s/^0*//")
echo
echo $TITLE - $DUR - $p of $PARTS
mplayer -ao pcm:file=tmp1.wav -af resample=44100:1:2,format=s16le,channels=2 -novideo -really-quiet -noconsolecontrols "http://translate.google.com/translate_tts?ie=UTF-8&client=tw-ob&q=part $pp of $PARTS of $TITLE&tl=en" &&
mplayer -ao pcm:file=tmp2.wav -novideo -really-quiet -noconsolecontrols tmp_file.wav -ss $(($PARTSIZE * ($pp - 1))) -endpos $(($PARTSIZE + $OVERSHOOT)) &&
sox tmp1.wav tmp2.wav tmp.wav &&
lame -a -h -V4 tmp.wav "${TITLEBASE}_${p}.mp3" &&
rm tmp1.wav tmp2.wav tmp.wav
done
rm tmp_file.wav
done
sábado, 30 de setembro de 2017
Recursive SHA sums and size lists
List of SHA512 sums:
List of file sizes:
find -type f -exec sha512sum '{}' \; | LC_COLLATE=C sort -k 2
List of file sizes:
find -type f -exec stat -c '%s %n' '{}' \; | LC_COLLATE=C sort -k 2
quinta-feira, 10 de setembro de 2015
Separator tab bookmarklet
Create a new bookmark, edit it, and paste this in the target address.
javascript:{document.title=prompt("Name","SEP");};void(0);
sábado, 18 de abril de 2015
Custom launcher in Unity
Create a file named application_whatever.desktop with:
[Desktop Entry]
Name=Application Name
Comment=Application Comment
Exec=/path/to/exec/command
Path=/path/
Icon=/path/to/icon
Terminal=false
Type=Application
StartupNotify=true
and put it in $HOME/.local/share/applications/
quarta-feira, 28 de maio de 2014
Afterinstall for Ubuntu 14.04 LTS
First! Make sure you have the fastest possible server configured: System Settings -> Software & Updates -> Download from: Other... -> Select Best Server -> Choose Server
Then open a terminal and... (you might want to copy this in several smaller parts, the copy buffer is not large enough)
Then go to System Settings and make sure everything is to your liking. You can change the screen locking timeouts, under Details set the default application for audio and video to SMPlayer and so on.
If you have a laptop and battery concerns (take a look at http://linrunner.de/en/tlp/docs/tlp-linux-advanced-power-management.html):
If you have an SSD drive, add
Then open a terminal and... (you might want to copy this in several smaller parts, the copy buffer is not large enough)
Then go to System Settings and make sure everything is to your liking. You can change the screen locking timeouts, under Details set the default application for audio and video to SMPlayer and so on.
If you have a laptop and battery concerns (take a look at http://linrunner.de/en/tlp/docs/tlp-linux-advanced-power-management.html):
sudo add-apt-repository ppa:linrunner/tlp &&
sudo apt-get update &&
sudo apt-get install tlp tlp-rdw &&
sudo tlp start
If you have an SSD drive, add
,discard to the options of your EXT4 partition in /etc/fstab.
Also in /etc/fstab, add these lines so that the temporary directories are mounted in RAM:
tmpfs /tmp tmpfs defaults,noatime,mode=1777,size=10% 0 0
tmpfs /var/tmp tmpfs defaults,noatime,mode=1777,size=10% 0 0
You can also finetune swappines:
sudo sh -c "echo 'vm.swappiness=1' >> /etc/sysctl.d/99-sysctl.conf" &&
sudo sh -c "echo 'vm.vfs_cache_pressure=50' >> /etc/sysctl.d/99-sysctl.conf"
Subscrever:
Comentários (Atom)