Tag Archives: os x

Памятка: avr-gcc, компиляция

Необходимые компоненты:

port install avr-gcc avr-libc

Создание объектного файла, линковка и получение исполняемого модуля:

avr-gcc -g -Os -mmcu=attiny2313 -c main.c
avr-gcc -g -Os -mmcu=attiny2313 -o main.elf main.c
avr-objcopy -j .text -j .data -O ihex main.elf main.hex

Заливка:

avrdude -c usbasp -p attiny2313 -U flash:w:main.hex

OS X: Disable cmd-p printing from Finder

Original post by Acker.

I’ve accidentally sent pages upon pages of programming to a printer and wasted so much paper cause I fat-fingered ⌘P instead of ⌘O.

To remove command+p from finder:

Open System PreferencesKeyboardKeyboard ShortcutsApplication Shortcuts in the left panel → click the «+» button below the right panel → Select Finder as your Application. Then set the menu title to exactly the case-sensative value of «Bring All to Front» and set Keyboard Shortcut to ⌘P by actually pressing the-command-key+p-key.

I tried setting the Keyboard Shortcut of command+p to «Open» but the command+o stopped working.

OS X: Migrating to SSD «properly»

Today our target is to migrate OS X from 250GB Hitachi HDD to 160GB OCZ solid-state drive. To do it in proper way we have to take into account a few things:

  • partitions must be aligned to increase drive performance
  • GPT uses unique IDs, that is why we shouldn’t just duplicate all data from one drive to another, but create a new partition table
  • we have to use TRIM for our new SSD to increase drive life
  • it would be nice to enable noatime mount option for filesystems on SSD to minimize writes to it

It is strongly recommended to create a full image backup of your HDD first!
If it all goes wrong this is the only way you are going to get everything back.

Continue reading

Best way to compress Fraps video

Для сильного сжатия видео, записанного с помощью утилиты Fraps, можно использовать набор библиотек ffmpeg. При этом ролики сжимаются с размера порядка 1ГБ до 50МБ без особо заметных потерь качества картинки и звука.

Для Windows

Упёрто здесь.

I’ve written a couple bat files that I use for encoding my Fraps recordings (quickly and well). First up, I have the lossless variation incase I’m doing mostly static desktop recordings:

SETLOCAL ENABLEDELAYEDEXPANSION
SETLOCAL ENABLEEXTENSIONS
for /F "delims=;" %%A IN ('dir /b *.avi') DO (
ffmpeg -i "%%A" -acodec ac3 -ab 192000 "%%~nA.ac3"
ffmpeg -i "%%A" -vcodec rawvideo -f yuv4mpegpipe -an -pix_fmt yuv420p - | x264.x64 - --stdin y4m --crf 0 --bframes 5 --b-adapt 2 --ref 4 --mixed-refs --no-fast-pskip --direct auto --deblock -3:-3 --subme 10 --trellis 2 --analyse all --8x8dct --me umh --output "%%~nA.noaudio.mkv"
mkvmerge -o "%%~nA - lossless.mkv" --forced-track 1:no -d 1 -A -S "%%~nA.noaudio.mkv" --forced-track 0:no -a 0 -D -S "%%~nA.ac3" --track-order 0:1,1:0
del "%%~nA.ac3"
del "%%~nA.noaudio.mkv"
)
pause

For the other one, I use a lossy mode that’s pretty indistinguishable between the source and the encode in motion:

SETLOCAL ENABLEDELAYEDEXPANSION
SETLOCAL ENABLEEXTENSIONS
for /F "delims=;" %%A IN ('dir /b *.avi') DO (
ffmpeg -i "%%A" -acodec ac3 -ab 192000 "%%~nA.ac3"
ffmpeg -i "%%A" -vcodec rawvideo -f yuv4mpegpipe -an -pix_fmt yuv420p - | x264.x64 - --stdin y4m --crf 19 --bframes 5 --b-adapt 2 --ref 4 --mixed-refs --no-fast-pskip --direct auto --deblock -3:-3 --subme 10 --trellis 2 --analyse all --8x8dct --me umh --output "%%~nA.noaudio.mkv"
mkvmerge -o "%%~nA.final.mkv" --forced-track 1:no -d 1 -A -S "%%~nA.noaudio.mkv" --forced-track 0:no -a 0 -D -S "%%~nA.ac3" --track-order 0:1,1:0
del "%%~nA.ac3"
del "%%~nA.noaudio.mkv"
)
pause

Continue reading

Mount point permissions, OS X NFS sharing. Brain dump

Задача: есть комп загруженный с Gentoo LiveCD, в нём имеется жёсткий диск с инфой, которую нужно быстро и не заморачиваясь расшарить для макоси. И чтоб не было никаких The folder «shared» can’t be opened because you don’t have permission to see its contents.

На лине:

mount -t ntfs -o rw,users,uid=65534,gid=65534,umask=0000 /dev/sda1 /mnt/shared/
echo '/mnt/gentoo *(rw,no_root_squash,sync,anonuid=65534,anongid=65534,insecure,no_subtree_check)' >> /etc/exports
/etc/init.d/nfs restart

В OS X:
Finder → Go → Connect to server… (⌘K) → Server Address:
nfs://192.168.0.1/mnt/shared

Возможные косяки:

  • Неправильные права доступа для самой шары (конкретно в нашем случае — /mnt/shared имеет достаточные для работы права Access: (0555/dr-xr-xr-x) Uid: (65534/ nobody) Gid: (65534/ nobody));
  • Недостаточные права в /etc/exports. В этом примере роль играет опция insecure;
  • Неправильно введён адрес сервера или путь к расшаренной директории со стороны макоси;
  • Настройками файрвола зарезан NFS с одной из сторон.

Continue reading

OS X booting into 64-bit mode

By default in 2009, Snow Leopard boots into a 32-bit kernel, an odd proposition for an OS claiming to be 64-bit. But Apple defaulted to a 32-bit kernel for good reasons:

  • it keeps compatibility high with drivers and specialized software, which lowers hassles for users;
  • it keeps bad press away. Like bad breath, bad press makes a lasting first impression. Microsoft halitosis (also known as Windows) turned off a lot of users. (I think Microsoft should change the name, it’s a perfect fit!). performance is still improved over Leopard.

Continue reading