Skip to content

Instantly share code, notes, and snippets.

View marccampbell's full-sized avatar

Marc Campbell marccampbell

View GitHub Profile
@marccampbell
marccampbell / keybase.md
Created May 26, 2015 20:34
Keybase Proof

Keybase proof

I hereby claim:

  • I am marccampbell on github.
  • I am marccampbell (https://keybase.io/marccampbell) on keybase.
  • I have a public key whose fingerprint is E810 90CB 02AA A471 49ED 1394 F774 1FA7 D8F4 540A

To claim this, I am signing this object:

%%
%% run this from the console with the following command:
%%
%% eunit:test({timeout, 60, mnesia_performance_tests}).
%%
-module(mnesia_performance_tests).
-author('marc.e.campbell@gamil.com').
@marccampbell
marccampbell / joyent-smartos.erb
Created August 22, 2012 22:15 — forked from benjaminws/joyent-smartos.erb
joyent-smartos.erb
# shove this in ~/.chef/bootstrap/joyent-smartos.erb
# run knife bootstrap <hostname> -d joyent-smartos
bash -c '
if [ ! -f /opt/local/bin/chef-client ]; then
cd /tmp
sudo pkgin -y install gcc-compiler gcc-runtime gcc-tools-0 ruby19 scmgit-base scmgit-docs gmake
wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.10.tgz
tar -xzf rubygems-1.8.10.tgz
cd rubygems-1.8.10
@marccampbell
marccampbell / joyent-smartos.erb
Created August 22, 2012 22:14 — forked from benjaminws/joyent-smartos.erb
joyent-smartos.erb
# shove this in ~/.chef/bootstrap/joyent-smartos.erb
# run knife bootstrap <hostname> -d joyent-smartos
bash -c '
if [ ! -f /opt/local/bin/chef-client ]; then
cd /tmp
pkgin install gcc-compiler gcc-runtime gcc-tools-0 ruby19 scmgit-base scmgit-docs gmake sun-jdk6
wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.10.tgz
tar -xzf rubygems-1.8.10.tgz
cd rubygems-1.8.10
@marccampbell
marccampbell / private_addr.erl
Created January 30, 2012 23:56
Get Private IP Address
{ok, Interfaces} = inet:getifaddrs(),
Addresses = lists:map(fun({_, Props}) -> proplists:get_all_values(addr, Props) end, Interfaces),
Private_Addresses = lists:filter(fun({F,_,_,_}) -> lists:member(F, [10, 172, 192]); (_) -> false end, lists:flatten(Addresses)),
io:format("Private Addresses = ~p\n", [Private_Addresses]),
case Private_Addresses of
[] -> io:format("Unable to start monitor listener, no private address was found.\n", []),
undefined;
_ -> {A, B, C, D} = lists:nth(1, Private_Addresses),
IP_Address = lists:flatten(io_lib:format("~.10B.~.10B.~.10B.~.10B", [A, B, C, D])),
io:format("Starting listener on ~s\n", [IP_Address]),
@marccampbell
marccampbell / delegates.m
Created December 19, 2011 19:25
LookIO iOS Delegate Implementation
[[LIOLookIOManager sharedLookIOManager] performSetupWithDelegate:aDelegate];
// Delegate protocol
@protocol LIOLookIOManagerDelegate
- (UIWindow *)lookIOManangerMainWindowForHostApp:(LIOLookIOManager *)aManager;
- (void)lookIOManager:(LIOLookIOManager *)aManager didUpdateEnabledStatus:(BOOL)lookioIsEnabled;
- (BOOL)lookIOManager:(LIOLookIOManager *)aManager shouldRotateToInterfaceOrientation:(UIInterfaceOrientation)anOrientation;
@end
@marccampbell
marccampbell / ios_advanced.m
Created September 27, 2011 21:36
Look.IO Advanced iOS Features
[[LIOLookIOManager sharedLookIOManager]setUsesControlButton:NO];
@marccampbell
marccampbell / ios_basic.m
Created September 27, 2011 21:28
Look.IO Basic iOS Inegeration
- (void)helpButtonWasTapped {
[[LIOLookIOManager sharedLookIOManager] beginSession];
}
var mongoose = require('mongoose');
function Account() {
this.isValid = false;
this.fields = {};
var AccountData = new mongoose.Schema({
createdOn:{type:Date, required:true},
email:{type:String},
phone:{type:String},
@marccampbell
marccampbell / create_alert.py
Created July 28, 2011 21:49
Pager.io API Example: Create Alert
import urllib, urllib2, base64
team_name = 'My Pager.io Team Name'
api_key = 'My Pager.io API Key'
alert_subject = 'Test Alert'
alert_message = 'This is where you would put a longer alert message'
data = {'subject': alert_subject, 'message': alert_message}
base64string = base64.encodestring('%s:%s' % (team_name, api_key)).replace('\n', '')