This file contains 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 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 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 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 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
;; from http://dotfiles.org/~lwu/.emacs | |
; code copied from XEmacs's Options\Edit Init File menu code | |
(defun edit-dot-emacs () | |
"Edits the user's .emacs file" | |
(interactive) | |
(progn | |
(find-file (or user-init-file "~/.xemacs/custom.el")) | |
(or (eq major-mode (quote emacs-lisp-mode)) (emacs-lisp-mode)))) |
This file contains 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
;; From http://alohakun.blog7.fc2.com/blog-entry-929.html with small changes... | |
(require-extension xlib) | |
(let ((dpy (xopendisplay #f))) | |
(assert dpy) | |
(let ((root (xdefaultrootwindow dpy))) | |
(xgrabkey dpy XK_F1 MOD4MASK root 1 GRABMODEASYNC GRABMODEASYNC) | |
(xgrabbutton dpy 1 MOD4MASK root 1 BUTTONPRESSMASK GRABMODEASYNC GRABMODEASYNC NONE NONE) | |
(xgrabbutton dpy 3 MOD4MASK root 1 BUTTONPRESSMASK GRABMODEASYNC GRABMODEASYNC NONE NONE) | |
(let ((event (make-xevent)) |
This file contains 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
! Global | |
Xft.antialias: true | |
Xft.rgba : rgb | |
Xft.hintstyle : hintfull | |
Xft.hinting : true | |
! URxvt | |
URxvt*xftAntialias: true | |
URxvt*background: #242424 | |
URxvt*foreground: #fafffa | |
! Monaco Font: http://www.gringod.com/wp-upload/software/Fonts/Monaco_Linux.ttf |
This file contains 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
# If not running interactively, don't do anything | |
# [ -z "$PS1" ] && return | |
export EDITOR=emacsclient | |
export IOKE_HOME=~/code/ioke | |
# don't put duplicate lines in the history. See bash(1) for more options | |
export HISTCONTROL=ignoredups | |
# ... and ignore same sucessive entries. |
This file contains 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
// Based on apidock.org Ubiquity Search: http://gist.github.com/8132 | |
CmdUtils.CreateCommand( | |
{ | |
name: "code", | |
takes: {"function": noun_arb_text}, | |
icon: "http://github.com/fluidicon.png", | |
homepage: "http://tiago.zusee.com", | |
author: {name: "Tiago Bastos", email: "[email protected]"}, | |
license: "MPL,GPL", | |
description: "Search on Github Code Search", |
This file contains 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
// Based on apidock.org Ubiquity Search: http://gist.github.com/8132 | |
CmdUtils.CreateCommand( | |
{ | |
name: "github", | |
takes: {"function": noun_arb_text}, | |
icon: "http://github.com/fluidicon.png", | |
homepage: "http://tiago.zusee.com", | |
author: {name: "Tiago Bastos", email: "[email protected]"}, | |
license: "MPL,GPL", | |
description: "Search on Github", |