Last active
          December 28, 2017 06:33 
        
      - 
      
- 
        Save zrks/1d5bb58b823185131c23f816d2ec4b8e to your computer and use it in GitHub Desktop. 
Revisions
- 
        zrks revised this gist Apr 10, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -44,7 +44,7 @@ pipeline { stage('Lint presentation text') { steps { sh ". venv/bin/activate && python get-text.py > text.txt" sh ". venv/bin/activate && grammar-check --disable=WHITESPACE_RULE,CD_NN[1] text.txt" } } 
- 
        zrks revised this gist Apr 10, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -43,7 +43,7 @@ pipeline { stage('Lint presentation text') { steps { sh ". venv/bin/activate && python get-text.py > text.txt" sh "grammar-check --disable=WHITESPACE_RULE,CD_NN[1] text.txt" } } 
- 
        zrks revised this gist Apr 10, 2017 . 2 changed files with 9 additions and 1 deletion.There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -41,6 +41,13 @@ pipeline { } } stage('Lint presentation text') { steps { sh "python get-text.py > text.txt" sh "grammar-check --disable=WHITESPACE_RULE,CD_NN[1] text.txt" } } stage('Archive artifacts') { steps { archive "$PRESENTATION_NAME" 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,8 @@ from pptx import Presentation prs = Presentation(os.getenv('PRESENTATION_NAME', 'devops-for-powerpoint.pptx')) # text_runs will be populated with a list of strings, # one for each text run in presentation 
- 
        zrks revised this gist Apr 10, 2017 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,10 @@ 3to2==1.1.1 appdirs==1.4.3 autopep8==1.3.1 configparser==3.5.0 enum34==1.1.6 flake8==3.3.0 grammar-check==1.3.1 lxml==3.7.3 mccabe==0.6.1 olefile==0.44 
- 
        zrks revised this gist Apr 10, 2017 . 1 changed file with 21 additions and 0 deletions.There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ import os from pptx import Presentation prs = Presentation(os.getenv('PRESENTATION_NAME', 'devops-for-powerpoint.pptx')) # text_runs will be populated with a list of strings, # one for each text run in presentation text_runs = [] for slide in prs.slides: for shape in slide.shapes: if not shape.has_text_frame: continue for paragraph in shape.text_frame.paragraphs: for run in paragraph.runs: text_runs.append(run.text) for i in text_runs: print(i) 
- 
        zrks revised this gist Apr 10, 2017 . 1 changed file with 50 additions and 50 deletions.There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -1,51 +1,51 @@ pipeline { agent { label "master" } environment { CONFIGURATION_FILENAME = "presentation.yml" PRESENTATION_NAME = "devops-for-powerpoint.pptx" } stages { stage('Checkout') { steps { git url: 'https://gist.github.com/1d5bb58b823185131c23f816d2ec4b8e.git' } } stage('Create virtualenv') { steps { sh 'virtualenv venv' } } stage('Fetch dependencies') { steps { sh '. venv/bin/activate && pip install -r requirements.txt' } } stage('Lint source') { steps { sh "flake8 --show-source --ignore=E999,E113 *.py *.yml" } } stage('Build presentation') { steps { sh ". venv/bin/activate && python generate-presentation.py" } } stage('Archive artifacts') { steps { archive "$PRESENTATION_NAME" } } } } 
- 
        zrks revised this gist Apr 10, 2017 . 1 changed file with 6 additions and 7 deletions.There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -4,15 +4,14 @@ pipeline { label "master" } environment { CONFIGURATION_FILENAME = "presentation.yml" PRESENTATION_NAME = "devops-for-powerpoint.pptx" } stages { stage('Checkout') { steps { git url: 'https://gist.github.com/1d5bb58b823185131c23f816d2ec4b8e.git' } 
- 
        zrks revised this gist Apr 10, 2017 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,8 @@ def read_configuration(config_file): def generate_presentation(): cfg = read_configuration( os.getenv('CONFIGURATION_FILENAME', 'presentation.yml')) prs = Presentation() title_slide = prs.slide_layouts[0] @@ -33,7 +34,8 @@ def layout_handler(layout_name, presentation_object): def generate_slides(): cfg = read_configuration( os.getenv('CONFIGURATION_FILENAME', 'presentation.yml')) prs = Presentation() for i in sorted(cfg): 
- 
        zrks revised this gist Apr 10, 2017 . 2 changed files with 58 additions and 4 deletions.There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,52 @@ pipeline { agent { label "master" } stages { stage('Checkout') { environment { CONFIGURATION_FILENAME = "presentation.yml" PRESENTATION_NAME = "devops-for-powerpoint.pptx" } steps { git url: 'https://gist.github.com/1d5bb58b823185131c23f816d2ec4b8e.git' } } stage('Create virtualenv') { steps { sh 'virtualenv venv' } } stage('Fetch dependencies') { steps { sh '. venv/bin/activate && pip install -r requirements.txt' } } stage('Lint source') { steps { sh "flake8 --show-source --ignore=E999,E113 *.py *.yml" } } stage('Build presentation') { steps { sh ". venv/bin/activate && python generate-presentation.py" } } stage('Archive artifacts') { steps { archive "check.pptx" } } } } 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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ import os import yaml from pptx import Presentation from pptx.util import Inches @@ -12,7 +14,7 @@ def read_configuration(config_file): def generate_presentation(): cfg = read_configuration(os.getenv('CONFIGURATION_FILENAME', 'presentation.yml')) prs = Presentation() title_slide = prs.slide_layouts[0] @@ -21,7 +23,7 @@ def generate_presentation(): title = slide.shapes.title title.text = cfg['title_page']['title'] prs.save(os.getenv('PRESENTATION_NAME', 'devops-for-powerpoint.pptx')) def layout_handler(layout_name, presentation_object): @@ -31,7 +33,7 @@ def layout_handler(layout_name, presentation_object): def generate_slides(): cfg = read_configuration(os.getenv('CONFIGURATION_FILENAME', 'presentation.yml')) prs = Presentation() for i in sorted(cfg): @@ -62,7 +64,7 @@ def generate_slides(): shape.text = 'Step yo: %d' % n left = left + width - Inches(0.4) prs.save(os.getenv('PRESENTATION_NAME', 'devops-for-powerpoint.pptx')) if __name__ == '__main__': 
- 
        zrks revised this gist Apr 10, 2017 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -36,7 +36,7 @@ def generate_slides(): for i in sorted(cfg): slide = prs.slides.add_slide( layout_handler(cfg[i]['slide_layout'], prs)) title = slide.shapes.title title.text = cfg[i]['title'] @@ -52,13 +52,13 @@ def generate_slides(): height = Inches(cfg[i]['position']['height']) shape = shapes.add_shape( MSO_SHAPE.CHEVRON, left, top, width, height) left = left + width - Inches(0.4) width = Inches(2.0) for n in range(2, 6): shape = shapes.add_shape( MSO_SHAPE.CHEVRON, left, top, width, height) shape.text = 'Step yo: %d' % n left = left + width - Inches(0.4) 
- 
        zrks revised this gist Apr 10, 2017 . 2 changed files with 21 additions and 17 deletions.There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -1,22 +1,19 @@ page_1: slide_layout: Title Slide title: DevOps for PowerPoint page_2: slide_layout: Title and Content title: Current approach content: | Current problems Version control page_3: slide_layout: Title Only title: PowerPoint Pipeline position: left: 0.93 top: 3.0 width: 1.75 height: 1.0 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 charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,15 @@ appdirs==1.4.3 autopep8==1.3.1 configparser==3.5.0 enum34==1.1.6 flake8==3.3.0 lxml==3.7.3 mccabe==0.6.1 olefile==0.44 packaging==16.8 Pillow==4.1.0 pycodestyle==2.3.1 pyflakes==1.5.0 pyparsing==2.2.0 python-pptx==0.6.5 PyYAML==3.12 
- 
        zrks revised this gist Apr 9, 2017 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ Just for the kicks 
- 
        zrks created this gist Apr 9, 2017 .There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ Just for the kicks 
- 
        zrks created this gist Apr 9, 2017 .There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,70 @@ import yaml from pptx import Presentation from pptx.util import Inches from pptx.enum.shapes import MSO_SHAPE def read_configuration(config_file): with open(config_file) as f: cfg = yaml.load(f) return cfg def generate_presentation(): cfg = read_configuration('presentation.yml') prs = Presentation() title_slide = prs.slide_layouts[0] slide = prs.slides.add_slide(title_slide) title = slide.shapes.title title.text = cfg['title_page']['title'] prs.save('devops-for-powerpoint.pptx') def layout_handler(layout_name, presentation_object): for layout in presentation_object.slide_layouts: if layout.name == layout_name: return layout def generate_slides(): cfg = read_configuration('presentation.yml') prs = Presentation() for i in sorted(cfg): slide = prs.slides.add_slide( layout_handler(cfg[i]['slide_layout'], prs)) title = slide.shapes.title title.text = cfg[i]['title'] if 'content' in cfg[i]: content = slide.placeholders[1] content.text = cfg[i]['content'] if 'position' in cfg[i]: shapes = slide.shapes left = Inches(cfg[i]['position']['left']) top = Inches(cfg[i]['position']['top']) width = Inches(cfg[i]['position']['width']) height = Inches(cfg[i]['position']['height']) shape = shapes.add_shape( MSO_SHAPE.CHEVRON, left, top, width, height) left = left + width - Inches(0.4) width = Inches(2.0) for n in range(2, 6): shape = shapes.add_shape( MSO_SHAPE.CHEVRON, left, top, width, height) shape.text = 'Step yo: %d' % n left = left + width - Inches(0.4) prs.save('check.pptx') if __name__ == '__main__': # generate_presentation() generate_slides() 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ #title_page: page_1: slide_layout: Title Slide title: DevOps for PowerPoint #second_page: page_2: slide_layout: Title and Content title: Current approach content: | Current problems Version control #third_page: page_3: slide_layout: Title Only title: PowerPoint Pipeline position: left: 0.93 top: 3.0 width: 1.75 height: 1.0 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ appdirs==1.4.3 lxml==3.7.3 olefile==0.44 packaging==16.8 Pillow==4.1.0 pyparsing==2.2.0 python-pptx==0.6.5 PyYAML==3.12 six==1.10.0 XlsxWriter==0.9.6