Skip to content

Instantly share code, notes, and snippets.

View flah00's full-sized avatar
🐛
space is the place

Philip Champon flah00

🐛
space is the place
View GitHub Profile
@flah00
flah00 / gist:776651
Created January 12, 2011 18:54
edit aspect haml error
ActionView::Template::Error (compile error
/usr/local/app/diaspora/app/views/aspects/edit.html.haml:13: syntax error, unexpected '}', expecting ')'
/usr/local/app/diaspora/app/views/aspects/edit.html.haml:14: unknown regexp option - h
/usr/local/app/diaspora/app/views/aspects/edit.html.haml:14: syntax error, unexpected tINTEGER, expecting ')'
));}\n</div>\n</h4>\n</div>\n<div class='person_...
^
/usr/local/app/diaspora/app/views/aspects/edit.html.haml:20: unknown regexp options - dv
/usr/local/app/diaspora/app/views/aspects/edit.html.haml:20: syntax error, unexpected $undefined
));}\n</div>\n";end;_hamlout.buffer << "<hr>\n";
^
@flah00
flah00 / SoulseekQt_2011-08-29-211039_flah.crash
Created August 30, 2011 12:19
adding a share folder, with 50gb+ of data, over nfs
Process: SoulseekQt [40277]
Path: /Applications/SoulseekQt.app/Contents/MacOS/SoulseekQt
Identifier: com.yourcompany.SoulseekQt
Version: ??? (???)
Code Type: X86 (Native)
Parent Process: launchd [193]
Date/Time: 2011-08-29 21:10:27.791 -0400
OS Version: Mac OS X 10.6.8 (10K549)
Report Version: 6

Made up of managers, Abstract Syntax Tree AST (nodes), visitors

  • Managers retain lists of nodes

    • Select, update, insert, delete
  • Managers provide access to visitors, which visit nodes and construct sql

  • AST defines various portions of the query

    • select, from/join, where, group, order, limit, offset
  • @user = User.arel_table@

  • @query = user.project('*')@

  • @query.to_sql@ == @SELECT * FROM "users"@

@flah00
flah00 / Gemfile.lock
Created August 13, 2012 21:39
DataMapper-1.3.0-beta vs ActiveRecord 3.2.8 for postgres
GIT
remote: https://github.com/datamapper/dm-migrations.git
revision: 8bfcec08286a12ceee1bc3e5a01da3b5b7d4a74d
branch: master
specs:
dm-migrations (1.3.0.beta)
dm-core (~> 1.3.0.beta)
GIT
remote: https://github.com/solnic/virtus
@flah00
flah00 / batches.rb
Created March 27, 2013 19:40
Rails `find_in_batches` solves a vary particular problem, by checking your model's primary keys. If your primary key is never repeated you can use it with ease. If, on the other hand, your primary key repeats, you've got a problem on your hands... You can go from the other side of the relationship or you can brute force it...
module ActiveRecord
module Batches
def brute_batch(options={})
options.reverse_merge!(batch_size: 1000, offset: 0)
offset = options[:offset].to_i
while true do
results = offset(offset).limit(options[:batch_size])
offset += results.count
yield results
@flah00
flah00 / log.log
Created September 25, 2013 16:08
wal-e error on secondary, after pulling down a basebackup from a pg_dump/pg_restore
2013-09-25 05:46:27 UTC FATAL: the database system is starting up
Traceback (most recent call last):
lzop: <stdin>: not a lzop file
File "/usr/local/lib/python2.7/dist-packages/gevent/greenlet.py", line 390, in run
result = self._run(*self.args, **self.kwargs)
File "/usr/local/lib/python2.7/dist-packages/wal_e/worker/s3_worker.py", line 260, in write_and_close_thread
key.get_contents_to_file(stream)
File "/usr/lib/python2.7/dist-packages/boto/s3/key.py", line 1226, in get_contents_to_file
response_headers=response_headers)
File "/usr/lib/python2.7/dist-packages/boto/s3/key.py", line 1102, in get_file
@flah00
flah00 / another-jmx.yaml
Last active January 4, 2016 01:19
jmx.yaml
instances:
- host: localhost
port: 54321
name: aname
user: u
password: p
conf:
- include:
domain: java.lang
bean: java.lang:type=Runtime
name "java-management"
description "java-management configuration"
run_list(*%w[
recipe[java]
recipe[java-management::management]
recipe[datadog::jmx]
])
default_attributes(
java: {
install_flavor: 'oracle',
From monit@example-host Tue Jul 8 17:34:18 2014
Return-Path: <monit@example-host>
X-Original-To: root@localhost
Delivered-To: root@localhost
Received: from example-host (localhost [127.0.0.1])
by example-host (Postfix) with SMTP id 59B69A26BE
for <root@localhost>; Tue, 8 Jul 2014 17:34:18 +0000 (UTC)
From: monit@example-host
To: root@localhost
Subject: chef-client Exists
@flah00
flah00 / kernel panic
Created December 9, 2014 20:00
civbe
Anonymous UUID: 0AB1D191-F0A2-DDB8-AE74-96DDDF396F6E
Tue Dec 9 14:46:35 2014
panic(cpu 1 caller 0xffffff7f9d4e9f7c): "GPU Panic: [<None>] 5 3 7f 0 0 0 0 3 : NVRM[0/1:0:0]: Read Error 0x00000100: CFG 0xffffffff 0xffffffff 0xffffffff, BAR0 0xd2000000 0xffffff8137576000 0x0a5480a2, D0, P3/4\n"@/SourceCache/AppleGraphicsControl/AppleGraphicsControl-3.6.22/src/AppleMuxControl/kext/GPUPanic.cpp:127
Backtrace (CPU 1), Frame : Return Address
0xffffff8125692e50 : 0xffffff801b222f79
0xffffff8125692ed0 : 0xffffff7f9d4e9f7c
0xffffff8125692fa0 : 0xffffff7f9be8ff1b
0xffffff8125693060 : 0xffffff7f9bf5950a
0xffffff81256930a0 : 0xffffff7f9bf5957a