Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Daniel Roy Greenfeld pydanny

🎯
Focusing
Block or report user

Report or block pydanny

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View md_testrunner.py
"""
Name: md_testrunner.py
Usage: python md_test_runner.py blogpost.md
Tested on: Python 3.7 and 3.8
"""
from sys import argv
from tempfile import NamedTemporaryFile
import re
import subprocess
import os
@pydanny
pydanny / readme.md
Last active Mar 21, 2018
How mountain will work
View readme.md

First, get the template, which will include a app.py module.

cookiecutter gh:pydanny/mountain

Second, get the package that includes dependencies like Flask, markdown2, etc

cd <project-name>
View glob_example.py
from glob import glob
def erase_lines_in_files(directory):
for filename in glob(f"{directory}*.csv"):
with open(filename, "rb") as f:
lines = f.readlines()
for line in lines[1:]:
View gist:67d1b7c03a64b2bc8bea73525b7677f7
$ python setup.py sdist upload
running sdist
running egg_info
writing arepa.egg-info/PKG-INFO
writing dependency_links to arepa.egg-info/dependency_links.txt
writing top-level names to arepa.egg-info/top_level.txt
reading manifest file 'arepa.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '__pycache__' found under directory '*'
warning: no files found matching '*.jpg' under directory 'docs'
@pydanny
pydanny / failing_image_example.rst_
Last active Jan 26, 2018
How I convert rst to HTML. Currently fails on images.
View failing_image_example.rst_
This image fails when I run it via the function below:
.. image:: https://raw.githubusercontent.com/pydanny/pydanny.github.com/master/static/bitcointsd111.png
:align: center
:alt: BitCoin and Two Scoops of Django!
:target: https://www.pydanny.com/25-percent-bitcoin-sale-two-scoops-of-django.html
Error provided is::
<h1>System Message: ERROR/3 (&lt;string&gt; line 4)</h1>
@pydanny
pydanny / django_local_settings.py
Last active Dec 12, 2018
running local unverified SSL on Django and Flask (don't do this in production!!!)
View django_local_settings.py
from .common import * # noqa
DEBUG = True
INSTALLED_APPS += ('django_extensions',)
# Snip all the other stuff
@pydanny
pydanny / gist:93b1cf17d9573136dcc15d6d6bb8cd0c
Last active Apr 27, 2017
Pelican crash message that gives me nothing useful to work on
View gist:93b1cf17d9573136dcc15d6d6bb8cd0c
CRITICAL: RuntimeError: File blog/pydanny.github.com/output/feeds/blog.atom.xml is to be overwritten
View Makefile
color:
xelatex -shell-escape coloringbook.tex
rm *aux; rm *idx; rm *log; rm *out; rm *thm;
open coloringbook.pdf
View fontspec_error.tex
% Our tocloft configuration
\usepackage{tocloft}
\newlength{\mylen} %% extra space
\setlength{\mylen}{.2cm}
\addtolength{\cftsecnumwidth}{\mylen} % add the extra space after section numbers
\addtolength{\cftsubsecnumwidth}{\mylen} % add the extra space after subsection numbers
% How we load fontspec
View megaref.tex
\newcommand{\megaref}[1]{
\hyperref[#1]{\Cref{#1}: \nameref{#1}}
}
You can’t perform that action at this time.