Skip to content

Instantly share code, notes, and snippets.

View colossus9's full-sized avatar
:shipit:
Ship to Learn

James Garcia colossus9

:shipit:
Ship to Learn
View GitHub Profile
@colossus9
colossus9 / Convert git-svn tag branches to real tags.md
Created August 3, 2016 20:34
Convert git-svn tag branches to real tags

Convert git-svn tag branches to real tags

Reference: http://gitready.com/advanced/2009/02/16/convert-git-svn-tag-branches-to-real-tags.html

This information was found in the article above and has been summarized below!

In the process of converting from Subversion to Git, tags get a bit confused and show up as branches instead once converted over. This can be pretty inconvenient, especially when using git branch since a ton of branches would show up such as tag/1.2, and so on. A little bit of scripting and Git magic can clear this up easily.

First, use git svn to convert your repository. Then, use this script to convert all of the tag branches into actual tags, and finally make sure they’re deleted properly:

@colossus9
colossus9 / SyncFork.md
Created August 3, 2016 20:35
Synchronize your fork with the original repository in GitHub

Sync GitHub Fork with Upstream

Reference: https://help.github.com/articles/syncing-a-fork/

The below is a summary of how you are able to synchronize your forked repository in GitHub with the original repository you originally forked from.

  1. Clone your forked repo into your workspace and cd into it.

git clone [email protected]:YOUR_USERNAME/YOUR_FORK.git

@colossus9
colossus9 / GitHub-Forking.md
Created August 3, 2016 20:37
How to use forks in GitHub

GitHub Forking

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, when I started going through the process of forking and issuing pull requests, I had some trouble figuring out the proper method for doing so and made quite a few mistakes along the way. I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git cli

@colossus9
colossus9 / MSSQL-SearchTables-Script.sql
Created August 3, 2016 20:37
Search tables in a MS SQL database
DECLARE @Tablenames VARCHAR(500)
DECLARE @SearchStr NVARCHAR(60)
DECLARE @GenerateSQLOnly Bit
SELECT @Tablenames ='%'
SELECT @SearchStr ='%5344e086%'
SELECT @GenerateSQLOnly = 0
@colossus9
colossus9 / git-history.md
Created August 3, 2016 20:38
git history pretty

git log --pretty=format:"%h - %an, %ar : %s"

@colossus9
colossus9 / Gerrit-GitHub.md
Created August 3, 2016 20:43
Gerrit with GitHub

Gerrit GitHub Plugin

This plugin allows existing GitHub repositories to be integrated as Gerrit projects. This plugin works for Gerrit 2.12 and later versions. See the original opensource project for more information.

Have a working instance of Gerrit 2.12

  1. Download the Gerrit 2.12 war file.
  2. Create a directory for Gerrit mkdir gerrit
@colossus9
colossus9 / GitRemoteBranchSync.md
Created August 3, 2016 20:44
Local git branch list "synchronization" with remote

Git Remote Branch Sync

There are some folks who want to keep their local git branch list to be in sync with the branches available on the remote. This typically happens after a Pull Request on GitHub Enterprise, when the remote branch is merged and removed, but the branch still exists locally.

To clean up the branches that no longer exist on the remote, there are a couple of options (as well as more that are not listed here):

  • The quick way:
@colossus9
colossus9 / GHE_Wiki_Find_and_Replace.md
Created August 3, 2016 20:46
Find-and-Replace text in GitHub Enterprise (repo) Wiki pages

Perform a Mass Find-and-Replace in a GitHub Enterprise Wiki

If you have a need to update text/string in your GitHub Enterprise wiki, and you have many wikis where manual find-and-replace can be tedious, one way to perform a mass update is to clone your wiki (as a git repository) to a local workspace and perform find-and-replace.

Here is an example of using the Unix-based sed command to perform a find-and-replace:

  1. Access your repository's wiki site. Example: https://git.521000.bestpany.com/OWNER/REPO/wiki
@colossus9
colossus9 / get-ssh-fingerprints.sh
Created September 21, 2016 19:30
Show table of fingerprints for all key ciphers allowed on server using config at /etc/ssh/sshd_config
#!/bin/bash
#
# Reference: http://superuser.com/questions/929566/sha256-ssh-fingerprint-given-by-the-client-but-only-md5-fingerprint-known-for-se
#
# standard sshd config path
SSHD_CONFIG=/etc/ssh/sshd_config
# helper functions
function tablize {
@colossus9
colossus9 / generate-arch.sh
Created December 8, 2016 20:01
Generate Service Architecture for your docker-compose.yml
#!/bin/sh
#
# Use this script to generate a Service Architecture
# for your docker-compose.yml file.
#
cd $PATH_TO_COMPOSE_FILE
cat docker-compose.yml | \
docker run -i funkwerk/compose_plantuml --link-graph --boundaries | \