This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<stdlib.h> | |
| #include<stdio.h> | |
| struct list_el { | |
| int val; | |
| struct list_el *next; | |
| }; | |
| typedef struct list_el item; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| # -*- coding: utf-8 -*- | |
| require 'rubygems' | |
| class BinaryTree | |
| attr_reader :root | |
| # Por padrão busca por root primeiro | |
| def search(value, node=@root) | |
| if node == nil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require 'rubygems' | |
| require 'hpricot' | |
| require 'open-uri' | |
| require 'cgi' | |
| cgi = CGI.new() # New CGI object | |
| puts "Content-type: text/html\n\n" | |
| puts "<h1>Procurando por #{cgi.params['q']}</h1>" | |
| doc = Hpricot(open("http://diariodonordeste.globo.com/classif/consultando.asp?Filtro=#{cgi.params['q']}&Operador=OU&Filtro2=")) | |
| doc.search(".anuncio").each do | anuncio | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Cache XML RPC calls | |
| # | |
| # Author:: Tiago Bastos (mailto:[email protected]). | |
| # Copyright:: Copyright 2008 Laverock von Schoultz, Gibraltar | |
| class XMLRPCCachedClient < XMLRPC::Client | |
| def call(method, *args) | |
| if ActionController::Base.perform_caching | |
| # Generate unique ley using method and argumets | |
| key = "xmlrpc:call:" + Digest::MD5.hexdigest("#{method}:#{args.to_s}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/perl | |
| # Thanks to http://lists.danga.com/pipermail/memcached/2003-October/000354.html | |
| use IO::Socket; | |
| my $socket = IO::Socket::INET->new( PeerAddr => $ARGV[0], | |
| PeerPort => $ARGV[1], | |
| Proto => "tcp", | |
| Type => SOCK_STREAM) | |
| or die($@); | |
| print $socket "stats\n"; | |
| $out = <$socket> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (custom-set-variables | |
| '(column-number-mode t) | |
| '(ecb-options-version "2.32") | |
| '(show-paren-mode t) | |
| '(speedbar-frame-parameters (quote ((minibuffer) (width . 20) (border-width . 0) (menu-bar-lines . 0) (tool-bar-lines . 0) (unsplittable . t) (set-background-color "black")))) | |
| '(transient-mark-mode t)) | |
| (setq load-path (cons "~/.emacs.d" load-path)) | |
| (setq load-path (cons "~/.emacs.d/rails" load-path)) | |
| (setq load-path (cons "~/.emacs.d/ruby-mode" load-path)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Rapidamente: | |
| Greenthreds usam sempre o mesmo core e devido a IO etc eles podem ficar bloqueados por muito tempo, os SPARC T2000 etc tem ótimos processadores para coisas como Java que usam threads nativas e por isso usam muito bem os cores (e tb a tecnologia de hyperthreding). Para usar mongrels, com testes que fizemos aqui, mesmo com alguns mongrels por core a resposta ainda fica bem mais lenta do que se compararmos com as respostas de uma arquitetura x86. O processador da SUN é otimizado para múltiplas threads e não para processos singlethread como o mongrel. | |
| Bem, então para tirar proveito máximo, além de múltiplos processos, seria interessante múltiplas threads (ouvi alguém gritar no fundo, ERLANG?) | |
| Bem, esse foram os resultados que obtive aqui, nada muito científico, mais empírico mesmo. | |
| Problema semelhante com Mysql: | |
| Link: http://www.mysqlperformanceblog.com/2008/05/01/t2000-cpu-performance-watch-out/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Customize your jira address | |
| // Based on apidock.org Ubiquity Search: http://gist.github.com/8132 | |
| CmdUtils.CreateCommand( | |
| { | |
| name: "jira", | |
| takes: {"function": noun_arb_text}, | |
| icon: "http://www.atlassian.com/favicon.ico", | |
| homepage: "http://tiago.zusee.com", | |
| author: {name: "Tiago Bastos", email: "[email protected]"}, | |
| license: "MPL,GPL", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| # See: http://jira4r.rubyhaus.org/ | |
| require 'rubygems' | |
| require 'jira4r/jira4r' | |
| URL ='http://jira.server.com' | |
| FILTER = '10255' # Set your filter ID | |
| LOGIN = 'user' | |
| PASSWORD = 'passwd' | |
| LOG_OUT = 'jira4r.log' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/local/bin/ruby | |
| #Just a joke! | |
| require "socket" | |
| # Don't allow use of "tainted" data by potentially dangerous operations | |
| $SAFE=1 | |
| NICK_REGEX = "[a-zA-Z][a-zA-Z0-9\\-_\\[\\]\\{\\}\\\\|`\\^]+" | |