Skip to content

Instantly share code, notes, and snippets.

@ryanbekabe
ryanbekabe / python_flask_ssl.py
Created October 12, 2020 01:00
Pyton Flask with SSL Let's Encrypt
#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
@ryanbekabe
ryanbekabe / python_audio_streaming.py
Last active August 9, 2024 07:29
Python Audio from Mic to streaming
from flask import Flask, Response,render_template
import pyaudio
app = Flask(__name__)
#audio1 = pyaudio.PyAudio()
p = pyaudio.PyAudio()
def generate_wav(self, raw):
"""
@weavenet
weavenet / console.py
Last active August 5, 2023 17:57
Python script to assume STS role and generate AWS console URL.
#!/usr/bin/env python
import getpass
import json
import requests
import sys
import urllib
import boto3
@wevtimoteo
wevtimoteo / example.md
Last active February 21, 2024 22:42
Moving files across git repositories preserving history
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
@junpeng1
junpeng1 / README.md
Last active May 19, 2022 20:39
Copying existing repository to another git repository's subdirectory while keeping history
@emiller
emiller / git-mv-with-history
Last active July 24, 2025 22:22
git utility to move/rename file or folder and retain history with it.
#!/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.
@kanzure
kanzure / git-commit-cleaner.py
Last active May 17, 2022 17:25
git-filter-branch examples and notes
"""
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
@trongthanh
trongthanh / gist:2779392
Last active October 30, 2025 21:44
How to move a folder from one repo to another and keep its commit history
# 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.