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
#cloud-config | |
growpart: | |
mode: off |
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 | |
# Takes a screenshot, uploads via scp, puts url on the clipboard | |
# Edit the code to set the scp destination and url format | |
# | |
# Bind it to a gnome keyboard shortcut for speedy screen sharing | |
# | |
# Ridiculously this needs bash, gnome-screenshot, xclip, scp, notify-send, sha256sum AND Ruby | |
set -e |
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 Unicorn::HttpServer | |
alias process_client_orig process_client | |
undef_method :process_client | |
def process_client(client) | |
process_client_orig(client) | |
rss = `ps -o rss= -p #{Process.pid}`.chomp.to_i / 1024 | |
puts "Unicorn #{Process.pid}, #{request.env['REQUEST_METHOD']} #{request.env['REQUEST_PATH']} using #{rss}M" | |
end | |
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
ForumPost.transaction do | |
(0..WpComment.approved.count / 100).each do |offset| | |
WpComment.approved.find(:all, :limit => 100, :offset => offset * 100 ).each do |wpc| | |
ForumPost.create_from_wp_comment(wpc) | |
end | |
end | |
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
require 'socket' | |
tmp_cache_dir = [Socket.gethostname, Process.pid, Time.now.to_i, rand(0xffff)].to_s | |
page_cache_tree = File.join(ApplicationController.page_cache_directory, 'entries') | |
FileUtils.mv(page_cache_tree, page_cache_tree + tmp_cache_dir) | |
FileUtils.rm_rf(page_cache_tree + '-' + tmp_cache_dir) |
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 | |
# | |
# smtp to www gateway. Tested with Postfix. Inspired by rms. | |
# | |
# Pipe to this command from your .forward file (or in my case, an alias extension, | |
# so .forward-webgateway). For every http or https url found in the message | |
# (headers and body), it will send an email back to you with the output of a text | |
# web browser visiting. | |
# | |
# * Requires elinks and the mail command |
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
// Script to test streaming of request body | |
// test with: curl --data-binary @somebigfile http://localhost:8124 | |
// | |
var http = require('http'); | |
http.createServer(function (req, res) { | |
console.log('New request'); | |
var total = 0; | |
req.addListener('data', function (chunk) { | |
total += chunk.length; | |
console.log('Data chunk received ' + chunk.length / 1024 + 'k'); |
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 little test app generates SHA1 hashes for HTTP uploads on the | |
# fly, without storing them on disk. | |
# By John Leach <john@johnleach.co.uk> (with help from Eric Wong) | |
# | |
# Start the server like this: | |
# | |
# rainbows -c rainbows.conf.rb rainbows-sha1.ru | |
# | |
# I've been testing this with Revactor, which requires Ruby 1.9 |
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
root@srv-kve94:~/hirb# gem -v | |
1.3.5 | |
root@srv-kve94:~/hirb# rake generate | |
(in /home/ubuntu/hirb) | |
# -*- encoding: utf-8 -*- | |
Gem::Specification.new do |s| | |
s.name = %q{hirb} | |
s.version = "0.3.4" |
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
def method_in_deploy | |
puts "METHOD IN DEPLOY" | |
end | |
task :task_in_deploy do | |
puts "TASK IN DEPLOY" | |
end | |
task :do_before do | |
puts "BEFORE" |
OlderNewer