Skip to content

Instantly share code, notes, and snippets.

View karlentwistle's full-sized avatar

Karl Entwistle karlentwistle

View GitHub Profile
@karlentwistle
karlentwistle / Apache Config
Created April 17, 2011 17:10
Apache Config - vid.so
<VirtualHost *:80>
ServerName www.vid.so
DocumentRoot /home/admin/vidso/current/public
<Directory /home/admin/vidso/current/public>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
<Location />
LoadModule passenger_module /home/admin/.rvm/gems/ree-1.8.7-2011.03/gems/passenger-3.0.7/ext/apache2/mod_passenger.so
PassengerRoot /home/admin/.rvm/gems/ree-1.8.7-2011.03/gems/passenger-3.0.7
PassengerRuby /home/admin/.rvm/wrappers/ree-1.8.7-2011.03/ruby
# enable xsendfile
XSendFile On
# enable sending files from parent dirs
XSendFileAllowAbove On
@karlentwistle
karlentwistle / Easy ffmpeg install
Created April 18, 2011 09:12
This script downloads and install ffmpeg and x264 from SVN and git for the initial install
#!/bin/bash
# ffmpegin
# this sctipt downloads and install ffmpeg and x264 from SVN and git for the initial install
# taken from the excellet tutorial found here:
#http://ubuntuforums.org/showthread.php?t=786095&highlight=ffmpeg+x264+latest
# all props to fakeoutdoorsman, not me
# check http://code.google.com/p/x264-ffmpeg-up-to-date/ for updates
######################################
# ver 1.4 by rupert plumridge
class Calculator::PriceBucket < Calculator
preference :minimal_amount, :decimal, :default => 0
preference :normal_amount, :decimal, :default => 0
preference :discount_amount, :decimal, :default => 0
def self.description
I18n.t("price_bucket")
end
def self.register
@karlentwistle
karlentwistle / reddit_docs.rb
Created November 24, 2012 18:52
Recent Documentaries on Reddit
require 'open-uri'
require 'nokogiri'
require 'video_info'
def extract_youtube_links(link)
top_docs = Nokogiri::XML(open(link))
links = URI.extract(top_docs.xpath('//item/description').to_a.join(" "))
links.select { |l| l.include?("watch?v=") }
end
#curl -L https://gist.github.com/karlentwistle/5029263/raw/84faa6a15a9c521533e33135090c1214c457f08d/chef_solo_bootstrap.sh | bash
aptitude -y update
echo "Installing RVM and Ruby dependencies"
sudo apt-get install -y build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion git-core libgdbm-dev pkg-config libffi-dev
echo "Installing RVM system-wide"
bash -c "bash <( curl -L https://github.com/wayneeseguin/rvm/raw/1.3.0/contrib/install-system-wide ) --version '1.3.0'"
cat >> /etc/profile <<'EOF'
# Load RVM if it is installed,
# first try to load user install
@karlentwistle
karlentwistle / gist:5394220
Last active December 16, 2015 06:49
AWS Request Authentication (UNFINISHED)
// http://docs.aws.amazon.com/AWSMechTurk/latest/AWSMechanicalTurkRequester/MakingRequests_RequestAuthenticationArticle.html
// 1 The sender constructs a request to AWS.
// 2 The sender calculates a Keyed-Hashing for Message Authentication code (HMAC), the request signature using the his or her Secret Access Key and the values of the Service, Operation, and Timestamp parameters as input.
// 3 The sender of the request sends the request data, the signature, and Access Key ID (the key-identifier of the Secret Access Key used) to AWS.
// 4 AWS uses the Access Key ID to look up the Secret Access Key.
// 5 AWS generates a signature from the request data and the Secret Access Key using the same algorithm used to calculate the signature in the request.
// 6 If the signature generated by AWS matches the one sent in the request, the request is considered to be authentic. If the comparison fails, the request is discarded, and AWS returns an error response.
package main
# config/routes.rb
resources :documents do
resources :versions, controller: "documents/versions" do
post :restore, on: :member
end
resource :lock, controller: "documents/locks"
end
# Usage: ruby doctor.rb [HOST=status.github.com[:PORT=443]]
require 'rbconfig'
require 'net/https'
if ARGV[0] =~ /^[^-]/
host, port = ARGV[0].split(':', 2)
else
host = 'status.github.com'
end
port ||= 443
@karlentwistle
karlentwistle / gist:10735660
Last active August 29, 2015 13:59
Using the doctor script
ruby doctor.rb facebook.com
ruby doctor.rb google.com