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
| def roman_to_int(roman_string): | |
| symbol_groups = [{'IV': 4, 'IX': 9, 'XL': 40, 'XC': 90, 'CD': 400, 'CM': 900}, | |
| {'M': 1000,'D': 500 ,'C': 100,'L': 50,'X': 10,'V': 5,'I': 1}] | |
| result = 0 # initially | |
| for symbol_group in symbol_groups: | |
| for symbol, value in symbol_group.items(): | |
| result += roman_string.count(symbol) * value | |
| roman_string = roman_string.replace(symbol, '') |
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
| # Script takes one parameter: ipynb source filename WITHOUT the .pynb extension | |
| # Results in a specialized .pdf version, with smaller margins (wider page) and smaller font size (i.e. more text on a line) | |
| # Tested with up-to-date jupyter/nbconvert version on April 16th, 2017 | |
| jupyter nbconvert --to latex $1.ipynb | |
| # -i for inplace substitution, -r for full regex | |
| sed -r -i 's/documentclass\[11pt\]\{article\}/documentclass[8pt]{extarticle}/' $1.tex | |
| sed -r -i 's/geometry\{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}/geometry{verbose,tmargin=0.5in,bmargin=0.5in,lmargin=0.2in,rmargin=0.2in}/' $1.tex | |
| pdflatex $1 | |
| rm $1.tex; rm $1.out; rm $1.aux; rm $1.log |
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
| # Run from an Jupyter IPython 3 Notebook cell (recent Jupyter version) | |
| from IPython.paths import locate_profile | |
| profile_path = locate_profile(get_ipython().profile) | |
| from notebook.services.config import ConfigManager | |
| cm = ConfigManager(profile_dir=profile_path) | |
| cm.update('livereveal', { | |
| 'theme': 'solarized', | |
| 'transition': 'linear', |
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
| #!/bin/bash | |
| # Add live slideshow to Jupyter (thru Conda, using RISE) | |
| # RISE is based on reveal.js, can (also) be found on https://github.com/damianavila | |
| conda install -y -c damianavila82 rise==4.0.0b1 | |
| jupyter nbextension install rise --py --sys-prefix | |
| jupyter nbextension enable rise --py --sys-prefix |
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 pip | |
| pip.main(['install', '-q', 'mobilechelonian']) | |
| import os | |
| os.symlink('/home/users/jads-shared/programming2018spring', 'shared') |
NewerOlder