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 'pty' | |
require 'optparse' | |
unless ENV['USER'].eql?("root") | |
puts "Must be run as root.\nFailed." | |
exit | |
end | |
options = {} |
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
require 'benchmark' | |
N_OPS = 100_000_000 | |
N_THREADS = 10 | |
BM_LABEL_WIDTH = 15 | |
def func(n_ops) | |
(1..n_ops).each { 1 + 1 } | |
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
before "newrelic:server_monitor:install", "newrelic:server_monitor:uninstall" | |
namespace :newrelic do | |
namespace :server_monitor do | |
task :install, :roles => :web do | |
run "curl -o ~/newrelic-sysmond-1.1.2.124-linux.tar.gz http://download.newrelic.com/server_monitor/release/newrelic-sysmond-1.1.2.124-linux.tar.gz" | |
run "tar xzvf ~/newrelic-sysmond-1.1.2.124-linux.tar.gz" | |
sudo "cp ~/newrelic-sysmond-1.1.2.124-linux/daemon/nrsysmond.x64 /usr/local/bin/nrsysmond" | |
sudo "cp ~/newrelic-sysmond-1.1.2.124-linux/scripts/nrsysmond-config /usr/local/bin" | |
sudo "mkdir -p /etc/newrelic /var/log/newrelic" | |
sudo "chmod 1777 /etc/newrelic /var/log/newrelic" |
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
## | |
# Bash customizations | |
## | |
export CLICOLOR=1 # Enable color shell | |
export LSCOLORS=ExFxCxDxBxegedabagacad # Define colors | |
export COLOR_RED="\e[0;31m" | |
export COLOR_PINK="\e[35;1m" | |
export COLOR_NORMAL="\e[m" |
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
command W w !sudo tee % > /dev/null |
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
1.9.2p290 :013 > render_erb("Hey, <%= first_name %> <%= last_name %>", :first_name => "James", :last_name => "Moriarty") | |
=> "Hey, James Moriarty" |
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
1.9.2p290 :083 > MyObject.configure do |config| | |
1.9.2p290 :084 > config.logger = STDOUT | |
1.9.2p290 :085?> end | |
=> MyObject | |
1.9.2p290 :190 > MyObject.new | |
=> #<MyObject:0x000001009ae268 @logger=#<IO:<STDOUT>>> | |
1.9.2p290 :191 > MyObject.new(:logger => nil) | |
=> #<MyObject:0x000001009a6928 @logger=nil> |
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 sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
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
class Vector2 | |
# A 2 coordinate vector. | |
# http://en.wikipedia.org/wiki/Coordinate_vector | |
# @param x The x coordinate of the vector | |
# @param y The y coordinate of the vector | |
constructor:(@x = 0, @y = 0) -> | |
# Add 2 vectors. | |
# @param vector A vector | |
# @return vector |
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
javascript:document.body.contentEditable='true'; document.designMode='on'; void 0 |
OlderNewer