Bunch of random useful commands I've encountered/put together.
https://github.com/nojhan/liquidprompt
find . -regex ".*\.\(html\|css\|js\|scss\)" | xargs dos2unix
strings input.psd | grep "<photoshop:LayerText>" | sed -e "s|^[ \t]*<photoshop:LayerText>||" | sed -e "s|</photoshop:LayerText>||" > output.txt
sudo su - postgres
createuser -DRPS db_user
(new user can't create DB, roles and is not superuser; prompt for password)
createdb db_name -O db_user
(new DB with the previous user as owner)
mysql -u root -p
create database db_name;
grant usage on *.* to db_user@localhost identified by 'password';
grant all privileges on db_name.* to db_user@localhost ;
pg_dump -c -U database_user -h localhost -f dump.sql database_name
psql -U database_user -h localhost database_name < dump.sql
easy_install-2.7 pip
pip install virtualenv virtualenvwrapper
nano $HOME/.bashrc
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python2.7
source $HOME/bin/virtualenvwrapper.sh
source $HOME/.bashrc
rsync -avz --exclude ".thumbnails*" user@host:/home/user/webapps/app/static/media/uploads static/media/
git archive HEAD --format=zip > archive.zip
find . ! -path "*/migrations/*" -regex ".*\.\(html\|py\|js\|css\)" -exec egrep --color -Hin "search_term" {} \;
find . -name "*.html" -exec perl -i -p0e 's@Find with \n newlines@Replace with this@s' {} \;
find . -type f -exec sed -i s/<target>/<replacement>/ {} \;
sudo dpkg -i foobar.deb
sudo apt-get -f install
pip install feedparser python-dateutil
python manage.py import_rss --mezzanine-user=admin --rss-url=https://www.djangoproject.com/rss/weblog/
pip uninstall feedparser python-dateutil
cat /etc/*-release
wget -xi urls.txt
ssh [email protected] "echo `cat ~/.ssh/id_dsa.pub` >> .ssh/authorized_keys; chmod go-w .ssh; chmod 600 .ssh/authorized_keys"
cd
wget https://raw.githubusercontent.com/lanyrd/mysql-postgresql-converter/master/db_converter.py
mv db_converter.py ~/bin
chmod +x ~/bin/db_converter.py
mysqldump --compatible=postgresql --default-character-set=utf8 -p -r db_name.mysql -u mysql_db_user mysql_db_name
python2.7 ~/bin/db_converter.py db_name.mysql db_name.psql
psql -U psql_user psql_db_name < db_name.psql
-an
to eliminate audio.-crf
to set quality (0 is lossless, 50s are garbage, 20s work well).-s
to set output dimensions (must be divisible by 2: 1600x900)- http://www.thehelloworldprogram.com/web-development/encode-video-and-audio-for-html5-with-avconv/
# MP4 output, H264/AAC
ffmpeg -i quickfox.mkv -c:v libx264 -crf 28 -c:a aac -b:a 256k -strict experimental quickfox.mp4
# WEBM output, VP8/Vorbis
ffmpeg -i quickfox.mkv -c:v libvpx -crf 10 -c:a libvorbis -b:v 1M -qscale:a 7 quickfox.webm
# Extract a 1 frame (at 0.5s) to a PNG
ffmpeg -ss 0.5 -i video.mp4 -vframes 1 frame.png