Skip to content

Instantly share code, notes, and snippets.

View scottwb's full-sized avatar

Scott W. Bradley scottwb

View GitHub Profile
signature = ""
signature << "id=#{id}"
signature << "carrier=#{carrier}"
signature << "wireless_number=#{wireless_number}"
signature << "status=#{status}"
signature << "secret=#{PUBLICATION_SECRET}"
signature = Digest::SHA1.hexdigest(signature)
puts signature
@scottwb
scottwb / chef-errors.sh
Created August 31, 2012 18:39
Hosted Chef Errors
swb-mbp% knife cookbook upload apache2
Uploading apache2 [1.1.12]
/Users/scottwb/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/openssl/buffering.rb:174:in `sysread_nonblock': Connection reset by peer (Errno::ECONNRESET)
from /Users/scottwb/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/openssl/buffering.rb:174:in `read_nonblock'
from /Users/scottwb/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/protocol.rb:141:in `rbuf_fill'
from /Users/scottwb/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil'
from /Users/scottwb/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/protocol.rb:132:in `readline'
from /Users/scottwb/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:2562:in `read_status_line'
from /Users/scottwb/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:2551:in `read_new'
from /Users/scottwb/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:1319:in `block in transport_request'
{
"candidate" : {
// Required Fields
"firstName" : "Scott",
"lastName" : "Bradley",
"email" : "scottwb@example.com",
"currentPosition" : "VP of Engineering",
"currentCompany" : "Validas, LLC",
"location" : "Kirkland, WA",
"message" : "You should hire me because...", // markdown
{
// Required Fields
"firstName" : "Scott",
"lastName" : "Bradley",
"email" : "scottwb@example.com",
"currentPosition" : "VP of Engineering",
"currentCompany" : "Validas, LLC",
"location" : "Kirkland, WA",
"message" : "You should hire me because...", // markdown
"resume" : "http://...",
swb-mbp% curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d ' {"candidate":{"firstName":"Scott","lastName":"Bradley","email":"scottwb@validas.com","currentPosition":"VP of Engineering","currentCompany":"Validas, LLC","location":"Kirkland, WA","message":"You should hire me because...","resume":"http://....","position":"linux","twitter":"@scottwb69","github":"scottwb","website":"http://scottwb.com/","blog":"http://scottwb.com/","otherLink1":"http://foo.com/","otherLink2":"http://bar.com/","test":true}}' http://jobsapi.validas.com/candidates.json
* About to connect() to jobsapi.validas.com port 80 (#0)
* Trying 23.22.208.238... connected
* Connected to jobsapi.validas.com (23.22.208.238) port 80 (#0)
> POST /candidates.json HTTP/1.1
> User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5
> Host: jobsapi.validas.com
> Accept: application/json
> Content-type: application/json
> Content-Length: 444
wb-mbp% whereis gcc
/usr/bin/gcc
swb-mbp% gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
swb-mbp% /usr/bin/gcc-4.2 --version
i686-apple-darwin11-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
namespace :coffee do
task :compile, :filename do |t, args|
filename = args.filename
puts CoffeeScript.compile(File.open(filename))
end
end
@scottwb
scottwb / addthis_hack.js
Created June 10, 2012 15:40
Hack around URL hash conflicts between jQuery Mobile and AddThis
// Gracefully handle AddThis hashes with jQuery Mobile
$(function() {
if (window.location.hash != '') {
window.location.href = window.location.href.split('#')[0];
}
});
[root@ip-10-0-0-156 ~]# yum install dos2unix
Loaded plugins: fastestmirror, priorities, security, update-motd
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://repo.us-west-2.amazonaws.com/latest/main/mirror.list error was
12: Timeout on http://repo.us-west-2.amazonaws.com/latest/main/mirror.list: (28, 'connect() timed out!')
Could not retrieve mirrorlist http://repo.us-west-2.amazonaws.com/latest/updates/mirror.list error was
12: Timeout on http://repo.us-west-2.amazonaws.com/latest/updates/mirror.list: (28, 'connect() timed out!')
* amzn-main: packages.us-west-2.amazonaws.com
* amzn-updates: packages.us-west-2.amazonaws.com
http://packages.us-west-2.amazonaws.com/2012.03/main/24ff18fc5683/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://packages.us-west-2.amazonaws.com/2012.03/main/24ff18fc5683/x86_64/repodata/repomd.xml: (28, 'connect() timed out!')
@scottwb
scottwb / init.el
Created March 5, 2012 19:09
Make emacs store *~ backups files all in a single directory.
;;; Move the backup *~ files into a single backups directory instead of
;;; littering the filesystem with them. Also version the backups and only
;;; keep a finite number of backup versions.
;;;
;;; Read more, and get the required backup-dir.el here:
;;; http://www.emacswiki.org/emacs/BackupDirectory
;;;
(require 'backup-dir)
(make-variable-buffer-local 'backup-inhibited)
(setq bkup-backup-directory-info