Skip to content

Instantly share code, notes, and snippets.

View theaboutbox's full-sized avatar

Cameron Pope theaboutbox

View GitHub Profile
@theaboutbox
theaboutbox / test.yml
Created March 2, 2018 18:42
Ansible multi-line string
- name: Test multi-line string
hosts: localhost
connection: local
gather_facts: false
vars:
hello: world
tasks:
- name: Multi-line string with quotes and interpolation into shell command
shell: |
echo "Hello
@theaboutbox
theaboutbox / gist:68ec81d6e667577be4a5
Created November 11, 2014 18:47
dfu-util via machomebrew
brew install https://raw.githubusercontent.com/asparagui/homebrew/06491f798488f9b136590afd48ae994005a7de2f/Library/Formula/dfu-util.rb
def found_sequence?(grid, sequence, position, direction)
return true if sequence.size == 0
row,col = position
return false if [row,col].min < 0
return false if row >= grid.length
return false if col >= grid[row].length
return false if grid[row][col] != sequence[0]
dy,dx = direction
return found_sequence?(grid, sequence[1..-1],[row+dy,col+dx],direction)
end
Rubinius Crash Report #rbxcrashreport
Error: signal SIGSEGV
[[Backtrace]]
0 ruby 0x0000000107d2ffd0 _ZN8rubiniusL12segv_handlerEi + 544
1 libsystem_c.dylib 0x00007fff9104794a _sigtramp + 26
2 ??? 0x00007fff57ee5e00 0x0 + 140734668627456
3 ruby 0x0000000107ed12b9 _ZN8rubinius12ObjectWalker4nextEv + 39
4 ruby 0x0000000107e4b2ef _ZN8rubinius6System14vm_find_objectEPNS_5StateERNS_11GCTokenImplEPNS_5ArrayEPNS_6ObjectEPNS_9CallFrameE + 959
@theaboutbox
theaboutbox / .ackrc
Created September 20, 2012 21:49
My .ackrc
--type-add=css=.sass,.less,.scss
--type-add=ruby=.rake,.rsel,.builder,.thor
--type-add=html=.haml,.html.erb,.html.haml
--type-add=js=.js.erb,.coffee
--type-set=cucumber=.feature
--type-set=c=.c,.cpp,.ino,.pde,.h
--ignore-dir=vendor
--ignore-dir=log
--ignore-dir=tmp
--ignore-dir=doc
@theaboutbox
theaboutbox / pstore_file_test.rb
Created September 12, 2011 15:55
PStore File Encoding Issue
require 'pstore'
# Some code (like Rails) sets this so that strings are represented in Unicode
Encoding.default_internal = 'UTF-8'
# But if we do that, PStore randomly blows up
begin
print "Trying to store some values with PStore"
store = PStore.new('test.pstore')
(1..1000).each do |i|
@theaboutbox
theaboutbox / gist:1139677
Created August 11, 2011 13:39 — forked from gruber/gist:1063605
Simple Inbox Archiving Script for Apple Mail
-- See article here: http://daringfireball.net/2007/07/simple_inbox_sweeper
-- Minor modification to archive mail in sub-folders for each year
-- e.g. Archives/2011 for all mail archived in 2011
-- This mimics Thunderbird's "Archive" functionality
-- The following should be one long line:
set _description to "All unflagged, read messages in each IMAP account inbox will be moved to the “Archive” mailbox corresponding to that account. This action is not undoable."
tell application "Mail"
display alert "Archive read messages from IMAP inboxes?" buttons {"Cancel", "Archive"} cancel button 1 message _description
#!/usr/bin/ruby
#
# Author:: Adam Jacob (<adam@opscode.com>)
# Copyright:: Copyright (c) 2010 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
class MessageSender
def initialize
@conn = Stomp::Connection.open(USER,PASSWORD,HOST,PORT)
@conn.subscribe(Messaging::DESTINATION, { :ack =>"auto" })
end
def processing_loop
while true do
msg = @conn.receive
begin
@theaboutbox
theaboutbox / gist:147807
Created July 15, 2009 16:03
Modify FeedSmith plugin to work with Yahoo! Pipes
/* Modify the regex here to serve the raw feed data to Feedburner AND pipes
everyone else gets redirected to the Feedburner feed url */
if (!preg_match("/feedburner|feedvalidator|pipes/i", $_SERVER['HTTP_USER_AGENT'])) {
add_action('template_redirect', 'ol_feed_redirect');
add_action('init','ol_check_url');
}