Skip to content

Instantly share code, notes, and snippets.

View carlosspohr's full-sized avatar

Carlos Spohr carlosspohr

View GitHub Profile
@SKempin
SKempin / Git Subtree basics.md
Last active May 6, 2024 14:55
Git Subtree basics

Git Subtree Basics

If you hate git submodule, then you may want to give git subtree a try.

Background

When you want to use a subtree, you add the subtree to an existing repository where the subtree is a reference to another repository url and branch/tag. This add command adds all the code and files into the main repository locally; it's not just a reference to a remote repo.

When you stage and commit files for the main repo, it will add all of the remote files in the same operation. The subtree checkout will pull all the files in one pass, so there is no need to try and connect to another repo to get the portion of subtree files, because they were already included in the main repo.

Adding a subtree

Let's say you already have a git repository with at least one commit. You can add another repository into this respository like this:

@insytes
insytes / mysqldump-ignore-multiple-tables
Created December 14, 2016 01:30
mysqldump ignore multiple tables
mysqldump -u root -p database --ignore-table=database.table1 --ignore-table=database.table2 > dump.sql
@garcia-jj
garcia-jj / Page.java
Last active January 3, 2016 12:49
Pagination is really cool to avoid fuking the server performance :)
import static com.google.common.base.Objects.firstNonNull;
import java.io.Serializable;
/**
* Classe para prover paginação de resultados.
*
* @author Otávio Scherer Garcia
*/
public final class Page
@hgomez
hgomez / mint141516.md
Last active October 23, 2018 14:08
Mint 14 -> Mint 15 -> Mint 16

Mint upgrade procedures

Some investigation and tests on how to upgrade Mint machine.

Tests performed on Mint Cinnamon 14/15/16, on physical machine 14->15 and VirtualBox VMs for 14->15->16 and 14->16.

As usual you could break your machine, so please do backups before and cross fingers.

Mint 14 -> Mint 15

@dipold
dipold / MultiTenantProvider.java
Last active May 15, 2018 15:35
Hibernate 4 Multitenancy with postgresql implementation example
package yourpackage.util.hibernate.multitenancy;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Map;
import org.hibernate.HibernateException;
import org.hibernate.service.config.spi.ConfigurationService;
import org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider;
import org.hibernate.service.jdbc.connections.spi.MultiTenantConnectionProvider;
@aaronzirbes
aaronzirbes / shrink-git-repo.sh
Created January 19, 2013 05:32
This script will help you remove large files from your git repo history and shrink the size of your repository.
#!/bin/bash
echo "Finding and Purging Big Files From Git History"
echo "=============================================="
echo ""
echo "http://naleid.com/blog/2012/01/17/finding-and-purging-big-files-from-git-history/"
echo ""
pushd "$(git rev-parse --show-toplevel)" > /dev/null
anonymous
anonymous / gist:4009042
Created November 3, 2012 22:08
Vraptor UploadedFile - getSize()
public interface UploadedFile {
...
long getSize();
}
public class DefaultUploadedFile implements UploadedFile {
public DefaultUploadedFile(..., long size) {
...
this.size = size;
@sergiy
sergiy / shadow_example.sql
Created July 19, 2012 14:32
online schema change
/*
-- existing table structure, missing index for the field1
CREATE TABLE IF NOT EXISTS `table1` (
`id` int(11) NOT NULL auto_increment,
`field1` int(11) not null,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
*/
@lucascs
lucascs / ParametersFilter.java
Created June 1, 2012 22:04
Filter for removing blank id parameters
import java.io.IOException;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Map;
import java.util.Map.Entry;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
@cmilfont
cmilfont / DirectJavascriptRemote.java
Created December 27, 2011 20:21
Gerar a representação dos controllers do VRaptor em javascript
/* Começado em https://gist.github.com/1524693 */
package org.milfont.indica.controller;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
import java.util.Set;
import net.vidageek.mirror.dsl.Mirror;