Skip to content

Instantly share code, notes, and snippets.

View leewin12's full-sized avatar

greg.lee leewin12

View GitHub Profile
@leewin12
leewin12 / git.migrate
Created September 7, 2016 06:54 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@leewin12
leewin12 / split_str.sql
Last active August 29, 2015 13:56 — forked from mikedamage/split_str.sql
MySQL Split User-defined function
-- SPLIT_STR MySQL Function
-- from http://blog.fedecarg.com/2009/02/22/mysql-split-string-function/
CREATE FUNCTION SPLIT_STR(
x VARCHAR(255),
delim VARCHAR(12),
pos INT
)
RETURNS VARCHAR(255)
-- use CHAR_LENGTH instead of LENGTH to support utf8