Skip to content

Instantly share code, notes, and snippets.

View jpemberthy's full-sized avatar

Juan Pemberthy jpemberthy

View GitHub Profile
neider@acoplet:/var/apps/yurani/current/log$ tail -10000 production.log | grep Started | awk '{print $5}' | uniq -c
4 181.134.2.179
1 95.168.172.156
1 190.84.155.89
1 95.168.172.156
1 190.254.54.208
1 181.133.184.109
1 190.254.54.208
1 190.67.57.190
1 37.59.18.46
# Basic tagging system for mongoid documents.
# jpemberthy 2010
#
# class User
# include Mongoid::Document
# include Mongoid::Document::Taggable
# end
#
# @user = User.new(:name => "Bobby")
# @user.tag_list = "awesome, slick, hefty"
@jpemberthy
jpemberthy / statsd.md
Last active June 4, 2018 00:58
StatsD + Graphite on Mavericks

StatsD + Graphite backend on Mavericks.

I highly recommend using virtualenv for this.

Create your env

mkdir statsd
virtualenv env
env/bin/activate
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0
def number_with_delimiter(number, delimiter=",", separator=".")
begin
parts = number.to_s.split('.')
parts[0].gsub!(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1#{delimiter}")
parts.join separator
rescue
number
end
end
Un pueblo incapaz de aburrirse con buena música, con libros, con cultura,
es un pueblo dispuesto a votar por cualquier disparate con tal de divertirse un rato.
jpemberthy@scarface /Applications/Hearthstone/Logs $ cd /Applications/Hearthstone/Logs/ && cat *.log | grep "tag=CONTROLLER"
D 21:51:39.0818390 GameState.DebugPrintPower() - tag=CONTROLLER value=1
D 21:51:39.0819940 GameState.DebugPrintPower() - tag=CONTROLLER value=2
D 21:51:39.0822530 GameState.DebugPrintPower() - tag=CONTROLLER value=1
D 21:51:39.0823240 GameState.DebugPrintPower() - tag=CONTROLLER value=1
D 21:51:39.0823820 GameState.DebugPrintPower() - tag=CONTROLLER value=1
D 21:51:39.0824420 GameState.DebugPrintPower() - tag=CONTROLLER value=1
D 21:51:39.0825020 GameState.DebugPrintPower() - tag=CONTROLLER value=1
D 21:51:39.0825590 GameState.DebugPrintPower() - tag=CONTROLLER value=1
D 21:51:39.0826190 GameState.DebugPrintPower() - tag=CONTROLLER value=1
59] /var/apps/yurani/shared/bundle/ruby/2.3.0/gems/activesupport-3.2.13/lib/active_support/duration.rb:107:in `method_missing'
** [out :: 159.203.126.159] :
** [out :: 159.203.126.159] undefined method `to_str' for 180:Fixnum
** [out :: 159.203.126.159] (
** [out :: 159.203.126.159] NoMethodError
** [out :: 159.203.126.159] )
** [out :: 159.203.126.159]
** [out :: 159.203.126.159] Did you mean? to_s
** [out :: 159.203.126.159]
** [out :: 159.203.126.159] to_r
{
id: 2651358,
username: "jpemberthy",
name: "Juan Pemberthy",
email: "jpemberthy@gmail.com",
location: "San Francisco and Medellin",
bio: "I work here!",
link: "http://juan.pemberthy.com",
avatar:
[
1 row in set
>> user == User.last
=> true
>> user.persisted?
=> true
>> user.valid?
=> true
>> user.registration_details
+---------+----------+----------------+--------------+----------+----------------+-------------+-------------------------+
| user_id | referrer | pageview_count | source | platform | authentication | ip_address | created_at |