Skip to content

Instantly share code, notes, and snippets.

View tommeier's full-sized avatar

Tom Meier tommeier

View GitHub Profile
@tommeier
tommeier / AppDelegate+Calabash.m
Last active October 28, 2015 01:09
Calabash Backdoor Workaround for missing shake gesture
//
// AppDelegate+Calabash.m
//
// Only loaded for calabash target (where preprocesser has CALABASH=1)
#import "AppDelegate+Calabash.h"
@implementation AppDelegate (Calabash)
- (NSString *)calabashBackdoor:(NSString *)command {
IFS=$'\n'
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}")
versionNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${PROJECT_DIR}/${INFOPLIST_FILE}")
PATH=${PATH}:/usr/local/bin
function checkFileExists () {
if [[ ! -e "$1" ]]; then
echo "Required file unable to be found: $1"
exit 1
fi
@tommeier
tommeier / boxen-buildkite-puppet.pp
Last active August 29, 2015 14:13
Boxen puppet commands for Buildkite agent install
class people::thing_with_buildbox {
$library_dir = "${home}/Library"
$launch_dir = "${library_dir}/LaunchAgents"
$plist_location = "${launch_dir}/io.buildbox.buildbox-agent.plist"
$buildbox_token = "YOUR_TOKEN"
$buildbox_install_dir = "${home}/.buildbox"
$buildbox_log_dir = "${buildbox_install_dir}/log"
$buildbox_bin_dir = "${buildbox_install_dir}/bin"
$plist_template_url = "https://github.com/buildbox/agent/blob/master/templates/launchd_local_with_gui.plist"
$agent_name = "canary"
@tommeier
tommeier / buildkite_start_template
Last active August 29, 2015 14:13
Buildkite start template file
#!/usr/bin/env bash
set -e
echo '--- autostarting buildkite agent'
your-install-location/bin/buildbox-agent \
--token 'your-agent-access-token' \
--name 'your-agent-name' \
your-agent-additional-args
@tommeier
tommeier / oclint-json-compilation-database-parallel
Created August 29, 2014 01:25
oclint-json-compilation-database with parallel execution
#!/usr/bin/env python
# Test run with parallel
import os
import platform
import json
import argparse
import re
import subprocess
import sys
require 'active_support/core_ext/kernel/reporting'
require 'monitor'
# Monkey patch silence_stream to be thread safe
# -> Pull request on Rails: https://github.com/rails/rails/pull/13139
# -> But this will allow us to continue to see log output when running specs
# -> It could be we just patch ActiveRecord::SessionStore that triggers the `.quietly` calls
# on logging the `find_session_id` calls.
module Kernel
# Silences any stream for the duration of the block.
@tommeier
tommeier / deadlocks_spec.rb
Last active August 29, 2015 13:57
Deadlock specs
require 'spec_helper'
describe 'deadlocks' do
describe "on login" do
it 'should allow multiple requests to login at same time' do
# Check original is ok
::Customer.find_by(id: customer_id).should be_blank
forks = []
@tommeier
tommeier / autorun-plexconnect.sh
Last active January 11, 2020 04:10
Plexconnect for Qnap (Intel - tested on 439 with Apple TV 3). Streaming media to Apple TV 3 from Qnap 439.
#!/bin/sh
# /share/MD0_DATA/.qpkg/autorun/autorun-plexconnect.sh
# chmod +x /share/MD0_DATA/.qpkg/autorun/autorun-plexconnect.sh
curl -L https://gist.github.com/tommeier/6255771/raw/update_plex_connect.sh | bash &
# Improve / Fix as many things in the code below
# Answers should be sent to hackademy@500tech.com
# Good luck
class User < ActiveRecord::Base
validates_presence_of :name, :email, :date_of_birth, :age_category
before_save do
age = (Time.now - date_of_birth).year
if age < 10 age_category = 'child'
@tommeier
tommeier / bundler.rb
Last active December 18, 2015 13:59
Append a gem dependency on installation of gem (example: RubyWMQ). The example being the dependency can only installed on deployed systems, and unable to install on development systems (ie: WMQ and developing on Mac)
require 'rubygems'
require 'bundler'
Bundler.module_eval do
def self.append_gem(gem_name, options = {})
return if gem_already_loaded?(gem_name, options[:version])
version = options[:version] || '*'
spec_path = Dir.glob("#{Gem.dir}/specifications/#{gem_name}-#{version}.gemspec").last
if spec_path.nil?