Skip to content

Instantly share code, notes, and snippets.

View tsabat's full-sized avatar

Tim Sabat tsabat

View GitHub Profile
@tsabat
tsabat / explain.md
Created December 19, 2012 22:40 — forked from anonymous/explain.md

so, for the below script, we store the values in a text file that we read into mysql.

we then have 1000 unique URLs per row in a table, separated by a colon. We read and split one row at a time into a redis set, then pop values off the set whenever we need a new url. When the set is empty, we read the next row from mysql into the set.

The only thing to look out for is your collation in the db. A lookup is utf8_ci (case-insnsitive) for queries unless you set your collation to utf8_bin

collation-server = utf8_bin
init-connect='SET NAMES utf8'
init_connect='SET collation_connection = utf8_bin'
{
"pip_freeze": {
"pyobjc-framework-WebKit": "2.3.2a0",
"pyobjc-framework-Cocoa": "2.3.2a0",
"supervisor": "3.0a12",
"Flask": "0.8",
"zope.interface": "3.5.1",
"distribute": "0.6.25",
"Twisted": "11.0.0",
"pyobjc-framework-Automator": "2.3.2a0",
{"BillWeb": {"branches": {"hotfix-20120507": {"commits": [{"date": "2012-05-03T12:46:12-07:00", "message": "bump version", "author": "[email protected]"}, {"date": "2012-05-03T12:51:33-07:00", "message": "Merge remote-tracking branch 'dm/hotfix-20120507' into hotfix-20120507", "author": "[email protected]"}, {"date": "2012-05-03T12:50:57-07:00", "message": "Add some fancy tracing logic to debug", "author": "[email protected]"}, {"date": "2012-05-03T07:57:13-07:00", "message": "bump version", "author": "[email protected]"}, {"date": "2012-04-20T09:53:02-07:00", "message": "BILLING-255; Surveymonkey Europe in paying with check. Fix issue with invoice checkouts crashing when the invoice goes missing from the system.", "author": "[email protected]"}, {"date": "2012-04-20T08:36:31-07:00", "message": "Billing-276; add Luxembourg VAT number", "author": "[email protected]"}, {"date": "2012-04-19T14:31:36-07:00", "message": "Merge branch 'stwopay' into gopio", "author": "chrisg@survey
{"BillWeb": {"branches": {"hotfix-20120507": {"commits": [{"date": "2012-05-03T12:46:12-07:00", "message": "bump version", "author": "[email protected]"}, {"date": "2012-05-03T12:51:33-07:00", "message": "Merge remote-tracking branch 'dm/hotfix-20120507' into hotfix-20120507", "author": "[email protected]"}, {"date": "2012-05-03T12:50:57-07:00", "message": "Add some fancy tracing logic to debug", "author": "[email protected]"}, {"date": "2012-05-03T07:57:13-07:00", "message": "bump version", "author": "[email protected]"}, {"date": "2012-04-20T09:53:02-07:00", "message": "BILLING-255; Surveymonkey Europe in paying with check. Fix issue with invoice checkouts crashing when the invoice goes missing from the system.", "author": "[email protected]"}, {"date": "2012-04-20T08:36:31-07:00", "message": "Billing-276; add Luxembourg VAT number", "author": "[email protected]"}, {"date": "2012-04-19T14:31:36-07:00", "message": "Merge branch 'stwopay' into gopio", "author": "chrisg@survey
@tsabat
tsabat / stuff.md
Last active December 10, 2015 16:18

Hey, let's not use concerns. They seem a bit messy. Guys i trust, like Ryan Bates and the guys from Code Climate, discourage them.

Instead, we can keep using service objects. To hear two guys' opinions on that, check out

The key to these refactors is an understanding of the autoload path and the require statement. Here's the gist:

  • add the services directory to the autoload path, even in production (i already did this)
Loaded user with username: tsabat
ERR value is not an integer or out of range
["/Users/timsabat/.rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis/client.rb:85:in `call'",
"/Users/timsabat/.rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis.rb:1428:in `block in zrevrange'",
"/Users/timsabat/.rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis.rb:36:in `block in synchronize'",
"/Users/timsabat/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'",
"/Users/timsabat/.rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis.rb:36:in `synchronize'",
"/Users/timsabat/.rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis.rb:1427:in `zrevrange'",
"/Users/timsabat/Sites/CPOR/cp/app/services/popularity_service.rb:17:in `random_popular_pen'",
System load: 0.11 Processes: 100
Usage of /: 6.7% of 98.43GB Users logged in: 1
Memory usage: 12% IP address for eth0: 10.244.137.26
Swap usage: 0%
sudo mkdir /vol/etc /vol/lib /vol/log
sudo mv /etc/mysql /vol/etc/
sudo mv /var/lib/mysql /vol/lib/
sudo mv /var/log/mysql /vol/log/
sudo mkdir /etc/mysql
sudo mkdir /var/lib/mysql
sudo mkdir /var/log/mysql
echo "/vol/etc/mysql /etc/mysql none bind" | sudo tee -a /etc/fstab
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
@tsabat
tsabat / stuff.sh
Last active December 13, 2015 18:38
total used free shared buffers cached
Mem: 7466 3834 3631 0 131 377
-/+ buffers/cache: 3326 4140
Swap: 0 0 0