Skip to content

Instantly share code, notes, and snippets.

View pedrovanzella's full-sized avatar

Pedro Vanzella pedrovanzella

View GitHub Profile
@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."
import unittest
from microfinance import app, db
from microfinance.models import User
from sqlalchemy.exc import IntegrityError
class UserTestCase(unittest.TestCase):
def setUp(self):
app.config['TESTING'] = True
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgres://localhost/microfinance_test'
from microfinance import db
from passlib.hash import bcrypt
from marshmallow import Schema
from marshmallow import post_dump
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(32),
@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',
import os
import ycm_core
from clang_helpers import PrepareClangFlags
# Set this to the absolute path to the folder (NOT the file!) containing the
# compile_commands.json file to use that instead of 'flags'. See here for
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
# Most projects will NOT need to set this to anything; you can just change the
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
compilation_database_folder = ''
class MailController < ApplicationController
def send(e)
begin
UserMailer.email(required_params[:to],
required_params[:from],
required_params[:template],
required_params[:content])
.deliver_now
rescue Exceptions::InvalidTemplateError
render json: {success: false,