Skip to content

Instantly share code, notes, and snippets.

@bsy
bsy / newrelic_resque_agent.conf
Created February 12, 2014 21:11
Monit config to monitor newrelic_resque_agent without a PID file
check process newrelic_resque_agent
matching "newrelic_resque_agent"
start program = "/usr/bin/ruby /usr/bin/newrelic_resque_agent run"
stop program = "/usr/bin/killall newrelic_resque_agent"
if cpu usage > 95% for 10 cycles then restart
@bsy
bsy / gist:8964541
Last active August 29, 2015 13:56
boot2docker port forwarding
# Add to your .bash_profile
function dfwd {
VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port$1,tcp,127.0.0.1,$1,,$1"
}
function ddfwd {
VBoxManage modifyvm "boot2docker-vm" --natpf1 delete "tcp-port$1"
}
@bsy
bsy / gist:8153880
Created December 27, 2013 23:05 — forked from trcarden/gist:3295935
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@bsy
bsy / gist:8153872
Created December 27, 2013 23:03
show . files in Finder Mac OSX
defaults write com.apple.finder AppleShowAllFiles -bool YES
killall Finder
@bsy
bsy / gist:4732506
Last active December 12, 2015 06:49
Throttle specific ports on Mac OSX
# on
sudo ipfw pipe 1 config bw 150KByte/s
sudo ipfw add 1 pipe 1 src-port 80
# off
sudo ipfw delete 1
@bsy
bsy / gist:4506256
Last active December 10, 2015 22:59
We have an open position at Kabam for a mid-level Backend Engineer. You would be working on my game team - The Hobbit: Armies of the Third Age!
Some reasons to consider in addition to the stock and competitive salary reasons:
* Work on a modern technology stack (Node.js, Rails 3.2+, MySQL, Redis)
* We're agile and practice TDD in order to move fast and NOT break things :), continuous integration, and solid build processes
* Interesting technical problems to solve involving low-level socket programming, server infrastructure scaling, AI programming, and software design, among other things
* Work on a game that has the IP from one of the largest fantasy franchises in history, The Hobbit!! And we've still got two more movies to go!
* Awesome team of talented, easy-to-work-with peers, very supportive management
* Healthy, profitable company who is a leader in Free to Play gaming across multiple platforms with plans for an IPO in the future
@bsy
bsy / gist:3160923
Created July 22, 2012 20:12
tmux cheat sheet
tmux -- terminal multiplexer
Managing tmux sessions:
$ tmux # start tmux server
$ tmux at # attach running sessions to a terminal
$ tmux ls # list running tmux sessions
Sharing sessions between terminals:
$ tmux new -s session_name # make new named session
$ tmux at -t session_name # attach to exist session (allowing shared sessions)
// change city
$(document).ready(function() {
// hides the slickbox as soon as the DOM is ready
// (a little sooner than page load)
var $altCity = $('#altCity');
var $altCity2 = $('#altCity2');
var $altCityHide = $('#altCityHide');
var $altCityShow = $('#altCityShow');
search = Sunspot.new_search(Business)
search.build do |s|
s.keywords "#{query} electronics"
s.order_by :name if order == :alpha
s.order_by :review_count, :desc if order == :review_count
s.order_by :stars, :desc if order == :rating
s.paginate :page => page, :per_page => per_page
end
search.query.add_component(OpenStruct.new(:to_params => { :mm => 1 }))
search.execute!
def nationwide_search
category_ids = self.category_ids
Business.search do |search|
search.any_of do
with :category_ids, category_ids unless category_ids.blank?
with :category_ids, nil
end
search.keywords query
search.order_by :name if order == :alpha
search.order_by :review_count, :desc if order == :review_count