Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# --- Version history ---
# 0.4: added variable to store file path, and $2 for base file name
# added variable to store desired reporting interval
# 0.3: added $1 to send in process ID at run time.
# 0.2: switched to $SECONDS for the loop. works.
# 0.1: didn't work well at all.
# --- Version history ---
# Usage: cputrack [PID] [filename]
SQL (0.6ms) INSERT INTO `events` (`action`, `author_id`, `created_at`, `data`, `project_id`, `target_id`, `target_type`, `title`, `updated_at`) VALUES (6, 1, '2013-01-28 16:16:34', NULL, 1, 301, 'Note', NULL, '2013-01-28 16:16:34')
(9.6ms) COMMIT
NoMethodError - undefined method `[]' for nil:NilClass:
lib/api/entities.rb:97:in `block in <class:Note>'
(gem) grape-0.2.2/lib/grape/entity.rb:343:in `call'
(gem) grape-0.2.2/lib/grape/entity.rb:343:in `value_for'
(gem) grape-0.2.2/lib/grape/entity.rb:317:in `block in serializable_hash'
(gem) grape-0.2.2/lib/grape/entity.rb:315:in `each'
(gem) grape-0.2.2/lib/grape/entity.rb:315:in `inject'
[15:44] == androwis [80979601@gateway/web/freenode/ip.128.151.150.1] has joined #macruby
[15:45] == sohocoke [[email protected]] has joined #macruby
[15:46] <androwis> hey everyone
[15:46] <androwis> I had a question re: frameworks written in objective-c such as Rebel from Github, TwUI from Twitter, etc.
[15:47] <androwis> often times they're using ARC and when you include them, XCode doesn't appreciate it, and breaks on garbage collection
[15:47] <androwis> anyone know how to solve that?
[15:51] <jballanc> write a garbage collector for MacRuby ;-)
[15:51] <jballanc> androwis: unfortunately, unless you can get a hold of the source code and compile it with -fobjc-gc on your own, there's not much you can do
[15:52] <androwis> hah
[15:53] <androwis> jballanc: do you build frameworks in XCode w/ the Build command?
@androwis
androwis / Instance-Class-Singletons
Created December 4, 2012 20:05
Instance v. Class Variable Approaches to Singletons
## Instance Variable Approach
module Singleton
def self.included( clazz )
clazz.module_eval {
private_class_method :new
def self.instance
@instance = new unless @instance
@instance
end
require 'test/unit'
require '../Hacking/unix-crypt/lib/unix_crypt'
# Read in the passwords
passwords_to_crack = Hash.new
file= File.new("password11_cipher.txt")
while(line=file.gets)
a = line.split
passwords_to_crack[a[0]]=a[1]
end
@androwis
androwis / gist:2115350
Created March 19, 2012 14:59
rails problem
Fetching gem metadata from https://rubygems.org/./Users/androwis/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:799: [BUG] Segmentation fault
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0]
-- Control frame information -----------------------------------------------
c:0039 p:---- s:0215 b:0215 l:000214 d:000214 CFUNC :connect
c:0038 p:0011 s:0212 b:0212 l:0012d0 d:000211 BLOCK /Users/androwis/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:799
c:0037 p:0031 s:0210 b:0210 l:000209 d:000209 METHOD /Users/androwis/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/timeout.rb:54
c:0036 p:0026 s:0198 b:0198 l:000197 d:000197 METHOD /Users/androwis/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/timeout.rb:99
c:0035 p:0485 s:0192 b:0192 l:0012d0 d:0012d0 METHOD /Users/androwis/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:799
c:0034 p:0011 s:0184 b:0184 l:000183 d:000183 METHOD /Users/androwis/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:755
@androwis
androwis / setup-statsd.sh
Created March 17, 2012 22:50 — forked from jasonroelofs/setup-statsd.sh
Turn an Ubuntu 10.10 EC2 into a StatsD/Graphite server
# install git
sudo apt-get install g++ curl libssl-dev apache2-utils
sudo apt-get install git-core
# download the Node source, compile and install it
git clone https://github.com/joyent/node.git
cd node
./configure
make
sudo make install
# install the Node package manager for later use
[11:36] <@theterg> that wont help us keep an IP address on each interface, but it would be used to roll over between multiple interfaces
[11:36] <@theterg> sadly, not an incredibly easy/simple solution...
[11:42] <@theterg> Actually, it might be simpler to skip that and just set up multiple default gateways using route: http://linux.die.net/man/8/route
[11:42] <@theterg> (with different metrics)