Skip to content

Instantly share code, notes, and snippets.

View davidcelis's full-sized avatar
Verified account

David Celis davidcelis

Verified account
View GitHub Profile
<Zybl0re> get up
<Zybl0re> get on up
<Zybl0re> get up
<Zybl0re> get on up
<phxl|paper> and DANCE
* nmp3bot dances :D-<
* nmp3bot dances :D|-<
* nmp3bot dances :D/-<
<[SA]HatfulOfHollow> i'm going to become rich and famous after i invent a device that allows you to stab people in the face over the internet
d="`date +%y%m%d%H%M`"
myrealip="`wget www.whatismyip.com/automation/n09230945.asp -qO -`"
while read i; do
export http_proxy="http://$i" && \
retip="`wget www.whatismyip.com/automation/n09230945.asp -qO -`" && \
[ "$retip" != "$myrealip" ] && echo "$i" >> working$d &
done
$(document).ready(function(){
$(".tweet").tweet({
username: "#{@portfolio.twitter_feed}",
join_text: "auto",
avatar_size: 32,
count: 3,
auto_join_text_default: "we said,",
auto_join_text_ed: "we",
auto_join_text_ing: "we were",
auto_join_text_reply: "we replied to",
@davidcelis
davidcelis / redis.conf
Created June 26, 2011 20:06
redis.conf
daemonize yes
pidfile /var/run/redis.pid
logfile /var/log/redis.log
port 6379
bind 127.0.0.1
timeout 300
loglevel notice
Processing PortfoliosController#update (for 127.0.0.1 at 2011-06-29 16:58:05) [PUT]
Parameters: {"name"=>"deck_monitoring", "portfolio"=>{"dashboards"=>{"1"=>"1"}, "name"=>"deck_monitoring", "use_all_dashboards"=>"0", "title"=>"", "background"=>#<File:/var/folders/CQ/CQsjgUNUEtWjUF3kjP8ek++++TI/-Tmp-/RackMultipart20110629-21662-76ykv0-0>, "logo"=>#<File:/var/folders/CQ/CQsjgUNUEtWjUF3kjP8ek++++TI/-Tmp-/RackMultipart20110629-21662-1b245l2-0>, "enabled"=>"1", "twitter_feed"=>"davidcelis"}, "commit"=>"Save", "authenticity_token"=>"tLZo2l/JC0do1FyFtHjbyEgJc+/BM58hyZjcghi72s4="}
User Columns (3.2ms) SHOW FIELDS FROM `users`
User Load (0.3ms) SELECT * FROM `users` WHERE (`users`.`id` = 1475)
Portfolio Columns (2.3ms) SHOW FIELDS FROM `portfolios`
Portfolio Load (0.2ms) SELECT * FROM `portfolios` WHERE (`portfolios`.`name` = 'deck_monitoring') LIMIT 1
Company Columns (2.9ms) SHOW FIELDS FROM `companies`
Company Load (0.2ms) SELECT * FROM `companies` WHERE (`companies`.`id` = 1)
CACHE (0
@davidcelis
davidcelis / .zshrc
Created July 22, 2011 19:21
To make zsh behave like bash and preserve current working directory when opening a new shell
# Auto-restore paths on launch
if [ $(uname) = "Darwin" ]; then
precmd () { print -Pn "\e]7;file://%M${PWD// /%%20}\a" }
fi
class MyModel < ActiveRecord::Base
belongs_to :another_model
end
class AnotherModel < ActiveRecord::Base
has_one :my_model
end
my_model.another_model
# => AnotherModel.find(my_model.another_model_id)
require 'rubygems'
require 'time'
require 'fileutils'
desc 'generate edi reports'
task :edi_reports => :environment do
MONTHS_AGO = 0 # 0 is last month/current report
BASE_PATH = '/tmp/'
sdge_sums = {}
Processing SystemsController#delegate_data_key (for 173.12.191.149 at 2011-09-20 16:11:27) [POST]
Parameters: {"delegate_to"=>"5934", "id"=>"5481"}
Deadlock detected on retry 1, restarting transaction
Deadlock detected on retry 2, restarting transaction
Deadlock detected on retry 3, restarting transaction
Deadlock detected on retry 4, restarting transaction
Deadlock detected on retry 5, restarting transaction
Deadlock detected on retry 6, restarting transaction
Deadlock detected on retry 7, restarting transaction
Deadlock detected on retry 8, restarting transaction
@davidcelis
davidcelis / not_right.rb
Created September 29, 2011 17:59
why is this wrong
require "nokogiri"
xml = Nokogiri::XML(File.open("some_shit.xml"))
xml.at_css("xmldata")
# => nil
xml.xpath("//soap12:Envelope")
# => works, returns element and children