Skip to content

Instantly share code, notes, and snippets.

View pedrovanzella's full-sized avatar

Pedro Vanzella pedrovanzella

View GitHub Profile
#!/usr/bin/ruby
#This is for SABnzbd+ only
#Let's hope it works and I don't look like a complete moron.
#Uses gem mediainfo from http://github.com/greatseth/mediainfo
#Now using metaflac from the flac package to parse metadata and keep tags.
#Next step: remove mediainfo dependecy.
@pedrovanzella
pedrovanzella / genpass.rb
Created January 29, 2011 16:19
Generates all possible combinations of a set, including doubles, to fill given spaces on a string
##############################################
# genpass.rb #
# Generates a table of possible #
# passwords according to a fixed pattern #
# #
# Ugly, but works #
##############################################
def generate_combinations(array, r)
n = array.length
@pedrovanzella
pedrovanzella / crawler.rb
Created March 24, 2011 22:19
Looks for the existence of dirs on a numbered list. Done in order to learn net/http and threads.
#!/usr/bin/env ruby
#
###################################################
# crawler.rb #
# Pedro Vanzella - pedro@pedrovanzella.com #
# #
# Looks for the existence of directories on a #
# numbered, but sparse, list #
###################################################
#!/bin/sh
ffmpeg -i “$1″ -acodec alac “`basename “$1″ .flac`.m4a” \
-metadata title=\”"$(metaflac –show-tag=TITLE “$1″ | sed ‘s/title=//g’)”\” \
-metadata author=\”"$(metaflac –show-tag=ARTIST “$1″ | sed ‘s/artist=//g’)”\” \
-metadata album=\”"$(metaflac –show-tag=ALBUM “$1″ | sed ‘s/album=//g’)”\” \
-metadata year=\”"$(metaflac –show-tag=DATE “$1″ | sed ‘s/date=//g’)”\” \
-metadata track=\”"$(metaflac –show-tag=TRACKNUMBER “$1″ | sed ‘s/tracknumber=//g’)”\” \
-metadata genre=\”"$(metaflac –show-tag=GENRE “$1″ | sed ‘s/genre=//g’)”\”
@pedrovanzella
pedrovanzella / gist:1964077
Created March 3, 2012 03:14
OSX Cello Song
say -v Cellos "oh this is a silly song silly song silly song this is the silliest song ive ever ever heard So why keep you listening listening listening while you are supposed to work to work to work to work its because you hate your job hate your job hate your job its because you hate your job more than anything else No its because you've got no life got no life got no life and you better go get one after forwarding this crap using "cellos" la la la la la la la la la"
@pedrovanzella
pedrovanzella / strip-capture.sh
Created September 4, 2012 01:15
strip-capture.sh
#!/bin/bash
print_usage() {
echo "Usage: $0 <essid> </path/to/capture.cap>"
}
hash tshark &> /dev/null
if [ $? -eq 1 ]; then
echo "This script requires 'tshark', but it does not appear to be installed."
echo "Please install 'tshark', (sudo apt-get install tshark) and try again."
@pedrovanzella
pedrovanzella / import_from_octopress.rb
Last active December 15, 2015 14:58
Imports octopress markdown posts into a more standard markdown, prefered by pelican. Also imports images and rewrites the links accordingly.
# encoding: utf-8
#!/usr/bin/env ruby
require 'fileutils'
#
# import_from_octopress.rb
# Imports Jekyll / Octopress formatted blogposts into pelican.
# Author: Pedro Vanzella <pedro@pedrovanzella.com>
#
Fabricator(:default, from: :connection_profile) do
name_id "default"
name "Perfil Padrão"
conn_type "mobile"
end

Eu tenho algo assim:

wordpress_id: '1'
categories:
- Mondo Bizarro
- abc
tags:
- ciência

Eu preciso de uma regex que pegue todas as categories, isso é, todas as linhas que começam com - após a linha que contém categories:. A única garantia que eu tenho de um fim da lista de categories é uma linha que não começa com - .

import os
import ycm_core
from clang_helpers import PrepareClangFlags
compilation_database_folder = ''
# These are the compilation flags that will be used in case there's no
# compilation database set.
flags = [
'-Wall',