sudo lsof -i -P | grep -i "listen"
Category Archives: OSX / iOS
osx display nameserver via cmd line
[user@macmini ~]# scutil --dns | grep 'nameserver\[[0-9]*\]' nameserver[0] : 209.222.18.222 nameserver[1] : 209.222.18.218 nameserver[0] : 209.222.18.222 nameserver[1] : 209.222.18.218 nameserver[0] : 209.222.18.222 nameserver[1] : 209.222.18.218
ffmpeg on osx to convert flac to Apple Lossless (’cause itune$ won’t support flac)
References:
http://www.renevolution.com/how-to-install-ffmpeg-on-mac-os-x/
http://sound.stackexchange.com/questions/26633/free-batch-conversion-from-flac-to-apple-lossless-alac
- Install brew
-
Install ffmpeg
user@box dir $ brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-frei0r --with-libass --with-libvo-aacenc --with-libvorbis --with-libvpx --with-opencore-amr --with-openjpeg --with-opus --with-rtmpdump --with-schroedinger --with-speex --with-theora --with-tools
-
Convert all flac files
for f in `find . -type f -name *.flac`; do ffmpeg -i "$f" -vf "crop=((in_w/2)*2):((in_h/2)*2)" -c:a alac "${f%.flac}.m4a"; done
Convert flac to m4a
Since iTunes doesn’t support flac (Apple is just as proprietary as Micro$oft), I needed to convert a large number of flac files to m4a.
1) Download and setup ffmpeg . I dropped the 3 files in /usr/local/bin
2)
for i in `find . -type f -name "*.flac"`; do echo $i; ffmpeg -i "$i" -acodec alac "$i.m4a"; done;
3) Drop the files in your iTunes directory under iTunes/Automatically\ Add\ to\ iTunes.localized/
Install PyYAML on OSX – Mountain Lion
When trying to setup pyyaml on Mountain Lion, I kept seeing a yaml.h error:
my-macbook:reorganization me$ pip install pyyaml Downloading/unpacking pyyaml Downloading PyYAML-3.10.tar.gz (241kB): 241kB downloaded Running setup.py egg_info for package pyyaml Installing collected packages: pyyaml Running setup.py install for pyyaml checking if libyaml is compilable cc -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c build/temp.macosx-10.8-x86_64-2.7/check_libyaml.c -o build/temp.macosx-10.8-x86_64-2.7/check_libyaml.o build/temp.macosx-10.8-x86_64-2.7/check_libyaml.c:2:10: fatal error: 'yaml.h' file not found #include^ 1 error generated. libyaml is not found or a compiler error: forcing --without-libyaml (if libyaml is installed correctly, you may need to specify the option --include-dirs or uncomment and modify the parameter include_dirs in setup.cfg) Successfully installed pyyaml Cleaning up...
my-macbook:reorganization me$ sudo easy_install pip my-macbook:reorganization me$ sudo brew install libyaml my-macbook:reorganization me$ sudo easy_install setuptools my-macbook:reorganization me$ pip install -U PyYAML
How to Make a Simple Mac App on OSX 10.7
Playing around with osx / ios programming and found this great tutorial for xcode: How to Make a Simple Mac App on OSX 10.7
Import a new p12 into keychain via terminal
sudo security import /Users/cmuser/workspaces/cm_trunk/osx/p12s/dk_new_media.p12 -T /usr/bin/codesign -P "" -k ~/Library/Keychains/login.keychain
Linux – Show only directories with over a certain number of files
/mnt/music/sorted$ dir=/mnt/music/sorted; for i in `ls $dir`; do wc=`ls -l $dir/$i | grep ^- | wc -l`; if [ $wc -gt 30 ]; then echo "$i -> $wc" ; fi; done;
Linux – List only files
james@server:/mnt/music$ ls -l | grep ^- | awk '{print $8}'
Check to see if you are running 32 or 64 bit OS
getconf LONG_BIT