Skip to content

Instantly share code, notes, and snippets.

View srinivasmohan's full-sized avatar

Srinivasan Mohan srinivasmohan

View GitHub Profile
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@srinivasmohan
srinivasmohan / thumbnail.rb
Created September 4, 2014 19:12
ffmpeg screenshots
#!/usr/bin/ruby
require "streamio-ffmpeg"
class Video
def initialize(f="", outf="./", at=[20, 50, 80])
@video=FFMPEG::Movie.new(f)
@at=at.map { |x| (@video.duration*x/100).to_i}
$stderr.puts "Video #{f} (#{@video.duration} secs) - Screenshots at #{@at.inspect}"
@outf=outf
@srinivasmohan
srinivasmohan / shellsock.sh
Created September 25, 2014 20:01
shellsock.sh
#!/bin/sh
#Patch bash for CVE-2014-6271 - For non-lts distro versions.
mkdir -p /usr/local/src && cd /usr/local/src
wget http://ftp.gnu.org/gnu/bash/bash-4.3.tar.gz
tar zxvf bash-4.3.tar.gz
#Get patches
for i in $(seq -f "%03g" 0 25); do wget http://ftp.gnu.org/gnu/bash/bash-4.3-patches/bash43-$i; done
cd bash-4.3
for i in $(seq -f "%03g" 0 25);do patch -p0 < ../bash43-$i; done
./configure && make && make install
@srinivasmohan
srinivasmohan / shellsock2.sh
Created September 25, 2014 22:52
shellsock2.sh
#!/bin/dash
export DEBDIR="/tmp/bashdebs"
[ -d $DEBDIR ] && rm -fr $DEBDIR
rm -f /tmp/bashdebs.tgz
cd /tmp/ && wget --quiet http://s3.amazonaws.com/com.versal.sysops/shellsock/bashdebs.tgz && tar zxvf bashdebs.tgz
cd $DEBDIR && sudo /usr/bin/dpkg -i *.deb 2>&1 1>/dev/null
#Test after update
bashver=`/usr/bin/dpkg -l bash | tail -1 | awk '{print $3}'`
echo "Host `hostname`, post update, with Bash $bashver"
rm -f echo && env -i X='() { (a)=>\' bash -c 'echo id'; cat echo