Skip to content

Instantly share code, notes, and snippets.

View aesuli's full-sized avatar
🍕

Andrea Esuli aesuli

🍕
View GitHub Profile
@aesuli
aesuli / repo-reset.md
Created November 23, 2020 15:38 — forked from heiswayi/repo-reset.md
GitHub - Delete commits history with git commands

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A
@aesuli
aesuli / markdown_doc
Created January 24, 2019 15:47 — forked from jiffyclub/markdown_doc
This script turns Markdown into HTML using the Python markdown library and wraps the result in a complete HTML document with default Bootstrap styling so that it's immediately printable. Requires the python libraries jinja2, markdown, and mdx_smartypants.
#!/usr/bin/env python
import argparse
import sys
import jinja2
import markdown
TEMPLATE = """<!DOCTYPE html>
<html>
@aesuli
aesuli / gist:22fdca6a49299a8ac8d2dbe6517e5d9e
Created December 1, 2016 22:39 — forked from dsc/gist:3855240
Python argparse Cheatsheet
Arg Name or Optional Flags:
positional : str = "foo"
options : str = "-f", "--foo"
Standard:
action : str = [store], append, store_true, store_false, store_const, append_const, version
default : * = [None]
type : callable = [str], argparse.FileType(mode='wb', bufsize=0)
Exotic: