Skip to content

Instantly share code, notes, and snippets.

View lxfontes's full-sized avatar
🌋

Lucas Fontes lxfontes

🌋
View GitHub Profile
require 'rubygems'
require 'mechanize'
agent = Mechanize.new
agent.get("http://www.livingelectro.com/index.php?genre=Trance")
links = agent.page.search('a')
#puts links
hrefs = links.map { |m| m['href'] }.select { |u| u =~ /\-mp3/ }
FileUtils.mkdir_p('livingelectro')
hrefs.each { |mp3|
#include <stdio.h>
int main(int argc, char *argv[:>) <%
if( argc > 1 ) {
printf("you passed %d argument%s to %s.\n",
argc - 1, ( argc == 2 ) ? "" : "s", argv<:0]);
%> else {
printf("you passed no arguments to %s.\n", argv[0:>);
%>
#!/usr/bin/env ruby
git_bundles = [
"git://github.com/msanders/snipmate.vim.git",
"git://github.com/scrooloose/nerdtree.git",
"git://github.com/timcharper/textile.vim.git",
"git://github.com/tpope/vim-git.git",
"git://github.com/tpope/vim-markdown.git",
"git://github.com/tpope/vim-rails.git",
"git://github.com/tpope/vim-repeat.git",
@lxfontes
lxfontes / vimrc
Created September 27, 2010 02:10
filetype off
call pathogen#helptags()
call pathogen#runtime_append_all_bundles()
syntax on
filetype plugin indent on
set tabstop=2
set smarttab
set shiftwidth=2
set autoindent
@lxfontes
lxfontes / Makefile
Created April 12, 2011 20:49
c++ sample makefile
CC = g++
CFLAGS = -Wall -O2
LDFLAGS = -lpcap
OBJFILES := $(patsubst %.cc,%.o,$(wildcard *.cc))
PROG=pcapr
COMPILE = $(CC) $(CFLAGS) -c
all: $(PROG)
@lxfontes
lxfontes / idea.rb
Created October 19, 2011 01:46
idea ripper
require "rubygems"
require "tweetstream"
TweetStream.configure do |config|
config.username = '<user>'
config.password = '<pw>'
config.auth_method = :basic
config.parser = :json_gem
end
import cyclone.web
import functools
def requiredrole(role):
"""@requiredrole(role_name)
Example:
class Secret(BaseHandler):
@requiredrole("admin")
@cyclone.web.authenticated
from storm.locals import *
from twisted.internet import task,defer,reactor,threads
class User(object):
__storm_table__ = "person"
id = Int(primary=True)
name = Unicode()
class TwistedStore(Store):
def find(*args,**kwargs):
@lxfontes
lxfontes / freeswitch.rb
Created December 3, 2011 04:04 — forked from mbbx6spp/freeswitch.rb
Homebrew formula for installing FreeSWITCH that I wrote tonight. Unsure of best way to automatically "test" FreeSWITCH. Thoughts?
require 'formula'
class Freeswitch < Formula
url 'http://files.freeswitch.org/freeswitch-snapshot.tar.gz'
homepage ''
md5 'bb0aa3a04479f06caa8815530ca22d05'
version '1.0.8.alpha'
depends_on 'cmake'
depends_on 'jpeg'
@lxfontes
lxfontes / gist:1503192
Created December 20, 2011 20:44
git-php blob
public static function blob($proj, $path) {
$gitBinary = System::get('git_binary');
$cmd = sprintf("GIT_DIR=%s%s %s show HEAD:%s 2>&1", self::$repos[$proj],
System::get('repo_suffix'),
$gitBinary,
escapeshellarg($path));
$content = shell_exec($cmd);
return array(
'content' => $content,
'ext' => 'something'