Skip to content

Instantly share code, notes, and snippets.

View cmckni3's full-sized avatar

Chris McKnight cmckni3

View GitHub Profile
@cmckni3
cmckni3 / angularjs.md
Last active February 24, 2016 00:29
Collection of interesting things
@cmckni3
cmckni3 / symfony_god.rb
Created February 3, 2016 16:39
Godrb script for monitoring a beanstalk worker process
# my custom monitoring configuration for applications other than rails
# This monitors a PHP beanstalk worker process
# run in non-daemonized mode (so you can monitor it) with `god -c /path/to/mysql.god -D`
# run normally with `god -c /path/to/mysql.god`
# the workers will have a name like such beanstalk-worker-app_directory ie beanstalk-worker-development
# Settings for email notifications (optional)
God::Contacts::Email.defaults do |d|
@cmckni3
cmckni3 / rails_logrotate.conf
Created February 3, 2016 16:38
Rails 3 logrotate
/home/deploy/APPNAME/current/log/*.log {
daily
missingok
rotate 7
compress
delaycompress
notifempty
copytruncate
}
@cmckni3
cmckni3 / test_openssl.rb
Created February 3, 2016 16:34
Ruby script to see if ruby has been compiled with openssl
#!/usr/bin/env ruby
require 'net/https'
https = Net::HTTP.new('encrypted.google.com', 443)
https.use_ssl = true
https.verify_mode = OpenSSL::SSL::VERIFY_PEER
https.request_get('/')
@cmckni3
cmckni3 / progressbar.cpp
Created February 3, 2016 16:21
progressbar.cpp
#include <iostream>
using namespace std;
int main()
{
int count = 0;
string temp = "";
while (count < 10)
{
@cmckni3
cmckni3 / version-detection.m
Last active August 29, 2015 14:06
Detect Mac OS X Version
NSDictionary *systemVersionDictionary = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"];
NSString *reqSysVer = @"10.7";
NSString *currSysVer;
currSysVer = [systemVersionDictionary objectForKey:@"ProductVersion"];
// For testing
// currSysVer = @"10.10";
if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending)
NSLog(@"Version requirement met");
else
NSLog(@"Version requirement not met");
@cmckni3
cmckni3 / speed.r
Last active August 29, 2015 14:04
speed <- 55
distance <- 2
speeds <- seq(54, 0)
h <- function(x) ceiling((distance / (speed - x)) * 3600)
g <- Vectorize(h)
times = g(speeds)
#import "canopy.js"
cacheControls();
verifyText('notclicked', "Not Clicked");
tap("clickme");
verifyText('notclicked', "Clicked");
describe('Model', function(){
it('something', function(done){
request('http://google.com', function(response){
console.log(response);
done();
})
});
});
require "#{File.dirname(__FILE__)}/../lib/transactions.rb"
include Transactions
def capture_stdout(&block)
original_stdout = $stdout
$stdout = fake = StringIO.new
begin
yield
ensure
$stdout = original_stdout