This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
# Prevent CSRF attacks by raising an exception. | |
# For APIs, you may want to use :null_session instead. | |
protect_from_forgery with: :exception | |
protected | |
def current_user | |
@current_user ||= session[:user_id] and User.find(session[:user_id]['$oid']) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Prints the folder name number of files and folders in each subdirectory. | |
for i in *; do show="$i"; num=`ls "$i" | wc -l`; echo "$show: $num"; done; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# aa.sh | |
# Scale and crop album art for embedding in music tags | |
if [ -z $1 ] | |
then | |
echo "Usage: `basename $0` image_file" | |
else | |
convert $1 -resize 300x300^ -gravity center -extent 300x300 folder.jpg | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Strip ID3 Tags from FLAC | |
find . -name "*.flac" -exec id3v2 --delete-all {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Search for a text string in all files and subdirectories. | |
find -type f -print0 | xargs -0 grep -il "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Checks to see if irexec is running and runs it if not already running. | |
youruser=richard | |
# Test to see if IRexec is running first, if so kill it, then restart | |
if ps -ef|grep -v grep|grep -vi start|grep -i irexec | |
then | |
ps aux|grep -i $youruser|grep -i irexec |grep -vi start|awk '{print $2}'|xargs kill | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
# Switch between XBMC and Boxee | |
if ps ax | grep -v grep | grep xbmc.bin > /dev/null | |
then | |
echo "XBMC running, killing process" | |
kill `pidof xbmc.bin` | |
sleep 7 | |
echo "running Boxee" | |
/usr/bin/runBoxee & | |
elif ps ax | grep -v grep | grep Boxee > /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Convert videos from Canon S90 to flash-playable streaming format | |
for file in "$@" | |
do | |
filename=$(basename $file) | |
filename=${filename%.*} | |
# Convert the audio stream to AAC | |
ffmpeg -i $file -vcodec copy -acodec libfaac temp_vid.mp4 | |
# Move the H.264 MOOV atom to the beginning of the file for progressive streaming | |
qt-faststart temp_vid.mp4 $filename.mp4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Setup passwordless login and install nagios plugin on remote client | |
ID=/etc/nagios3/keys/id_rsa | |
SCRIPT=nagios-install-plugins.sh | |
SCRIPTPATH=/home/richard/scripts | |
EXTRA=nagios-plugins-extra | |
if [ -e "$SCRIPTPATH/$SCRIPT" ]; then | |
sudo su -l -s /bin/bash nagios -c "ssh-copy-id -i $ID $1; \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Install nagios plugins | |
VERSION=1.4.15 | |
DESTDIR=~/nagios-plugins | |
URL=http://downloads.sourceforge.net/project/nagiosplug/nagiosplug/${VERSION}/nagios-plugins-${VERSION}.tar.gz | |
FILE=nagios-plugins-${VERSION}.tar.gz | |
FOLDER=nagios-plugins-${VERSION} |
OlderNewer