Skip to content

Instantly share code, notes, and snippets.

@jrr
jrr / Single Gremlin Query from CLI.md
Last active Feb 3, 2021
Single gremlin query from command line.md
View Single Gremlin Query from CLI.md

I was looking for the easiest way to execute a single gremlin query from the command line, and cobbled this together using the gremlin console:

To use:

  • docker-compose up to fire up a local Tinkerpop
  • ./gremlin.query.sh host "query"

Example:

> ./gremlin-query.sh localhost "g.addV('foobar')"
WARNING: An illegal reflective access operation has occurred
@jrr
jrr / backup-remote-db.sh
Last active Nov 12, 2020
Postgres clone
View backup-remote-db.sh
#! /usr/bin/env bash
if [[ -z "${DB_PASSWORD}" ]]; then
echo "Please set a DB_PASSWORD environment variable in order to connect to the RDS Database."
echo "You may be able to retrieve it with:"
echo " aws secretsmanager get-secret-value --secret-id arn:aws:secretsmanager:xx:xx:xx:xx"
exit 1
fi
if [[ -z "${DB_SSH_KEY}" ]]; then
View patch-edid.rb
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
@jrr
jrr / vsts-foobar-path.bat
Created Jun 21, 2017
find an executable from a VSTS build task
View vsts-foobar-path.bat
@echo off
Powershell.exe -executionpolicy remotesigned -File "%~dp0\vsts-foobar-path.ps1"
set /p foobarPath=< foobar-path.txt
PATH=%PATH%;%foobarPath%
@jrr
jrr / controllers.application.js
Last active May 8, 2021 — forked from samselikoff/controllers.application.js
Mirage associated serializer?
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
_observeModel: Ember.observer('model', function(){
//console.log('model is',this.get('model'));
})
});
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
_observeModel: Ember.observer('model', function(){
//console.log('model is',this.get('model'));
})
});
@jrr
jrr / custom-qunit-assertions.js
Created Nov 10, 2016
custom qunit assertions
View custom-qunit-assertions.js
import QUnit from 'qunit';
QUnit.assert.contains = function( haystack, needle, message ) {
var result = haystack.indexOf(needle) > -1;
this.pushResult( {
result: result,
actual: haystack,
expected: needle,
message: message || `'${haystack}' contains string '${needle}'`
});
@jrr
jrr / smallcam.user.js
Last active May 11, 2020
Nest Cam Enhancements
View smallcam.user.js
// ==UserScript==
// @name Nest Cam Smallerizer
// @namespace https://github.com/jrr
// @version 0.2
// @description make camera more usable in small windows
// @author jrr
// @match https://home.nest.com/camera/*
// @match https://home.nest.com/home/*
// @grant none
// ==/UserScript==
View components.my-component.js
import Ember from 'ember';
export default Ember.Component.extend({
});
@jrr
jrr / EXPMatchers+equalInAnyOrder.h
Created Dec 21, 2014
Expecta NSArray-as-NSCountedSet matcher
View EXPMatchers+equalInAnyOrder.h
#import "Expecta.h"
EXPMatcherInterface(equalInAnyOrder, (id expected));
// 1st argument is the name of the matcher function
// 2nd argument is the list of arguments that may be passed in the function
// call.
// Multiple arguments are fine. (e.g. (int foo, float bar))