Skip to content

Instantly share code, notes, and snippets.

@garyttierney
Last active August 29, 2015 14:24
Show Gist options
  • Select an option

  • Save garyttierney/61e51a6f1e50ff002988 to your computer and use it in GitHub Desktop.

Select an option

Save garyttierney/61e51a6f1e50ff002988 to your computer and use it in GitHub Desktop.
screencast function
bash <(curl -s https://gist.githubusercontent.com/garyttierney/61e51a6f1e50ff002988/raw/72606dbde0c171ce6b2c83625a8ac0a97ccb19a3/screencast_install.sh)
#!/bin/bash
function screencast() {
FILE=$(mktemp "/tmp/XXXXX.webm")
ffcast -vv -s ffmpeg -y -r 25 -f webm $FILE
URL=$(drive upload --share --file $FILE | egrep -o 'https?://[^ ]+')
echo $URL | xclip -selection clipboard
notify-send "Screencast" "Finished uploading screencast to $URL"
}
screencast
#!/bin/bash
function screencast_install() {
if [ ! -f /usr/include/X11/Xlib.h]; then
echo "x11 headers not found, install it via one of the following options:"
echo " RedHat/Fedora/CentOS: yum install libx11-devel"
echo " Debian/Ubuntu: apt-get install libx11-dev"
echo " Mac OS X: download and install http://xquartz.macosforge.org/downloads/SL/XQuartz-2.7.7.dmg"
fi
if [ ! -f /usr/bin/ffmpeg ]; then
echo "ffmpeg not found, install it via one of the following options:"
echo " RedHat/Fedora/CentOS: yum install ffmpeg"
echo " Debian/Ubuntu: apt-get install ffmpeg"
echo " Mac OS X: brew install ffmpeg"
fi
if [ ! -f /usr/bin/drive ]; then
echo "gdrive executable not found, downloading..."
if [ "$OSTYPE"="linux-gnu" ]; then
URL="https://drive.google.com/uc?id=0B3X9GlR6EmbnMHBMVWtKaEZXdDg"
elif ["$OSTYPE"="darwin"* ]; then
URL="https://drive.google.com/uc?id=0B3X9GlR6EmbnVWtGWjBmNmhVeHM"
else
echo "Unknown architecture. Exiting."
exit -1
fi
sudo wget $URL -O /usr/bin/drive
sudo chmod +x /usr/bin/drive
fi
if [ ! -f /usr/bin/ffcast ]; then
echo "can't find ffcast, downloading..."
git clone https://github.com/minos-org/ffcast.git $HOME/ffcast
cd $HOME/ffcast
echo "compiling ffcast..."
make
sudo make install
fi
grep -q "screencast" "$HOME/.bashrc"
if [ $? -eq 1 ]; then
SCREENCAST_BIN="https://gist.githubusercontent.com/garyttierney/61e51a6f1e50ff002988/raw/e000c991cc0e2ce1a9a02f850488b8edadb4b933/screencast.sh"
curl -s "$SCREENCAST_BIN" >> ~/.bashrc
fi
}
screencast_install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment