Skip to content

Instantly share code, notes, and snippets.

Pedro Vanzella pedrovanzella

Block or report user

Report or block pedrovanzella

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
pedrovanzella / main.cpp
Created Jan 9, 2019
Q_OBJECT weirdness
View main.cpp
#include <QApplication>
#include "window.h"
int main(int argc, char **argv)
QApplication app(argc, argv);
Window window;;
pedrovanzella /
Last active Sep 24, 2018
Try to unzip a file in a flat hierarchy
import zipfile
import os
from typing import List
def extract(file: str, path: str=".") -> List[str]:
names = []
with zipfile.ZipFile(file) as zip_file:
for member in zip_file.namelist():
data =
View application_controller.rb
class ApplicationController < ActionController::Base
rescue_from ActionController::UnpermittedParameters do |error|
if Rails.env.development? || Rails.env.test?
raise # Raise again and fail lowdly in dev and test
else"[#{Rails.env}] UNPERMITTED PARAMETERS! #{error}\nBacktrace:\n#{error.backtrace}")
View op.cpp
class Memory {
Memory(std::array<uint8_t, 1024> b) { buff_ = std::move(b); }
uint16_t& operator[](uint16_t addr) {
return (buff_[addr] << 8) + buff_[addr + 1]; // This doesn't work
// cannot bind non-const lvalue reference of type ‘uint16_t& {aka short unsigned int&}’ to an rvalue of type ‘uint16_t {aka short unsigned int}’
View ops.cpp
class ROM {
ROM(std::array<uint8_t, 1024> buf) { _buffer = std::move(buf); }
const uint16_t operator[](const uint16_t offset) const {
if (offset > _buffer.size()) {
return 0x0;
// This is a big-endian machine, indexed by 16-bit words
return (_buffer[offset] << 8) + (_buffer[offset + 1]);
pedrovanzella /
Last active Sep 6, 2018
Finds all cbz and cbr files in a directory and converts all files inside to webp
# Author: Pedro Vanzella <>
# Usage: <dir>
# License: BSD
# Finds all cbz and cbr files in a directory and converts all files inside to
# webp with quality 80, which should yield a 30% compression with no noticeably
# loss of quality
View .spacemacs.el
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
;; Base distribution to use. This is a layer contained in the directory
View package.el
;;; packages.el --- rtags layer packages file for Spacemacs.
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;; Author: Pedro Vanzella <pedrovanzella@Fenrir.orion>
;; URL:
;; This file is not part of GNU Emacs.
;;; License: GPLv3
View mail_controller.rb
class MailController < ApplicationController
def send(e)
rescue Exceptions::InvalidTemplateError
render json: {success: false,
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),
You can’t perform that action at this time.