Skip to content

Instantly share code, notes, and snippets.

View benbc's full-sized avatar

Ben Butler-Cole benbc

View GitHub Profile
@benbc
benbc / neo4j-wait.sh
Last active January 19, 2017 15:02
Example of using curl to wait for a Neo4j server to be up
#!/bin/bash
end="$((SECONDS+10))"
while true; do
[[ "200" = "$(curl --silent --write-out %{http_code} --output /dev/null http://localhost:7474)" ]] && break
[[ "${SECONDS}" -ge "${end}" ]] && exit 1
sleep 1
done

Keybase proof

I hereby claim:

  • I am benbc on github.
  • I am benbc (https://keybase.io/benbc) on keybase.
  • I have a public key whose fingerprint is 89A4 B2F8 4EC3 3B0D 30FC DF07 FBEC E51D 407E 308D

To claim this, I am signing this object:

@benbc
benbc / gist:8861033
Created February 7, 2014 11:25
S3/EC2 upload failure log
2014-02-07 10:18:23,914 - awscli.clidriver - DEBUG - CLI version: aws-cli/1.2.13 Python/2.7.5+ Linux/3.11.0-14-generic, botocore version: 0.33.0
2014-02-07 10:18:23,917 - botocore.service - DEBUG - Creating service object for: s3
2014-02-07 10:18:23,917 - botocore.base - DEBUG - Attempting to load: aws/s3
2014-02-07 10:18:23,945 - botocore.base - DEBUG - Found data file: /usr/local/lib/python2.7/dist-packages/botocore/data/aws/s3.json
2014-02-07 10:18:23,946 - botocore.hooks - DEBUG - Event service-data-loaded.s3: calling handler <function signature_overrides at 0x17eb488>
2014-02-07 10:18:23,946 - botocore.hooks - DEBUG - Event service-created: calling handler <function register_retries_for_service at 0x17eb2a8>
2014-02-07 10:18:23,946 - botocore.handlers - DEBUG - Registering retry handlers for service: Service(s3)
2014-02-07 10:18:23,946 - botocore.hooks - DEBUG - Event creating-endpoint.s3: calling handler <function maybe_switch_to_s3sigv4 at 0x17eb398>
2014-02-07 10:18:23,954 - botocore.vendored.requests
@benbc
benbc / userdata
Created October 4, 2011 11:44
Problem getting cloud-init part handler to run
Content-Type: multipart/mixed; boundary="===============1189832017=="
MIME-Version: 1.0
--===============1189832017==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="bootstrap.pp"
package {'tree': ensure => installed}
@benbc
benbc / name-chooser.html
Created September 5, 2011 20:44
Name chooser
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="button-dance.js"></script>
<div id="button-dance"/>
function convert(cards) {
cache = {}
each(cards, function(card) {
cache[card.format(card.formatters.ref)] = card
}
function lookup(cardReference) {
return cache[cardReference];
}
return function(card) {
return {
it('passes the new selection to onTypeSelected', function() {
var view = TDD.view(dom, { types: ['Meat'] }).bind();
expect(view).to(receive, 'onTypeSelected').with_args('Meat');
dom.find('.food-type option').attr('selected', 'selected');
dom.find('.food-type').change();
});
dependencies.
map { |d| d['hide']=true }.
group_by { |d| d['Dependency From'] }.
map { |group| group.first['hide']=false }.
flatten
# one of these examples fails, depending on the call order in #test
describe "it" do
before { @subject = mock }
before { @subject.stub!(:it) }
it "does 1" do
@subject.should_receive(:it).
and_return { |block| block.call.should ==1 }