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/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 |
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/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 |
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
#!/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 |
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
# | |
# 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. |
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 | |
#Run this on AMI ami-7e2da54e in us-west-2 (Supply this script as userdata) and build an AMI from the resulting instance. | |
#VPC Bootstrap User-data script generated at 2013-10-09 16:56:44 -0700 | |
function logmsg { | |
echo "CHEF-VPC-INIT: $1" | |
} | |
CHEF_VERSION=11.6.0 | |
RUBY_GEM_VER=1.8.25 |
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
[smohan@dhcpa-111 ~]$ irb | |
irb(main):001:0> require 'uri' | |
=> true | |
irb(main):002:0> p URI::Parser.new.regexp[:UNSAFE] | |
/[^\-_.!~*'()a-zA-Z\d;\/?:@&=+$,\[\]]/ | |
=> /[^\-_.!~*'()a-zA-Z\d;\/?:@&=+$,\[\]]/ | |
irb(main):003:0> p Regexp.union([URI::Parser.new.regexp[:UNSAFE],'~','@']) | |
/(?-mix:[^\-_.!~*'()a-zA-Z\d;\/?:@&=+$,\[\]])|~|@/ | |
=> /(?-mix:[^\-_.!~*'()a-zA-Z\d;\/?:@&=+$,\[\]])|~|@/ | |
irb(main):004:0> |
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
#This is meant to be run via "knife exec scriptname.rb" | |
# | |
require 'fog' | |
#Make sure you have a data bag called admin/ec2creds containing values 'aws_access_key_id' and 'aws_secret_access_key' | |
#which point to your AWS access key and secret access key. | |
DBAG_NAME='admin' | |
DBAG_KEY='ec2creds' | |
#Pull AWS credentials from the databag 'admin' with key 'ec2creds' | |
aws=Chef::DataBagItem.load(DBAG_NAME,DBAG_KEY) |
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
#Last updated <%= Time.now.to_s %> by '<%= $0.split('/')[-1] %> <%= ARGV[0] %> <%= ARGV[1] %>' | |
127.0.0.1 localhost | |
<%= myip_ohai %> my_mgmt_host | |
#Static entries... | |
#... | |
#... | |
#The following are chef managed instances whose IPs are pulled from knife exec runs. | |
##All of the below are generated from template entry in /etc/hosts.erb | |
<% %w{server1 server2 server3}.sort.each do |thissvr| %> |
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
#Rebuild hosts file from knife node list, | |
require 'erb' | |
require 'json' | |
require 'ohai' #to find my own IP | |
def myaddress | |
thissys=Ohai::System.new | |
thissys.all_plugins | |
myip=thissys['cloud']['private_ips'][0] | |
return myip |
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
#Cookbook_file section same as before | |
package 'glusterfs_3.2.1-1_amd64.deb' do | |
provider Chef::Provider::Package::Dpkg | |
source "/var/chef-package-cache/glusterfs_3.2.1-1_amd64.deb" | |
action :install | |
end |
NewerOlder