git clone <git repository A url>
cd <git repository A directory>
git remote rm origin
git filter-branch --subdirectory-filter <directory 1> -- --all
mkdir -p <target-path in="" repo-b="">
git mv -k * <target-path in="" repo-b="">
git add .
git commit
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #Pyton Flask with SSL Let's Encrypt | |
| #Source: https://bits.mdminhazulhaque.io/python/run-flask-app-with-let's-encrypt-ssl-certificate.html | |
| import requests | |
| from flask import Flask, request | |
| app = Flask(__name__) | |
| @app.route('/', methods=['GET']) | |
| def serve(): | |
| return "Hello world", 200 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | from flask import Flask, Response,render_template | |
| import pyaudio | |
| app = Flask(__name__) | |
| #audio1 = pyaudio.PyAudio() | |
| p = pyaudio.PyAudio() | |
| def generate_wav(self, raw): | |
| """ | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/usr/bin/env python | |
| import getpass | |
| import json | |
| import requests | |
| import sys | |
| import urllib | |
| import boto3 | 
A useful code snippet for copying existing repository with it's history to another repository, by creating patches from the source repository, and applying them in the destination repository.
References:
http://blog.neutrino.es/2012/git-copy-a-file-or-directory-from-another-repository-preserving-history/ http://stackoverflow.com/questions/13500294/merge-a-branch-into-a-new-sub-directory-on-the-master
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/bin/bash | |
| # | |
| # git-mv-with-history -- move/rename file or folder, with history. | |
| # | |
| # Moving a file in git doesn't track history, so the purpose of this | |
| # utility is best explained from the kernel wiki: | |
| # | |
| # Git has a rename command git mv, but that is just for convenience. | |
| # The effect is indistinguishable from removing the file and adding another | |
| # with different name and the same content. | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | """ | |
| Creates pretty-looking commit messages for git. This was created to pretty | |
| print the old-commit-id values for filter-branched-rewritten commits in | |
| pyphantomjs from the phantomjs repository. | |
| """ | |
| import os | |
| import sys | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # source: http://st-on-it.blogspot.com/2010/01/how-to-move-folders-between-git.html | |
| # First of all you need to have a clean clone of the source repository so we didn't screw the things up. | |
| git clone git://server.com/my-repo1.git | |
| # After that you need to do some preparations on the source repository, nuking all the entries except the folder you need to move. Use the following command | |
| git filter-branch --subdirectory-filter your_dir -- -- all | |
| # This will nuke all the other entries and their history, creating a clean git repository that contains only data and history from the directory you need. If you need to move several folders, you have to collect them in a single directory using the git mv command. |