Skip to content

Instantly share code, notes, and snippets.

@jwg4
jwg4 / txt2latex.py
Created October 19, 2020 21:37
Transforming plaintext to latex
import logging
import re
import sys
REPLACEMENTS = {
"’": "'",
"—": "--",
"“": "``",
"”": "''",
File:
https://github.com/jlafon/ansible-profile/blob/d9dd334b4690271bd9e4afb43323ec435f19baec/callback_plugins/profile_tasks.py
@jwg4
jwg4 / gist:a7cedb446beed7c47a8d5dd0f94893f6
Created April 25, 2018 10:46
Python import weirdness
(venv)jack@neptune-vm:~/z/imports$ python
Python 2.7.12 (default, Nov 20 2017, 18:23:56)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from a import foo
>>> foo
<module 'a.foo' from 'a/foo.py'>
f = open(__file__, 'w')
f.truncate()
@jwg4
jwg4 / example.html
Created November 6, 2015 23:18
Example of a simple HTML page
<HTML>
<HEAD>
<TITLE>Your Title Here</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
@jwg4
jwg4 / flask_restless_autodoc.py
Last active September 19, 2015 07:44
An example of how to use autodoc with flask extensions which generate endpoints, such as Flask-Restless
# This is bsed on the example at https://github.com/acoomans/flask-autodoc/blob/master/examples/simple/blog.py
# It adds SQLAlchemy models, and uses Flask-Restless to create a REST API for manipulating these
from flask import Flask
from flask.ext.autodoc import Autodoc
from flask.ext.restless import APIManager
from flask.ext.sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.debug = True