Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
if [ -z "${SAUCE_USERNAME}" ] || [ -z "${SAUCE_ACCESS_KEY}" ]; then
echo "This script can't run without your Sauce credentials"
echo "Please set SAUCE_USERNAME and SAUCE_ACCESS_KEY env variables"
echo "export SAUCE_USERNAME=ur-username"
echo "export SAUCE_ACCESS_KEY=ur-access-key"
exit 1
fi
echo "Using temp dir $SAUCE_TMP_DIR"
#!/bin/bash
# Setup and start Sauce Connect for your TravisCI build
# This script requires your .travis.yml to include the following two private env variables:
# SAUCE_USERNAME
# SAUCE_ACCESS_KEY
# Follow the steps at https://saucelabs.com/opensource/travis to set that up.
#
# Curl and run this script as part of your .travis.yml before_script section:
# before_script:

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2

Results

###
# Allowable
#
# A pattern for decomposing large/long conditional chains
# into readable, testable, and inspectable segments.
# Code coverage stats can help show you which conditions
# aren't getting test coverage, and printing/prying around
# the code can show you intermediary condition results.
#
# Effectively a block-syntax for the `or` operator: each `when?`
@luxerama
luxerama / rename_rails3.rb
Created June 20, 2012 08:58 — forked from vertis/rename_rails3.rb
Simple script that can be used to rename a rails3 app
#!/usr/bin/env ruby
require 'fileutils'
require 'tempfile'
def replace_in_file(filename,oldvalue,newvalue)
temp_file = Tempfile.new(File.basename(filename))
contents = File.read(filename)
changed_contents = contents.gsub(oldvalue,newvalue).gsub(oldvalue.downcase,newvalue.downcase)
temp_file.print(changed_contents)
@luxerama
luxerama / capistrano_database_yml.rb
Created May 24, 2012 14:03 — forked from weppos/capistrano_database_yml.rb
Provides a couple of tasks for creating the database.yml configuration file dynamically when deploy:setup is run.
#
# = Capistrano database.yml task
#
# Provides a couple of tasks for creating the database.yml
# configuration file dynamically when deploy:setup is run.
#
# Category:: Capistrano
# Package:: Database
# Author:: Simone Carletti <[email protected]>
# Copyright:: 2007-2010 The Authors
@luxerama
luxerama / send_remote_syslog.php
Created May 13, 2012 21:06 — forked from troy/send_remote_syslog.php
Send UDP remote syslog message from PHP (RFC 3164)
<?php
function send_remote_syslog($message, $component = "web", $program = "next_big_thing") {
$msg = "<22>" . date('M j H:i:s ') . $program . ' ' . $component . ': ' . $message;
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
# replace these with settings provided by Papertrail
socket_sendto($sock, $msg, strlen($msg), 0, 'logs.papertrailapp.com', 1111);
socket_close($sock);
}
module Engine
def initialize
@engine_running = false
end
def start_engine
@engine_running = true
end
def stop_engine
@luxerama
luxerama / post.html
Created March 30, 2012 09:04 — forked from kenmazaika/post.html
Embed Gist In Tumblr, File By File
<div class="gist">
<a href=
"https://gist.github.com/1870642.js?file=resque.rake">https://gist.github.com/1870642.js?file=resque.rake</a>
</div>
edit: (params) ->
@set 'channel', Ems.Channel.find parseInt(params.id), (err) -> throw err if err
Ems.Category.load (err, categories) =>
throw err if err
@set 'categories', categories
console.log 'Categories returned: ', categories
# RETURNS:
#
# > Categories returned: [ Category, Category, Category ]