This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
days_ago="$1" | |
counter=$days_ago | |
get_month(){ | |
if [ `uname` == "Darwin" ]; then | |
date -v-$1d "+%m" | |
else | |
date +"%m" --date='-$"$1" day' | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
### BEGIN INIT INFO | |
# Provides: jmeter-server | |
# Required-Start: $syslog $local_fs | |
# Required-Stop: $syslog $local_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Apache JMeter Remote Server | |
# Description: Apache JMeter Remote Server runs JMeter tests issued from a remote server. | |
### END INIT INFO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# truncate rails logs whenever they are larger than 40mb | |
# | |
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num] | |
/Users/Krauss/Projects/**/**/log/*.log Krauss:staff 644 0 40960 * G |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
BOOMR.init({ | |
beacon_url: "/boomerang.gif", | |
BW: { | |
enabled: false | |
} | |
}); | |
BOOMR.subscribe('before_beacon', trackInAnalytics); | |
var pageType = "homepage"; // customize this |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'pp' | |
require 'yaml' | |
homebrew_binaries = `brew ls`.split | |
applications = `\ls /Applications`.gsub(".app", "").split("\n") | |
node_packages = `npm -g ls --parseable --depth 0`.gsub("/usr/local/lib", "").gsub("/node_modules/", "").split | |
def cask_has_app?(app) | |
`brew cask search '#{app}'`["==> Exact match"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# -*- coding: utf-8 -*- | |
require 'rubygems' | |
class ObjectStash | |
def self.store obj, file_name | |
marshal_dump = Marshal.dump(obj) | |
file = File.new(file_name,'w') | |
file.write marshal_dump | |
file.close |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def mock_net(uri = nil) | |
net_get = double('net get').as_null_object | |
if uri | |
expect(Net::HTTP::Get).to receive(:new).with(uri.request_uri) { net_get } | |
else | |
Net::HTTP::Get.stub(:new) { net_get } | |
end | |
http = double('net http').as_null_object | |
response = double('response') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
print_pid = ARGV[0] | |
list = IO.popen('launchctl list').readlines | |
running = list.inject([]) do |result, line| | |
if line[/^[0-9]/] | |
if print_pid | |
result << line.sub(/\t0/, '') | |
else | |
result << line.sub(/\d+\t0\t/, '') | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Write a function f(a, b) which takes two character string arguments and returns | |
# a string containing only the characters found in both strings in the order of a. | |
# Write a version which is order N-squared and one which is order N. | |
string_a = "abcdefg" | |
string_b = "afcbedf" | |
def common_char_n_squared(string1, string2) | |
common_chars = "" | |
string1.each_char do |i| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/^[\w\-\.]+\@[\w\.\-]+\.\w{2,4}$/ | |
# matches | |
# bob@gmail.com | |
# bob@ccsf.mail.edu | |
# bob123@city.org | |
# bob-123@conf.org | |
# bob.frank@city.com | |
OlderNewer