Skip to content

Instantly share code, notes, and snippets.

View doyle's full-sized avatar

Christian Doyle doyle

View GitHub Profile
@doyle
doyle / port_sniff.rb
Created August 30, 2016 17:41
Searches all of the ip addresses in a range and prints out a message if a machine is found
(0..255).each do |i|
ip = "192.168.1.#{i}"
result = `ping -c 1 -W 5 #{ip}`
if result.match(/1 packets received/)
puts "something on #{ip}"
end
end
@doyle
doyle / commits.sh
Last active January 31, 2019 18:45
Creates a pretty printed summary of all commits for a year
git log --author="Christian Doyle" --after="2015-1-1" --before="2015-12-31" --date=short --no-merges --pretty=format:'%h was %an, %ad, message: %s' | tail -r > commits.txt
@doyle
doyle / git_archive.txt
Created April 28, 2015 14:47
Example usage of archiving a git repo to a tar file
git archive --format tar master | gzip -9 > foo.tar.gz

Twitter doesn't really provide me with the space to explain my issue so...

I have three apps all of which consume from a single service. I can easily think of 5 or so responsibilites of the service. In addition to this many endpoints are only used by one app. The code base is small (< 10k loc) and the responsibilites are well isolated. The team is also small and we only have a single ops.

My fear is that splitting the service into more granular services will create more work than its worth due to the ops overhead, need for client libraries, and other complexities that are introduced by using two completly isolated systems.

So what are some indicators that your service is too big and needs to be split up?

@doyle
doyle / DateConvert.m
Created February 18, 2014 02:05
Convert a NSAppleEventDescriptor to a NSDate
// Inspired by StefanK http://macscripter.net/profile.php?id=14351
- (NSDate *)dateFromEventDescriptor:(NSAppleEventDescriptor *)descriptor
{
NSDate *resultDate = nil;
OSStatus status;
CFAbsoluteTime absoluteTime;
LongDateTime longDateTime;
if ([descriptor descriptorType] == typeLongDateTime) {
[[descriptor data] getBytes:&longDateTime length:sizeof(longDateTime)];
status = UCConvertLongDateTimeToCFAbsoluteTime(longDateTime, &absoluteTime);
@doyle
doyle / things.sql
Created February 17, 2014 23:11
How to query record's from Cultured Code's Thing's sqlite database
select ZTITLE, date(ZSTOPPEDDATE, 'unixepoch', '+31 years') as completed from zthing where completed is not null group by completed;
@doyle
doyle / integration_options_request.rb
Created November 20, 2013 19:38
Add this to your test_helper to enable options requests in rails integration tests
module ActionDispatch::Integration::RequestHelpers
def options(path, parameters = nil, headers_or_env = nil)
process :options, path, parameters, headers_or_env
end
end
@doyle
doyle / active_record_stdout.rb
Created October 2, 2013 19:26
Demonstrates how to log active record to stdout in a rails console.
ActiveRecord::Base.logger = Logger.new(STDOUT)
reload!
@doyle
doyle / verbose
Created June 28, 2013 19:33
I'm tired of reading the terminal
#!/bin/sh
$@ > /tmp/verbose
say `cat /tmp/verbose`
// This gist demonstrates how to play a movie on the iPhone
// This code sample assumes you have a file called "Movie.m4v" in your Resources folder, and
// have /included the MediaPlayer Framework (/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/Frameworks/MediaPlayer.framework)
#import <MediaPlayer/MediaPlayer.h>
...
-(IBAction)playMovie:(id)sender{