gem 'tire'ENV['ELASTICSEARCH_URL'] = ENV['BONSAI_URL']| // See http://www.fanjita.org/serendipity/archives/53-Interfacing-with-radio-controlled-mains-sockets-part-2.html | |
| #define PAYLOAD_SIZE 48 | |
| #define DATA_PIN A4 | |
| #define VCC_PIN A5 | |
| #define GND_PIN A3 | |
| #define LED_PIN 13 |
Just install this in your apps like so:
gem 'test-spec-mini', :git => 'git://gist.github.com/1806986.git', :require => 'mini'
| # Knife Configuration File. | |
| # | |
| # This is a Ruby DSL to set configuration parameters for Knife's | |
| # general options. The default location for this file is | |
| # ~/.chef/knife.rb. If multiple Chef repositories are used, | |
| # per-repository configuration files can be created. A per repository | |
| # configuration file must be .chef/knife.rb in the base directory of | |
| # the Chef repository. For example, | |
| # | |
| # ~/Development/chef-repo/.chef/knife.rb |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
| class PeopleController < ApplicationController | |
| before_filter :authenticate_user!, :except => [:index, :show] | |
| ... | |
| end |
| require 'fog' | |
| require 'net/ssh' | |
| require 'net/scp' | |
| def upload_file(host, user, password, source, dest, print_progress = true) | |
| Net::SSH.start(host, user, :password => password) do |ssh| | |
| puts "Uploading file... (#{File.basename(source)})" | |
| ssh.scp.upload!(source, dest) do |ch, name, sent, total| | |
| if print_progress |
| module ApiPageHelper | |
| PAGINATE_OPTIONS = { | |
| :default_page_size => 10 | |
| } | |
| PAGINATE_PARAMS = [ "page", "offset", "size" ] | |
| def paginate(coll, options = {}) | |
| options = PAGINATE_OPTIONS.merge(options) | |
| if params[:page] | |
| page = params[:page].to_i | |
| size = (params[:size] || options[:default_page_size]).to_i |
| unsigned long getNtpTime() { | |
| unsigned long timeFromNTP; | |
| const unsigned long seventy_years = 2208988800UL; | |
| ether.ntpRequest(ntpServer, ntpMyPort); | |
| Serial.println("NTP request sent"); | |
| while(true) { | |
| word length = ether.packetReceive(); | |
| ether.packetLoop(length); | |
| if(length > 0 && ether.ntpProcessAnswer(&timeFromNTP,ntpMyPort)) { |
| #!/bin/bash | |
| ## in .bash_profile | |
| SSHAGENT=`which ssh-agent` | |
| SSHAGENTARGS="-s" | |
| if [ -z "$SSH_AUTH_SOCK" -a -x "$SSHAGENT" ]; then | |
| eval `$SSHAGENT $SSHAGENTARGS` | |
| trap "kill $SSH_AGENT_PID" 0 | |
| fi |