- R Markdown
Use a productive notebook interface to weave together narrative text and code to produce elegantly formatted output. Use multiple languages including R, Python, and SQL.
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
| # A Simple Makefile for LaTeX | |
| # Author: Lester James V. Miranda | |
| # E-mail: ljvmiranda@gmail.com | |
| # Default variables which can be edited via the terminal | |
| BUILDDIR = _build | |
| COMPILER = pdflatex | |
| PROJECT = main | |
| BIBLIOGRAPHY = bibliography |
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 "Raymond Hettinger - Beyond PEP 8 -- Best practices for beautiful intelligible code - PyCon 2015" | |
| # Bad code | |
| import jnettools.toolselements.NetworkElement, \ | |
| jnettools.tools.Routing, \ | |
| jnettools.tools.RouteInspector | |
| ne=jnettools.tools.elements.NetworkElement( '171.0.2.45' ) | |
| try: |
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
| import hashlib as hasher | |
| import datetime as date | |
| # Define what a Snakecoin block is | |
| class Block: | |
| def __init__(self, index, timestamp, data, previous_hash): | |
| self.index = index | |
| self.timestamp = timestamp | |
| self.data = data | |
| self.previous_hash = previous_hash |
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
| import sys | |
| import subprocess | |
| import re | |
| def convert_to(folder, source, timeout=None): | |
| args = [libreoffice_exec(), '--headless', '--convert-to', 'pdf', '--outdir', folder, source] | |
| process = subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=timeout) | |
| filename = re.search('-> (.*?) using filter', process.stdout.decode()) |
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
| import numpy as np | |
| def crappyhist(a, bins=50, width=140): | |
| h, b = np.histogram(a, bins) | |
| for i in range (0, bins): | |
| print('{:12.5f} | {:{width}s} {}'.format( | |
| b[i], | |
| '#'*int(width*h[i]/np.amax(h)), | |
| h[i], |
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
| """ | |
| Copyright (C) 2017 Michael von den Driesch | |
| This file is just a simple implementation of a python class allowing for various | |
| *booking* types (LIFO, FIFO, AVCO) | |
| This *GIST* is free software: you can redistribute it and/or modify it | |
| under the terms of the BSD-2-Clause (https://opensource.org/licenses/bsd-license.html). | |
| This program is distributed in the hope that it will be useful, but WITHOUT |
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
| # first: mkdir user && cd user && cp /path/to/get_gists.py . | |
| # python3 get_gists.py user | |
| import requests | |
| import sys | |
| from subprocess import call | |
| user = sys.argv[1] | |
| r = requests.get('https://api.github.com/users/{0}/gists'.format(user)) |