Skip to content

Instantly share code, notes, and snippets.

View brendanjcaffrey's full-sized avatar

Brendan Caffrey brendanjcaffrey

View GitHub Profile
@brendanjcaffrey
brendanjcaffrey / instructions.md
Last active December 10, 2018 02:11
Install Zeal on CentOS 7
$ sudo yum install bsdtar qt5-qtwebkit-devel qt5-qtbase-devel xcb-util-keysyms-devel libarchive-devel qt5-qtx11extras qt5-qtx11extras-devel
$ git clone https://github.com/zealdocs/zeal.git
$ cd zeal
$ qmake-qt5 "CONFIG+=no_libappindicator"
$ make
$ sudo make install
@brendanjcaffrey
brendanjcaffrey / convert.sh
Created June 17, 2016 21:28
convert audio files to mp3
brew install libav
cd ~/Music/iTunes/iTunes\ Music/[artist]/[album]/
for file in *.aif; do avconv -i "$file" -f mp3 -acodec libmp3lame -ab 320000 -ar 44100 "$file.mp3"; done
open .
-- make sure new mp3 files look good
rm *.aif
for file in *.aif.mp3; do new=`echo $file | sed "s|.aif||"`; mv "$file" "$new"; done
-- go into itunes, click on song you converted, locate, pick new mp3 file
@brendanjcaffrey
brendanjcaffrey / update_vim_plugins.sh
Created December 25, 2012 17:02
Updates vim plugins that are installed using pathogen by executing `git pull` in every plugin directory.
#!/bin/bash
cd ~/.vim/bundle
for F in $(find . -type d -d 1) ; do
cd ~/.vim/bundle/$F
git pull
done
@brendanjcaffrey
brendanjcaffrey / retina_resizer.sh
Created December 25, 2012 17:00
A little bash script that takes a bunch of retina sized images, moves them to image@2x.png and then creates a half size version using imagemagick.
#!/bin/bash
# loops through a directory of files, moves all .png files to file@2x.png
# and then resizes it using imagemagick to 50% size in file.png
shopt -s nullglob # if there are no .png files in the directory, then the below line won't just return *.png
ext=png
for file in *.$ext
do
text="${file##*.}"
name="${file%.*}"
@brendanjcaffrey
brendanjcaffrey / add_to_itunes.applescript
Created December 25, 2012 16:58
A folder action that adds any audio files added to the folder to a specified playlist in iTunes.
-- folder action script that attempts to add files that appear in a folder to iTunes and then delete them.
-- installation: copy file into /Library/Scripts/Folder Action Scripts/, right click on the folder
-- you want this to run on (i.e. ~/Downloads/), click "Folder Actions Setup," and add the file as an action.
property music_exts : {"mp3", "m4a", "aif", "wav"}
property playlist_to_add_to : "New" -- change to the name of the playlist the file will be added to
on adding folder items to my_folder after receiving the_files
repeat with i from 1 to number of items in the_files
set added_file to (item i of the_files)