Skip to content

Instantly share code, notes, and snippets.

View claymcleod's full-sized avatar
🧬

Clay McLeod claymcleod

🧬
View GitHub Profile
// Title: Sending Keystrokes
// Authors: Clay McLeod
// Description: An example of how to send keystrokes to a window
// Section: Objective-C
// Subsection: System Events
#import "Keystrokes.h"
@implementation Keystrokes
//
// Application.h
//
// The MIT License (MIT)
//
// Copyright (c) 2014 Clay McLeod. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
@claymcleod
claymcleod / PRKeystrokeFile.m
Created August 28, 2014 05:40
Keystroke Profile
//
// PRKeystrokeProfile.m
//
// The MIT License (MIT)
//
// Copyright (c) 2014 Clay McLeod. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
#!/usr/bin/python
# Title: Reddit Data Mining Script
# Authors: Clay McLeod
# Description: This script mines JSON data
# from the Reddit front page and stores it
# as a CSV file for analysis.
# Section: Python
# Subsection: Data Science
want=["domain", "subreddit", "subreddit_id" "id", "author", "score", "over_18", "downs", "created_utc", "ups", "num_comments"]
#!/usr/bin/python
import os
import csv
import math
import datetime
from optparse import OptionParser
TIME_FORMAT = '%Y,%m,%d,%H,%M,%S'
TIME_HEADERS = 'year,month,day,hour,minute,second'
# Title: Max subarray
# Authors: Clay McLeod
# Description: Finds the max subarray of an array of integers, in O(nlogn) time
# Section: Python
# Subsection: Interesting Problems
#
# Problem description - http://en.wikipedia.org/wiki/Maximum_subarray_problem
import sys
-----------------------------------------------------------------------
--
-- Haskell: The Craft of Functional Programming, 3e
-- Simon Thompson
-- (c) Addison-Wesley, 1996-2011.
--
-- Chapter 12, Section 3: Recognizing Regular Expressions
--
------------------------------------------------------------------------
# Title: Sort nuts and bolts
# Authors: Clay McLeod
# Description: Solving the classic sorting of nuts and bolts problem.
# Section: Python
# Subsection: Interesting Problems
#
# Problem description: http://www.geeksforgeeks.org/nuts-bolts-problem-lock-key-problem/
import sys
import random
% Credit
% Understanding how to plot the United Stats map (no help was received from this page on the simulated annealing):
% - http://www.mathworks.com/help/optim/ug/travelling-salesman-problem.html
%
% ---- Initial variable setup ----
clear all;
temp = 100;
cooling_rate = 0.01;
# Title: Edit Distance
# Authors: Clay McLeod
# Description: Python edit distance problem
# Section: Python
# Subsection: Interesting Problems
import sys
from tabulate import tabulate