Skip to content

Instantly share code, notes, and snippets.

View tonussi's full-sized avatar

Lucas Tonussi tonussi

View GitHub Profile
@tonussi
tonussi / removehistory
Created September 15, 2016 16:08
remove git history
I find that the --tree-filter option used in other answers can be very slow, especially on larger repositories with lots of commits.
Here is the method I use to completely remove a directory from the git history using the --index-filter option, which runs much quicker:
# Make a fresh clone of the repository
git clone ...
# Create tracking branches of all branches
for remote in `git branch -r | grep -v /HEAD`; do git checkout --track $remote ; done
@tonussi
tonussi / generator.php
Created September 9, 2016 20:20 — forked from tawfekov/generator.php
Doctrine2 Generate Entities form Existing Database
<?php
include '../vendor/autoload.php';
$classLoader = new \Doctrine\Common\ClassLoader('Entities', __DIR__);
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Proxies', __DIR__);
$classLoader->register();
// config
$config = new \Doctrine\ORM\Configuration();
@tonussi
tonussi / cputime.cpp
Created May 23, 2016 06:15
cputime.cpp
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* to be able to use alarm */
#include <unistd.h>
/* to be able to use basic signal handling (i.e: sigaction) */
@tonussi
tonussi / partitioninfo.c
Created May 20, 2016 14:58
partitioninfo.c
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
 
#define SECTOR_SIZE 512
#define MBR_SIZE SECTOR_SIZE
#define MBR_DISK_SIGNATURE_OFFSET 440
#define MBR_DISK_SIGNATURE_SIZE 4
@tonussi
tonussi / ForwardDiff_Foley_vanDam.pde
Created May 10, 2016 23:21 — forked from awangenh/ForwardDiff_Foley_vanDam.pde
COMPUTE AND DRAW A BICUBIC SURFACE PATCH USING FORWARD DIFFERENCES - This code implements and provides corrections to the algorithm named DrawSurfaceFwdDif presented in Fig.11.46 at page 525 of the book Computer Graphics - Principles and Practice 2.ed in C by James D.Foley et.al.
/* ============================================================================= *
* COMPUTE AND DRAW A BICUBIC SURFACE PATCH USING FORWARD DIFFERENCES *
* *
* This code implements and provides corrections to the algorithm named *
* DrawSurfaceFwdDif presented in Fig.11.46 at page 525 of the book *
* Computer Graphics - Principles and Practice 2.ed in C by Jamed D.Foley et.al. *
* This algorithm was neither corrected nor repeated in the 3rd (present) *
* edition of Foley et.al.'s book. *
* *
* The algorithm, as stated in the book, does not work: There is one error and *
@tonussi
tonussi / download.sh
Created March 10, 2016 02:15
download.sh
#!/bin/bash
# Script
# Download things in a numeric pattern of links
# Author: Lucas Tonussi <lptonussi@gmail.com>
# Usage
# bash download.sh <cota_inferior> <cota_superior> <regex> <output_name>
# $1 $2 $3 $4
link=""
@tonussi
tonussi / config.json
Created January 5, 2016 07:37 — forked from anonymous/config.json
Bootstrap Customizer Config
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "darken(#428bca, 6.5%)",
"@brand-success": "#5cb85c",
@tonussi
tonussi / duplessis_part1.str
Created August 3, 2015 11:39
Archaeological Discoveries in Bible Lands - Part 1 - Digging Up The Past - Francois DuPlessis
1
00:00:00,906 --> 00:00:08,457
Grandes Descobertas!
2
00:00:12,079 --> 00:00:16,012
Desvende!
3
00:00:16,461 --> 00:00:19,039
@tonussi
tonussi / fib.asm
Created March 26, 2015 10:48
fib.asm
.text
.globl main
main:
# int fib (int n)
# if (n == 0) return 0;
# elif (n == 1) return 1;
# else return fib(n - 1) + fib(n - 2);
@tonussi
tonussi / class.js
Last active August 29, 2015 14:09
como escrever melhor
function Filho(nodo_filho, filho_esquerda, filho_direita) {
this.nodo_filho = nodo_filho;
this.filho_esquerda = filho_esquerda;
this.filho_direita = filho_direita;
}
Filho.class_filho.prototype.constroiAutomatoFND = function () {
var nodo_filho = new Parenteses(0, -1, 1024, this.nodo_filho);
if (!this.filho_esquerda) {