mencoder infile.wmv -ofps 23.976 -ovc lavc -oac copy -o outfile.avi
Tmux: vertical scroll
Press
Ctrl-B then [
and use normal navigation keys to scroll around.
MySQL: Select rows older than X days
I know it’s simple, but I use it so frequently that I decided to paste it here as a reminder (with example of 14 days):
SELECT * FROM `table` WHERE DATE_SUB(now(), INTERVAL 14 DAY) > `inserted_at`;
Assuming you are selecting agains `inserted_at` field which contains date of row insertion
Tmux: reload config
"Ctrl-B :" and then type: source-file ~/.tmux.conf
Tmux: manipulate windows position
To move a window to specific position:
"Ctrl-B :" and the type: move-window -t X
Where “X” is the number of position you want to move to
To switch two windows:
"Ctrl-B :" and the type: swap-window -t X
Where “X” is the number of window you want to switch with
Git: stage file by pattern in name
Following will add all .txt files to stagin area recursively. Notice the double quotes:
git add "*.txt"
unix: fstab broken
If you once did mistake like me: edited /etc/fstab and restarted..:) and of course your system couldn’t mount, let’s say /etc than you’re in a small trouble. Here is what worked for me:
mount /dev/ad0s1f /usr
to load /usr manually, then:
mount -a
to mount any other filesystems in /etc/fstab..
split flac+cue into separate tracks
cuebreakpoints file.cue | shnsplit -o flac -t %n-%t file.flac
In case .cue file is incuded in .flac file, run first:
metaflac --show-tag=CUESHEET sample.flac | grep -v ^CUESHEET > sample.cue
UNIX: convert m4a to mp3
First, convert m4a to wav:
Single file
mplayer -ao pcm mysong.m4a -ao pcm:file="mysong.wav"
Multiple files
#!/bin/bash # # m4a2wav # for i in *.m4a; do mplayer -ao pcm "$i" -ao pcm:file="${i%.m4a}.wav" done
Then, convert wav to mp3:
Single file
lame -h -b 192 mysong.wav mysong.mp3
Multiple files
#!/bin/bash # # wav2mp3 # for i in *.wav; do lame -h -b 192 "$i" "${i%.wav}.mp3" done
FreeBSD: mount ISO
Mount:
mdconfig -a -t vnode -f [ISO filename] mount -t cd9660 /dev/md? [mount destination]
Unmount:
umount [mount destination] mdconfig -d -u /dev/md?