diff --git a/AWS/quiz_files/quiz1-1.ipynb b/AWS/quiz_files/quiz1-1.ipynb index 14d8d2a..6187480 100644 --- a/AWS/quiz_files/quiz1-1.ipynb +++ b/AWS/quiz_files/quiz1-1.ipynb @@ -2,656 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "56f9232e-9d74-495f-87d8-20a2498d2f86", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "/*!\n", - " * swiped-events.js - v1.1.4\n", - " * Pure JavaScript swipe events\n", - " * https://github.com/john-doherty/swiped-events\n", - " * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element\n", - " * @author John Doherty \n", - " * @license MIT\n", - " */\n", - "!function(t,e){\"use strict\";\"function\"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=e.createEvent(\"CustomEvent\");return a.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),a},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener(\"touchstart\",function(t){if(\"true\"===t.target.getAttribute(\"data-swipe-ignore\"))return;s=t.target,r=Date.now(),n=t.touches[0].clientX,a=t.touches[0].clientY,u=0,i=0},!1),e.addEventListener(\"touchmove\",function(t){if(!n||!a)return;var e=t.touches[0].clientX,r=t.touches[0].clientY;u=n-e,i=a-r},!1),e.addEventListener(\"touchend\",function(t){if(s!==t.target)return;var e=parseInt(l(s,\"data-swipe-threshold\",\"20\"),10),o=parseInt(l(s,\"data-swipe-timeout\",\"500\"),10),c=Date.now()-r,d=\"\",p=t.changedTouches||t.touches||[];Math.abs(u)>Math.abs(i)?Math.abs(u)>e&&c0?\"swiped-left\":\"swiped-right\"):Math.abs(i)>e&&c0?\"swiped-up\":\"swiped-down\");if(\"\"!==d){var b={dir:d.replace(/swiped-/,\"\"),xStart:parseInt(n,10),xEnd:parseInt((p[0]||{}).clientX||-1,10),yStart:parseInt(a,10),yEnd:parseInt((p[0]||{}).clientY||-1,10)};s.dispatchEvent(new CustomEvent(\"swiped\",{bubbles:!0,cancelable:!0,detail:b})),s.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:b}))}n=null,a=null,r=null},!1);var n=null,a=null,u=null,i=null,r=null,s=null;function l(t,n,a){for(;t&&t!==e.documentElement;){var u=t.getAttribute(n);if(u)return u;t=t.parentNode}return a}}(window,document);\n", - "\n", - "function jaxify(string) {\n", - " var mystring = string;\n", - " console.log(mystring);\n", - "\n", - " var count = 0;\n", - " var loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - "\n", - " var count2 = 0;\n", - " var loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - "\n", - " //console.log(loc);\n", - "\n", - " while ((loc >= 0) || (loc2 >= 0)) {\n", - "\n", - " /* Have to replace all the double $$ first with current implementation */\n", - " if (loc2 >= 0) {\n", - " if (count2 % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\[\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\]\");\n", - " }\n", - " count2++;\n", - " } else {\n", - " if (count % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\(\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\)\");\n", - " }\n", - " count++;\n", - " }\n", - " loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - " loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - " //console.log(mystring,\", loc:\",loc,\", loc2:\",loc2);\n", - " }\n", - "\n", - " //console.log(mystring);\n", - " return mystring;\n", - "}\n", - "\n", - "window.flipCard = function flipCard(ths) {\n", - " console.log(ths);\n", - " console.log(ths.id);\n", - " ths.classList.toggle(\"flip\"); \n", - " var next=document.getElementById(ths.id+'-next');\n", - " next.style.pointerEvents='none';\n", - " /* ths.blur(); */\n", - " next.classList.add('flipped');\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([ths]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " setTimeout(reenableNext, 600, ths, next);\n", - "}\n", - "\n", - "window.checkKey = function checkKey(container, event) {\n", - " event.stopPropagation();\n", - " /*\n", - " console.log(container);\n", - " console.log(event.key);\n", - " console.log(event.code);\n", - " */\n", - " /* JMS: Working here*/\n", - " var next=document.getElementById(container.id+'-next');\n", - " /* Only react if not already sliding */\n", - " if (! next.classList.contains(\"hide\")) {\n", - " if ((event.key == \"j\") || (event.key == \"Enter\") || (event.key == \"ArrowRight\")) {\n", - " window.checkFlip(container.id);\n", - " }\n", - " if (event.key == \" \") {\n", - " window.flipCard(container);\n", - " }\n", - " }\n", - " event.preventDefault();\n", - "}\n", - "\n", - "\n", - "function reenableNext(ths, next) {\n", - " next.style.pointerEvents='auto';\n", - " /* ths.tabIndex= 0;*/\n", - " /* ths.focus(); */\n", - "}\n", - "\n", - "\n", - "\n", - "function slide2(containerId) {\n", - " var container = document.getElementById(containerId);\n", - " var next=document.getElementById(containerId+'-next');\n", - " var frontcard = container.children[0];\n", - " var backcard = container.children[1];\n", - " container.style.pointerEvents='none';\n", - " /* container.removeAttribute(\"tabindex\");*/\n", - " /* container.blur(); */\n", - " //backcard.style.pointerEvents='none';\n", - " next.style.pointerEvents='none';\n", - " next.classList.remove('flipped');\n", - " next.classList.add('hide');\n", - "\n", - " //container.classList.add(\"prepare\");\n", - " \n", - " container.className=\"flip-container slide\";\n", - " backcard.parentElement.removeChild(frontcard);\n", - " backcard.parentElement.appendChild(frontcard);\n", - " setTimeout(slideback, 600, container, frontcard, backcard, next);\n", - " \n", - "}\n", - "\n", - "\n", - "window.checkFlip = function checkFlip(containerId) {\n", - " var container = document.getElementById(containerId);\n", - "\n", - "\n", - " if (container.classList.contains('flip')) {\n", - " container.classList.remove('flip');\n", - " setTimeout(slide2, 600, containerId);\n", - " } \n", - " else {\n", - " slide2(containerId);\n", - " }\n", - "}\n", - "\n", - "\n", - "function slideback(container, frontcard, backcard, next) {\n", - " container.className=\"flip-container slideback\";\n", - " setTimeout(cleanup, 550, container, frontcard, backcard, next);\n", - "}\n", - "\n", - "function cleanup(container, frontcard, backcard, next) {\n", - " container.removeChild(frontcard);\n", - " backcard.className=\"flipper frontcard\";\n", - " container.className=\"flip-container\";\n", - "\n", - " var cardnum=parseInt(container.dataset.cardnum);\n", - " var cards=eval('cards'+container.id);\n", - " var flipper=createOneCard(container, false, cards, cardnum);\n", - " container.append(flipper);\n", - " cardnum= (cardnum+1) % parseInt(container.dataset.numCards);\n", - " container.dataset.cardnum=cardnum;\n", - " if (cardnum != 1){\n", - " next.innerHTML=\"Next >\";\n", - " } else {\n", - " //next.innerHTML=\"Reload \\\\(\\\\circlearrowleft\\\\) \";\n", - " next.innerHTML='Reload '\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([next]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " }\n", - "\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset();\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " next.style.pointerEvents='auto';\n", - " container.style.pointerEvents='auto';\n", - " /* container.tabIndex= 0; */\n", - " /* container.focus(); */\n", - " next.classList.remove('hide');\n", - " container.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(container.id);\n", - " }, {once: true });\n", - "\n", - "\n", - "}\n", - "\n", - "\n", - "function createOneCard (mydiv, frontCard, cards, cardnum) {\n", - " var colors=[\n", - " '--asparagus',\n", - " '--terra-cotta',\n", - " '--cyan-process'\n", - " ]\n", - "\n", - " var flipper = document.createElement('div');\n", - " if (frontCard){\n", - " flipper.className=\"flipper frontcard\"; \n", - " }\n", - " else {\n", - " flipper.className=\"flipper backcard\"; \n", - " }\n", - "\n", - " var front = document.createElement('div');\n", - " front.className='front flashcard';\n", - "\n", - " var frontSpan= document.createElement('span');\n", - " frontSpan.className='flashcardtext';\n", - " frontSpan.innerHTML=jaxify(cards[cardnum]['front']);\n", - " //frontSpan.textContent=jaxify(cards[cardnum]['front']);\n", - " front.style.background='var(' + colors[cardnum % colors.length] + ')';\n", - "\n", - "\n", - " front.append(frontSpan);\n", - " flipper.append(front);\n", - "\n", - " var back = document.createElement('div');\n", - " back.className='back flashcard';\n", - "\n", - " var backSpan= document.createElement('span');\n", - " backSpan.className='flashcardtext';\n", - " backSpan.innerHTML=jaxify(cards[cardnum]['back']);\n", - " back.append(backSpan);\n", - "\n", - " flipper.append(back);\n", - "\n", - " return flipper;\n", - "\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "function createCards(id, keyControl) {\n", - " console.log(id);\n", - " \n", - " var mydiv=document.getElementById(id);\n", - " /*mydiv.onclick = window.flipCard(mydiv);*/\n", - " /*\n", - " mydiv.addEventListener('click', function(){window.flipCard(mydiv);}, false);\n", - " mydiv.addEventListener('keydown', function(event){window.checkKey(mydiv,event);}, true);\n", - " */\n", - " mydiv.onclick = function(){window.flipCard(mydiv);};\n", - " console.log(keyControl);\n", - " if (keyControl == \"True\"){\n", - " mydiv.onkeydown = function(event){window.checkKey(mydiv,event);};\n", - " }\n", - " /* mydiv.addEventListener('keydown', function(event){event.stopPropagation(); console.log(event); event.preventDefault();}, true); */\n", - " /*mydiv.onkeypress = function(event){console.log(event); event.preventDefault();};*/\n", - "\n", - " console.log(mydiv);\n", - " \n", - " var cards=eval('cards'+id);\n", - " mydiv.dataset.cardnum=0;\n", - " mydiv.dataset.numCards=cards.length;\n", - " mydiv.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(id);\n", - " }, {once: true});\n", - "\n", - " var cardnum=0;\n", - " \n", - " for (var i=0; i<2; i++) {\n", - " \n", - " var flipper;\n", - " if (i==0){\n", - " flipper=createOneCard(mydiv, true, cards, cardnum);\n", - " }\n", - " else {\n", - " flipper=createOneCard(mydiv, false, cards, cardnum);\n", - " }\n", - "\n", - " mydiv.append(flipper);\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " if (typeof version == 'undefined') {\n", - " setTimeout(function(){\n", - " var version = MathJax.version;\n", - " console.log('After sleep, MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }, 500);\n", - " } else{\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " cardnum = (cardnum + 1) % mydiv.dataset.numCards;\n", - " }\n", - " mydiv.dataset.cardnum = cardnum;\n", - "\n", - " var next=document.getElementById(id+'-next');\n", - " if (cards.length==1) {\n", - " // Don't show next if no other cards!\n", - " next.style.pointerEvents='none';\n", - " next.classList.add('hide');\n", - " } else {\n", - " next.innerHTML=\"Next >\";\n", - " }\n", - "\n", - " mydiv.focus();\n", - "\n", - " return flipper;\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "var cardshRwdEmEhQweG=[\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \"The # sign comments out whatever is typed after it, this is helpful for annotating code blocks, or running only specific lines of code.\"\n", - " }\n", - "];\n", - " \n", - " createCards(\"hRwdEmEhQweG\", \"True\");\n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from jupytercards import display_flashcards\n", "#cards='/home/jupyter/flashcards/'\n", @@ -659,31 +13,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "tf2-gpu.2-8.m102", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/tf2-gpu.2-8:m102" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/AWS/quiz_files/quiz1-2.ipynb b/AWS/quiz_files/quiz1-2.ipynb index 5136248..9e2b1da 100644 --- a/AWS/quiz_files/quiz1-2.ipynb +++ b/AWS/quiz_files/quiz1-2.ipynb @@ -2,660 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "bcd03b54-2de6-45d4-a128-b76b3c4b5177", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "/*!\n", - " * swiped-events.js - v1.1.4\n", - " * Pure JavaScript swipe events\n", - " * https://github.com/john-doherty/swiped-events\n", - " * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element\n", - " * @author John Doherty \n", - " * @license MIT\n", - " */\n", - "!function(t,e){\"use strict\";\"function\"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=e.createEvent(\"CustomEvent\");return a.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),a},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener(\"touchstart\",function(t){if(\"true\"===t.target.getAttribute(\"data-swipe-ignore\"))return;s=t.target,r=Date.now(),n=t.touches[0].clientX,a=t.touches[0].clientY,u=0,i=0},!1),e.addEventListener(\"touchmove\",function(t){if(!n||!a)return;var e=t.touches[0].clientX,r=t.touches[0].clientY;u=n-e,i=a-r},!1),e.addEventListener(\"touchend\",function(t){if(s!==t.target)return;var e=parseInt(l(s,\"data-swipe-threshold\",\"20\"),10),o=parseInt(l(s,\"data-swipe-timeout\",\"500\"),10),c=Date.now()-r,d=\"\",p=t.changedTouches||t.touches||[];Math.abs(u)>Math.abs(i)?Math.abs(u)>e&&c0?\"swiped-left\":\"swiped-right\"):Math.abs(i)>e&&c0?\"swiped-up\":\"swiped-down\");if(\"\"!==d){var b={dir:d.replace(/swiped-/,\"\"),xStart:parseInt(n,10),xEnd:parseInt((p[0]||{}).clientX||-1,10),yStart:parseInt(a,10),yEnd:parseInt((p[0]||{}).clientY||-1,10)};s.dispatchEvent(new CustomEvent(\"swiped\",{bubbles:!0,cancelable:!0,detail:b})),s.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:b}))}n=null,a=null,r=null},!1);var n=null,a=null,u=null,i=null,r=null,s=null;function l(t,n,a){for(;t&&t!==e.documentElement;){var u=t.getAttribute(n);if(u)return u;t=t.parentNode}return a}}(window,document);\n", - "\n", - "function jaxify(string) {\n", - " var mystring = string;\n", - " console.log(mystring);\n", - "\n", - " var count = 0;\n", - " var loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - "\n", - " var count2 = 0;\n", - " var loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - "\n", - " //console.log(loc);\n", - "\n", - " while ((loc >= 0) || (loc2 >= 0)) {\n", - "\n", - " /* Have to replace all the double $$ first with current implementation */\n", - " if (loc2 >= 0) {\n", - " if (count2 % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\[\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\]\");\n", - " }\n", - " count2++;\n", - " } else {\n", - " if (count % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\(\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\)\");\n", - " }\n", - " count++;\n", - " }\n", - " loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - " loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - " //console.log(mystring,\", loc:\",loc,\", loc2:\",loc2);\n", - " }\n", - "\n", - " //console.log(mystring);\n", - " return mystring;\n", - "}\n", - "\n", - "window.flipCard = function flipCard(ths) {\n", - " console.log(ths);\n", - " console.log(ths.id);\n", - " ths.classList.toggle(\"flip\"); \n", - " var next=document.getElementById(ths.id+'-next');\n", - " next.style.pointerEvents='none';\n", - " /* ths.blur(); */\n", - " next.classList.add('flipped');\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([ths]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " setTimeout(reenableNext, 600, ths, next);\n", - "}\n", - "\n", - "window.checkKey = function checkKey(container, event) {\n", - " event.stopPropagation();\n", - " /*\n", - " console.log(container);\n", - " console.log(event.key);\n", - " console.log(event.code);\n", - " */\n", - " /* JMS: Working here*/\n", - " var next=document.getElementById(container.id+'-next');\n", - " /* Only react if not already sliding */\n", - " if (! next.classList.contains(\"hide\")) {\n", - " if ((event.key == \"j\") || (event.key == \"Enter\") || (event.key == \"ArrowRight\")) {\n", - " window.checkFlip(container.id);\n", - " }\n", - " if (event.key == \" \") {\n", - " window.flipCard(container);\n", - " }\n", - " }\n", - " event.preventDefault();\n", - "}\n", - "\n", - "\n", - "function reenableNext(ths, next) {\n", - " next.style.pointerEvents='auto';\n", - " /* ths.tabIndex= 0;*/\n", - " /* ths.focus(); */\n", - "}\n", - "\n", - "\n", - "\n", - "function slide2(containerId) {\n", - " var container = document.getElementById(containerId);\n", - " var next=document.getElementById(containerId+'-next');\n", - " var frontcard = container.children[0];\n", - " var backcard = container.children[1];\n", - " container.style.pointerEvents='none';\n", - " /* container.removeAttribute(\"tabindex\");*/\n", - " /* container.blur(); */\n", - " //backcard.style.pointerEvents='none';\n", - " next.style.pointerEvents='none';\n", - " next.classList.remove('flipped');\n", - " next.classList.add('hide');\n", - "\n", - " //container.classList.add(\"prepare\");\n", - " \n", - " container.className=\"flip-container slide\";\n", - " backcard.parentElement.removeChild(frontcard);\n", - " backcard.parentElement.appendChild(frontcard);\n", - " setTimeout(slideback, 600, container, frontcard, backcard, next);\n", - " \n", - "}\n", - "\n", - "\n", - "window.checkFlip = function checkFlip(containerId) {\n", - " var container = document.getElementById(containerId);\n", - "\n", - "\n", - " if (container.classList.contains('flip')) {\n", - " container.classList.remove('flip');\n", - " setTimeout(slide2, 600, containerId);\n", - " } \n", - " else {\n", - " slide2(containerId);\n", - " }\n", - "}\n", - "\n", - "\n", - "function slideback(container, frontcard, backcard, next) {\n", - " container.className=\"flip-container slideback\";\n", - " setTimeout(cleanup, 550, container, frontcard, backcard, next);\n", - "}\n", - "\n", - "function cleanup(container, frontcard, backcard, next) {\n", - " container.removeChild(frontcard);\n", - " backcard.className=\"flipper frontcard\";\n", - " container.className=\"flip-container\";\n", - "\n", - " var cardnum=parseInt(container.dataset.cardnum);\n", - " var cards=eval('cards'+container.id);\n", - " var flipper=createOneCard(container, false, cards, cardnum);\n", - " container.append(flipper);\n", - " cardnum= (cardnum+1) % parseInt(container.dataset.numCards);\n", - " container.dataset.cardnum=cardnum;\n", - " if (cardnum != 1){\n", - " next.innerHTML=\"Next >\";\n", - " } else {\n", - " //next.innerHTML=\"Reload \\\\(\\\\circlearrowleft\\\\) \";\n", - " next.innerHTML='Reload '\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([next]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " }\n", - "\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset();\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " next.style.pointerEvents='auto';\n", - " container.style.pointerEvents='auto';\n", - " /* container.tabIndex= 0; */\n", - " /* container.focus(); */\n", - " next.classList.remove('hide');\n", - " container.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(container.id);\n", - " }, {once: true });\n", - "\n", - "\n", - "}\n", - "\n", - "\n", - "function createOneCard (mydiv, frontCard, cards, cardnum) {\n", - " var colors=[\n", - " '--asparagus',\n", - " '--terra-cotta',\n", - " '--cyan-process'\n", - " ]\n", - "\n", - " var flipper = document.createElement('div');\n", - " if (frontCard){\n", - " flipper.className=\"flipper frontcard\"; \n", - " }\n", - " else {\n", - " flipper.className=\"flipper backcard\"; \n", - " }\n", - "\n", - " var front = document.createElement('div');\n", - " front.className='front flashcard';\n", - "\n", - " var frontSpan= document.createElement('span');\n", - " frontSpan.className='flashcardtext';\n", - " frontSpan.innerHTML=jaxify(cards[cardnum]['front']);\n", - " //frontSpan.textContent=jaxify(cards[cardnum]['front']);\n", - " front.style.background='var(' + colors[cardnum % colors.length] + ')';\n", - "\n", - "\n", - " front.append(frontSpan);\n", - " flipper.append(front);\n", - "\n", - " var back = document.createElement('div');\n", - " back.className='back flashcard';\n", - "\n", - " var backSpan= document.createElement('span');\n", - " backSpan.className='flashcardtext';\n", - " backSpan.innerHTML=jaxify(cards[cardnum]['back']);\n", - " back.append(backSpan);\n", - "\n", - " flipper.append(back);\n", - "\n", - " return flipper;\n", - "\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "function createCards(id, keyControl) {\n", - " console.log(id);\n", - " \n", - " var mydiv=document.getElementById(id);\n", - " /*mydiv.onclick = window.flipCard(mydiv);*/\n", - " /*\n", - " mydiv.addEventListener('click', function(){window.flipCard(mydiv);}, false);\n", - " mydiv.addEventListener('keydown', function(event){window.checkKey(mydiv,event);}, true);\n", - " */\n", - " mydiv.onclick = function(){window.flipCard(mydiv);};\n", - " console.log(keyControl);\n", - " if (keyControl == \"True\"){\n", - " mydiv.onkeydown = function(event){window.checkKey(mydiv,event);};\n", - " }\n", - " /* mydiv.addEventListener('keydown', function(event){event.stopPropagation(); console.log(event); event.preventDefault();}, true); */\n", - " /*mydiv.onkeypress = function(event){console.log(event); event.preventDefault();};*/\n", - "\n", - " console.log(mydiv);\n", - " \n", - " var cards=eval('cards'+id);\n", - " mydiv.dataset.cardnum=0;\n", - " mydiv.dataset.numCards=cards.length;\n", - " mydiv.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(id);\n", - " }, {once: true});\n", - "\n", - " var cardnum=0;\n", - " \n", - " for (var i=0; i<2; i++) {\n", - " \n", - " var flipper;\n", - " if (i==0){\n", - " flipper=createOneCard(mydiv, true, cards, cardnum);\n", - " }\n", - " else {\n", - " flipper=createOneCard(mydiv, false, cards, cardnum);\n", - " }\n", - "\n", - " mydiv.append(flipper);\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " if (typeof version == 'undefined') {\n", - " setTimeout(function(){\n", - " var version = MathJax.version;\n", - " console.log('After sleep, MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }, 500);\n", - " } else{\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " cardnum = (cardnum + 1) % mydiv.dataset.numCards;\n", - " }\n", - " mydiv.dataset.cardnum = cardnum;\n", - "\n", - " var next=document.getElementById(id+'-next');\n", - " if (cards.length==1) {\n", - " // Don't show next if no other cards!\n", - " next.style.pointerEvents='none';\n", - " next.classList.add('hide');\n", - " } else {\n", - " next.innerHTML=\"Next >\";\n", - " }\n", - "\n", - " mydiv.focus();\n", - "\n", - " return flipper;\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "var cardslhohnItYRLgs=[\n", - " {\n", - " \"front\": \"hint\",\n", - " \"back\": \"mkdir creates new directories.\"\n", - " },\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \"mkdir -p /home/jupyter/my_directory
mkdir -p /home/jupyter/new_dir\"\n", - " }\n", - "];\n", - " \n", - " createCards(\"lhohnItYRLgs\", \"True\");\n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from jupytercards import display_flashcards\n", "cards='/home/jupyter/flashcards/'\n", @@ -663,31 +13,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "tf2-gpu.2-8.m102", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/tf2-gpu.2-8:m102" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/AWS/quiz_files/quiz1-3.ipynb b/AWS/quiz_files/quiz1-3.ipynb index e0f43d3..b70b691 100644 --- a/AWS/quiz_files/quiz1-3.ipynb +++ b/AWS/quiz_files/quiz1-3.ipynb @@ -2,660 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "113fb089-7d61-481e-9473-f72bf2ed5371", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "/*!\n", - " * swiped-events.js - v1.1.4\n", - " * Pure JavaScript swipe events\n", - " * https://github.com/john-doherty/swiped-events\n", - " * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element\n", - " * @author John Doherty \n", - " * @license MIT\n", - " */\n", - "!function(t,e){\"use strict\";\"function\"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=e.createEvent(\"CustomEvent\");return a.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),a},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener(\"touchstart\",function(t){if(\"true\"===t.target.getAttribute(\"data-swipe-ignore\"))return;s=t.target,r=Date.now(),n=t.touches[0].clientX,a=t.touches[0].clientY,u=0,i=0},!1),e.addEventListener(\"touchmove\",function(t){if(!n||!a)return;var e=t.touches[0].clientX,r=t.touches[0].clientY;u=n-e,i=a-r},!1),e.addEventListener(\"touchend\",function(t){if(s!==t.target)return;var e=parseInt(l(s,\"data-swipe-threshold\",\"20\"),10),o=parseInt(l(s,\"data-swipe-timeout\",\"500\"),10),c=Date.now()-r,d=\"\",p=t.changedTouches||t.touches||[];Math.abs(u)>Math.abs(i)?Math.abs(u)>e&&c0?\"swiped-left\":\"swiped-right\"):Math.abs(i)>e&&c0?\"swiped-up\":\"swiped-down\");if(\"\"!==d){var b={dir:d.replace(/swiped-/,\"\"),xStart:parseInt(n,10),xEnd:parseInt((p[0]||{}).clientX||-1,10),yStart:parseInt(a,10),yEnd:parseInt((p[0]||{}).clientY||-1,10)};s.dispatchEvent(new CustomEvent(\"swiped\",{bubbles:!0,cancelable:!0,detail:b})),s.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:b}))}n=null,a=null,r=null},!1);var n=null,a=null,u=null,i=null,r=null,s=null;function l(t,n,a){for(;t&&t!==e.documentElement;){var u=t.getAttribute(n);if(u)return u;t=t.parentNode}return a}}(window,document);\n", - "\n", - "function jaxify(string) {\n", - " var mystring = string;\n", - " console.log(mystring);\n", - "\n", - " var count = 0;\n", - " var loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - "\n", - " var count2 = 0;\n", - " var loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - "\n", - " //console.log(loc);\n", - "\n", - " while ((loc >= 0) || (loc2 >= 0)) {\n", - "\n", - " /* Have to replace all the double $$ first with current implementation */\n", - " if (loc2 >= 0) {\n", - " if (count2 % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\[\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\]\");\n", - " }\n", - " count2++;\n", - " } else {\n", - " if (count % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\(\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\)\");\n", - " }\n", - " count++;\n", - " }\n", - " loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - " loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - " //console.log(mystring,\", loc:\",loc,\", loc2:\",loc2);\n", - " }\n", - "\n", - " //console.log(mystring);\n", - " return mystring;\n", - "}\n", - "\n", - "window.flipCard = function flipCard(ths) {\n", - " console.log(ths);\n", - " console.log(ths.id);\n", - " ths.classList.toggle(\"flip\"); \n", - " var next=document.getElementById(ths.id+'-next');\n", - " next.style.pointerEvents='none';\n", - " /* ths.blur(); */\n", - " next.classList.add('flipped');\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([ths]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " setTimeout(reenableNext, 600, ths, next);\n", - "}\n", - "\n", - "window.checkKey = function checkKey(container, event) {\n", - " event.stopPropagation();\n", - " /*\n", - " console.log(container);\n", - " console.log(event.key);\n", - " console.log(event.code);\n", - " */\n", - " /* JMS: Working here*/\n", - " var next=document.getElementById(container.id+'-next');\n", - " /* Only react if not already sliding */\n", - " if (! next.classList.contains(\"hide\")) {\n", - " if ((event.key == \"j\") || (event.key == \"Enter\") || (event.key == \"ArrowRight\")) {\n", - " window.checkFlip(container.id);\n", - " }\n", - " if (event.key == \" \") {\n", - " window.flipCard(container);\n", - " }\n", - " }\n", - " event.preventDefault();\n", - "}\n", - "\n", - "\n", - "function reenableNext(ths, next) {\n", - " next.style.pointerEvents='auto';\n", - " /* ths.tabIndex= 0;*/\n", - " /* ths.focus(); */\n", - "}\n", - "\n", - "\n", - "\n", - "function slide2(containerId) {\n", - " var container = document.getElementById(containerId);\n", - " var next=document.getElementById(containerId+'-next');\n", - " var frontcard = container.children[0];\n", - " var backcard = container.children[1];\n", - " container.style.pointerEvents='none';\n", - " /* container.removeAttribute(\"tabindex\");*/\n", - " /* container.blur(); */\n", - " //backcard.style.pointerEvents='none';\n", - " next.style.pointerEvents='none';\n", - " next.classList.remove('flipped');\n", - " next.classList.add('hide');\n", - "\n", - " //container.classList.add(\"prepare\");\n", - " \n", - " container.className=\"flip-container slide\";\n", - " backcard.parentElement.removeChild(frontcard);\n", - " backcard.parentElement.appendChild(frontcard);\n", - " setTimeout(slideback, 600, container, frontcard, backcard, next);\n", - " \n", - "}\n", - "\n", - "\n", - "window.checkFlip = function checkFlip(containerId) {\n", - " var container = document.getElementById(containerId);\n", - "\n", - "\n", - " if (container.classList.contains('flip')) {\n", - " container.classList.remove('flip');\n", - " setTimeout(slide2, 600, containerId);\n", - " } \n", - " else {\n", - " slide2(containerId);\n", - " }\n", - "}\n", - "\n", - "\n", - "function slideback(container, frontcard, backcard, next) {\n", - " container.className=\"flip-container slideback\";\n", - " setTimeout(cleanup, 550, container, frontcard, backcard, next);\n", - "}\n", - "\n", - "function cleanup(container, frontcard, backcard, next) {\n", - " container.removeChild(frontcard);\n", - " backcard.className=\"flipper frontcard\";\n", - " container.className=\"flip-container\";\n", - "\n", - " var cardnum=parseInt(container.dataset.cardnum);\n", - " var cards=eval('cards'+container.id);\n", - " var flipper=createOneCard(container, false, cards, cardnum);\n", - " container.append(flipper);\n", - " cardnum= (cardnum+1) % parseInt(container.dataset.numCards);\n", - " container.dataset.cardnum=cardnum;\n", - " if (cardnum != 1){\n", - " next.innerHTML=\"Next >\";\n", - " } else {\n", - " //next.innerHTML=\"Reload \\\\(\\\\circlearrowleft\\\\) \";\n", - " next.innerHTML='Reload '\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([next]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " }\n", - "\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset();\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " next.style.pointerEvents='auto';\n", - " container.style.pointerEvents='auto';\n", - " /* container.tabIndex= 0; */\n", - " /* container.focus(); */\n", - " next.classList.remove('hide');\n", - " container.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(container.id);\n", - " }, {once: true });\n", - "\n", - "\n", - "}\n", - "\n", - "\n", - "function createOneCard (mydiv, frontCard, cards, cardnum) {\n", - " var colors=[\n", - " '--asparagus',\n", - " '--terra-cotta',\n", - " '--cyan-process'\n", - " ]\n", - "\n", - " var flipper = document.createElement('div');\n", - " if (frontCard){\n", - " flipper.className=\"flipper frontcard\"; \n", - " }\n", - " else {\n", - " flipper.className=\"flipper backcard\"; \n", - " }\n", - "\n", - " var front = document.createElement('div');\n", - " front.className='front flashcard';\n", - "\n", - " var frontSpan= document.createElement('span');\n", - " frontSpan.className='flashcardtext';\n", - " frontSpan.innerHTML=jaxify(cards[cardnum]['front']);\n", - " //frontSpan.textContent=jaxify(cards[cardnum]['front']);\n", - " front.style.background='var(' + colors[cardnum % colors.length] + ')';\n", - "\n", - "\n", - " front.append(frontSpan);\n", - " flipper.append(front);\n", - "\n", - " var back = document.createElement('div');\n", - " back.className='back flashcard';\n", - "\n", - " var backSpan= document.createElement('span');\n", - " backSpan.className='flashcardtext';\n", - " backSpan.innerHTML=jaxify(cards[cardnum]['back']);\n", - " back.append(backSpan);\n", - "\n", - " flipper.append(back);\n", - "\n", - " return flipper;\n", - "\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "function createCards(id, keyControl) {\n", - " console.log(id);\n", - " \n", - " var mydiv=document.getElementById(id);\n", - " /*mydiv.onclick = window.flipCard(mydiv);*/\n", - " /*\n", - " mydiv.addEventListener('click', function(){window.flipCard(mydiv);}, false);\n", - " mydiv.addEventListener('keydown', function(event){window.checkKey(mydiv,event);}, true);\n", - " */\n", - " mydiv.onclick = function(){window.flipCard(mydiv);};\n", - " console.log(keyControl);\n", - " if (keyControl == \"True\"){\n", - " mydiv.onkeydown = function(event){window.checkKey(mydiv,event);};\n", - " }\n", - " /* mydiv.addEventListener('keydown', function(event){event.stopPropagation(); console.log(event); event.preventDefault();}, true); */\n", - " /*mydiv.onkeypress = function(event){console.log(event); event.preventDefault();};*/\n", - "\n", - " console.log(mydiv);\n", - " \n", - " var cards=eval('cards'+id);\n", - " mydiv.dataset.cardnum=0;\n", - " mydiv.dataset.numCards=cards.length;\n", - " mydiv.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(id);\n", - " }, {once: true});\n", - "\n", - " var cardnum=0;\n", - " \n", - " for (var i=0; i<2; i++) {\n", - " \n", - " var flipper;\n", - " if (i==0){\n", - " flipper=createOneCard(mydiv, true, cards, cardnum);\n", - " }\n", - " else {\n", - " flipper=createOneCard(mydiv, false, cards, cardnum);\n", - " }\n", - "\n", - " mydiv.append(flipper);\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " if (typeof version == 'undefined') {\n", - " setTimeout(function(){\n", - " var version = MathJax.version;\n", - " console.log('After sleep, MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }, 500);\n", - " } else{\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " cardnum = (cardnum + 1) % mydiv.dataset.numCards;\n", - " }\n", - " mydiv.dataset.cardnum = cardnum;\n", - "\n", - " var next=document.getElementById(id+'-next');\n", - " if (cards.length==1) {\n", - " // Don't show next if no other cards!\n", - " next.style.pointerEvents='none';\n", - " next.classList.add('hide');\n", - " } else {\n", - " next.innerHTML=\"Next >\";\n", - " }\n", - "\n", - " mydiv.focus();\n", - "\n", - " return flipper;\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "var cardsnKNgAFpXWoik=[\n", - " {\n", - " \"front\": \"hint\",\n", - " \"back\": \"use the command pwd to remind you of the absolute path of where you are. Use this to get the absolute path of where you need to go, and use this to understand the directory structure for the relative path.\"\n", - " },\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \"cd /home/jupyter/my_directory
cd ../new_dir\"\n", - " }\n", - "];\n", - " \n", - " createCards(\"nKNgAFpXWoik\", \"True\");\n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from jupytercards import display_flashcards\n", "cards='/home/jupyter/flashcards/'\n", @@ -663,31 +13,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "tf2-gpu.2-8.m102", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/tf2-gpu.2-8:m102" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/AWS/quiz_files/quiz3-1.ipynb b/AWS/quiz_files/quiz3-1.ipynb index 7b4be41..eae5413 100644 --- a/AWS/quiz_files/quiz3-1.ipynb +++ b/AWS/quiz_files/quiz3-1.ipynb @@ -2,660 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "113fb089-7d61-481e-9473-f72bf2ed5371", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "/*!\n", - " * swiped-events.js - v1.1.4\n", - " * Pure JavaScript swipe events\n", - " * https://github.com/john-doherty/swiped-events\n", - " * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element\n", - " * @author John Doherty \n", - " * @license MIT\n", - " */\n", - "!function(t,e){\"use strict\";\"function\"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=e.createEvent(\"CustomEvent\");return a.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),a},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener(\"touchstart\",function(t){if(\"true\"===t.target.getAttribute(\"data-swipe-ignore\"))return;s=t.target,r=Date.now(),n=t.touches[0].clientX,a=t.touches[0].clientY,u=0,i=0},!1),e.addEventListener(\"touchmove\",function(t){if(!n||!a)return;var e=t.touches[0].clientX,r=t.touches[0].clientY;u=n-e,i=a-r},!1),e.addEventListener(\"touchend\",function(t){if(s!==t.target)return;var e=parseInt(l(s,\"data-swipe-threshold\",\"20\"),10),o=parseInt(l(s,\"data-swipe-timeout\",\"500\"),10),c=Date.now()-r,d=\"\",p=t.changedTouches||t.touches||[];Math.abs(u)>Math.abs(i)?Math.abs(u)>e&&c0?\"swiped-left\":\"swiped-right\"):Math.abs(i)>e&&c0?\"swiped-up\":\"swiped-down\");if(\"\"!==d){var b={dir:d.replace(/swiped-/,\"\"),xStart:parseInt(n,10),xEnd:parseInt((p[0]||{}).clientX||-1,10),yStart:parseInt(a,10),yEnd:parseInt((p[0]||{}).clientY||-1,10)};s.dispatchEvent(new CustomEvent(\"swiped\",{bubbles:!0,cancelable:!0,detail:b})),s.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:b}))}n=null,a=null,r=null},!1);var n=null,a=null,u=null,i=null,r=null,s=null;function l(t,n,a){for(;t&&t!==e.documentElement;){var u=t.getAttribute(n);if(u)return u;t=t.parentNode}return a}}(window,document);\n", - "\n", - "function jaxify(string) {\n", - " var mystring = string;\n", - " console.log(mystring);\n", - "\n", - " var count = 0;\n", - " var loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - "\n", - " var count2 = 0;\n", - " var loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - "\n", - " //console.log(loc);\n", - "\n", - " while ((loc >= 0) || (loc2 >= 0)) {\n", - "\n", - " /* Have to replace all the double $$ first with current implementation */\n", - " if (loc2 >= 0) {\n", - " if (count2 % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\[\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\]\");\n", - " }\n", - " count2++;\n", - " } else {\n", - " if (count % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\(\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\)\");\n", - " }\n", - " count++;\n", - " }\n", - " loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - " loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - " //console.log(mystring,\", loc:\",loc,\", loc2:\",loc2);\n", - " }\n", - "\n", - " //console.log(mystring);\n", - " return mystring;\n", - "}\n", - "\n", - "window.flipCard = function flipCard(ths) {\n", - " console.log(ths);\n", - " console.log(ths.id);\n", - " ths.classList.toggle(\"flip\"); \n", - " var next=document.getElementById(ths.id+'-next');\n", - " next.style.pointerEvents='none';\n", - " /* ths.blur(); */\n", - " next.classList.add('flipped');\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([ths]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " setTimeout(reenableNext, 600, ths, next);\n", - "}\n", - "\n", - "window.checkKey = function checkKey(container, event) {\n", - " event.stopPropagation();\n", - " /*\n", - " console.log(container);\n", - " console.log(event.key);\n", - " console.log(event.code);\n", - " */\n", - " /* JMS: Working here*/\n", - " var next=document.getElementById(container.id+'-next');\n", - " /* Only react if not already sliding */\n", - " if (! next.classList.contains(\"hide\")) {\n", - " if ((event.key == \"j\") || (event.key == \"Enter\") || (event.key == \"ArrowRight\")) {\n", - " window.checkFlip(container.id);\n", - " }\n", - " if (event.key == \" \") {\n", - " window.flipCard(container);\n", - " }\n", - " }\n", - " event.preventDefault();\n", - "}\n", - "\n", - "\n", - "function reenableNext(ths, next) {\n", - " next.style.pointerEvents='auto';\n", - " /* ths.tabIndex= 0;*/\n", - " /* ths.focus(); */\n", - "}\n", - "\n", - "\n", - "\n", - "function slide2(containerId) {\n", - " var container = document.getElementById(containerId);\n", - " var next=document.getElementById(containerId+'-next');\n", - " var frontcard = container.children[0];\n", - " var backcard = container.children[1];\n", - " container.style.pointerEvents='none';\n", - " /* container.removeAttribute(\"tabindex\");*/\n", - " /* container.blur(); */\n", - " //backcard.style.pointerEvents='none';\n", - " next.style.pointerEvents='none';\n", - " next.classList.remove('flipped');\n", - " next.classList.add('hide');\n", - "\n", - " //container.classList.add(\"prepare\");\n", - " \n", - " container.className=\"flip-container slide\";\n", - " backcard.parentElement.removeChild(frontcard);\n", - " backcard.parentElement.appendChild(frontcard);\n", - " setTimeout(slideback, 600, container, frontcard, backcard, next);\n", - " \n", - "}\n", - "\n", - "\n", - "window.checkFlip = function checkFlip(containerId) {\n", - " var container = document.getElementById(containerId);\n", - "\n", - "\n", - " if (container.classList.contains('flip')) {\n", - " container.classList.remove('flip');\n", - " setTimeout(slide2, 600, containerId);\n", - " } \n", - " else {\n", - " slide2(containerId);\n", - " }\n", - "}\n", - "\n", - "\n", - "function slideback(container, frontcard, backcard, next) {\n", - " container.className=\"flip-container slideback\";\n", - " setTimeout(cleanup, 550, container, frontcard, backcard, next);\n", - "}\n", - "\n", - "function cleanup(container, frontcard, backcard, next) {\n", - " container.removeChild(frontcard);\n", - " backcard.className=\"flipper frontcard\";\n", - " container.className=\"flip-container\";\n", - "\n", - " var cardnum=parseInt(container.dataset.cardnum);\n", - " var cards=eval('cards'+container.id);\n", - " var flipper=createOneCard(container, false, cards, cardnum);\n", - " container.append(flipper);\n", - " cardnum= (cardnum+1) % parseInt(container.dataset.numCards);\n", - " container.dataset.cardnum=cardnum;\n", - " if (cardnum != 1){\n", - " next.innerHTML=\"Next >\";\n", - " } else {\n", - " //next.innerHTML=\"Reload \\\\(\\\\circlearrowleft\\\\) \";\n", - " next.innerHTML='Reload '\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([next]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " }\n", - "\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset();\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " next.style.pointerEvents='auto';\n", - " container.style.pointerEvents='auto';\n", - " /* container.tabIndex= 0; */\n", - " /* container.focus(); */\n", - " next.classList.remove('hide');\n", - " container.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(container.id);\n", - " }, {once: true });\n", - "\n", - "\n", - "}\n", - "\n", - "\n", - "function createOneCard (mydiv, frontCard, cards, cardnum) {\n", - " var colors=[\n", - " '--asparagus',\n", - " '--terra-cotta',\n", - " '--cyan-process'\n", - " ]\n", - "\n", - " var flipper = document.createElement('div');\n", - " if (frontCard){\n", - " flipper.className=\"flipper frontcard\"; \n", - " }\n", - " else {\n", - " flipper.className=\"flipper backcard\"; \n", - " }\n", - "\n", - " var front = document.createElement('div');\n", - " front.className='front flashcard';\n", - "\n", - " var frontSpan= document.createElement('span');\n", - " frontSpan.className='flashcardtext';\n", - " frontSpan.innerHTML=jaxify(cards[cardnum]['front']);\n", - " //frontSpan.textContent=jaxify(cards[cardnum]['front']);\n", - " front.style.background='var(' + colors[cardnum % colors.length] + ')';\n", - "\n", - "\n", - " front.append(frontSpan);\n", - " flipper.append(front);\n", - "\n", - " var back = document.createElement('div');\n", - " back.className='back flashcard';\n", - "\n", - " var backSpan= document.createElement('span');\n", - " backSpan.className='flashcardtext';\n", - " backSpan.innerHTML=jaxify(cards[cardnum]['back']);\n", - " back.append(backSpan);\n", - "\n", - " flipper.append(back);\n", - "\n", - " return flipper;\n", - "\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "function createCards(id, keyControl) {\n", - " console.log(id);\n", - " \n", - " var mydiv=document.getElementById(id);\n", - " /*mydiv.onclick = window.flipCard(mydiv);*/\n", - " /*\n", - " mydiv.addEventListener('click', function(){window.flipCard(mydiv);}, false);\n", - " mydiv.addEventListener('keydown', function(event){window.checkKey(mydiv,event);}, true);\n", - " */\n", - " mydiv.onclick = function(){window.flipCard(mydiv);};\n", - " console.log(keyControl);\n", - " if (keyControl == \"True\"){\n", - " mydiv.onkeydown = function(event){window.checkKey(mydiv,event);};\n", - " }\n", - " /* mydiv.addEventListener('keydown', function(event){event.stopPropagation(); console.log(event); event.preventDefault();}, true); */\n", - " /*mydiv.onkeypress = function(event){console.log(event); event.preventDefault();};*/\n", - "\n", - " console.log(mydiv);\n", - " \n", - " var cards=eval('cards'+id);\n", - " mydiv.dataset.cardnum=0;\n", - " mydiv.dataset.numCards=cards.length;\n", - " mydiv.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(id);\n", - " }, {once: true});\n", - "\n", - " var cardnum=0;\n", - " \n", - " for (var i=0; i<2; i++) {\n", - " \n", - " var flipper;\n", - " if (i==0){\n", - " flipper=createOneCard(mydiv, true, cards, cardnum);\n", - " }\n", - " else {\n", - " flipper=createOneCard(mydiv, false, cards, cardnum);\n", - " }\n", - "\n", - " mydiv.append(flipper);\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " if (typeof version == 'undefined') {\n", - " setTimeout(function(){\n", - " var version = MathJax.version;\n", - " console.log('After sleep, MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }, 500);\n", - " } else{\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " cardnum = (cardnum + 1) % mydiv.dataset.numCards;\n", - " }\n", - " mydiv.dataset.cardnum = cardnum;\n", - "\n", - " var next=document.getElementById(id+'-next');\n", - " if (cards.length==1) {\n", - " // Don't show next if no other cards!\n", - " next.style.pointerEvents='none';\n", - " next.classList.add('hide');\n", - " } else {\n", - " next.innerHTML=\"Next >\";\n", - " }\n", - "\n", - " mydiv.focus();\n", - "\n", - " return flipper;\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "var cardsCSKDbPkbxvqG=[\n", - " {\n", - " \"front\": \"hint\",\n", - " \"back\": \"You can use the --help flag with any bash command to get a reminder of the usage syntax as well as the definition of available flags.\"\n", - " },\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \"wc -l FILENAME
grep -c \\\"^>\\\" FILENAME
grep -m 3 \\\"^>\\\" FILENAME
head FILENAME\"\n", - " }\n", - "];\n", - " \n", - " createCards(\"CSKDbPkbxvqG\", \"True\");\n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from jupytercards import display_flashcards\n", "cards='/home/jupyter/flashcards/'\n", @@ -663,31 +13,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "tf2-gpu.2-8.m102", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/tf2-gpu.2-8:m102" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/AWS/quiz_files/quiz3-2.ipynb b/AWS/quiz_files/quiz3-2.ipynb index 30b3878..62789ff 100644 --- a/AWS/quiz_files/quiz3-2.ipynb +++ b/AWS/quiz_files/quiz3-2.ipynb @@ -2,656 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "113fb089-7d61-481e-9473-f72bf2ed5371", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "/*!\n", - " * swiped-events.js - v1.1.4\n", - " * Pure JavaScript swipe events\n", - " * https://github.com/john-doherty/swiped-events\n", - " * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element\n", - " * @author John Doherty \n", - " * @license MIT\n", - " */\n", - "!function(t,e){\"use strict\";\"function\"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=e.createEvent(\"CustomEvent\");return a.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),a},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener(\"touchstart\",function(t){if(\"true\"===t.target.getAttribute(\"data-swipe-ignore\"))return;s=t.target,r=Date.now(),n=t.touches[0].clientX,a=t.touches[0].clientY,u=0,i=0},!1),e.addEventListener(\"touchmove\",function(t){if(!n||!a)return;var e=t.touches[0].clientX,r=t.touches[0].clientY;u=n-e,i=a-r},!1),e.addEventListener(\"touchend\",function(t){if(s!==t.target)return;var e=parseInt(l(s,\"data-swipe-threshold\",\"20\"),10),o=parseInt(l(s,\"data-swipe-timeout\",\"500\"),10),c=Date.now()-r,d=\"\",p=t.changedTouches||t.touches||[];Math.abs(u)>Math.abs(i)?Math.abs(u)>e&&c0?\"swiped-left\":\"swiped-right\"):Math.abs(i)>e&&c0?\"swiped-up\":\"swiped-down\");if(\"\"!==d){var b={dir:d.replace(/swiped-/,\"\"),xStart:parseInt(n,10),xEnd:parseInt((p[0]||{}).clientX||-1,10),yStart:parseInt(a,10),yEnd:parseInt((p[0]||{}).clientY||-1,10)};s.dispatchEvent(new CustomEvent(\"swiped\",{bubbles:!0,cancelable:!0,detail:b})),s.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:b}))}n=null,a=null,r=null},!1);var n=null,a=null,u=null,i=null,r=null,s=null;function l(t,n,a){for(;t&&t!==e.documentElement;){var u=t.getAttribute(n);if(u)return u;t=t.parentNode}return a}}(window,document);\n", - "\n", - "function jaxify(string) {\n", - " var mystring = string;\n", - " console.log(mystring);\n", - "\n", - " var count = 0;\n", - " var loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - "\n", - " var count2 = 0;\n", - " var loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - "\n", - " //console.log(loc);\n", - "\n", - " while ((loc >= 0) || (loc2 >= 0)) {\n", - "\n", - " /* Have to replace all the double $$ first with current implementation */\n", - " if (loc2 >= 0) {\n", - " if (count2 % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\[\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\]\");\n", - " }\n", - " count2++;\n", - " } else {\n", - " if (count % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\(\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\)\");\n", - " }\n", - " count++;\n", - " }\n", - " loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - " loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - " //console.log(mystring,\", loc:\",loc,\", loc2:\",loc2);\n", - " }\n", - "\n", - " //console.log(mystring);\n", - " return mystring;\n", - "}\n", - "\n", - "window.flipCard = function flipCard(ths) {\n", - " console.log(ths);\n", - " console.log(ths.id);\n", - " ths.classList.toggle(\"flip\"); \n", - " var next=document.getElementById(ths.id+'-next');\n", - " next.style.pointerEvents='none';\n", - " /* ths.blur(); */\n", - " next.classList.add('flipped');\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([ths]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " setTimeout(reenableNext, 600, ths, next);\n", - "}\n", - "\n", - "window.checkKey = function checkKey(container, event) {\n", - " event.stopPropagation();\n", - " /*\n", - " console.log(container);\n", - " console.log(event.key);\n", - " console.log(event.code);\n", - " */\n", - " /* JMS: Working here*/\n", - " var next=document.getElementById(container.id+'-next');\n", - " /* Only react if not already sliding */\n", - " if (! next.classList.contains(\"hide\")) {\n", - " if ((event.key == \"j\") || (event.key == \"Enter\") || (event.key == \"ArrowRight\")) {\n", - " window.checkFlip(container.id);\n", - " }\n", - " if (event.key == \" \") {\n", - " window.flipCard(container);\n", - " }\n", - " }\n", - " event.preventDefault();\n", - "}\n", - "\n", - "\n", - "function reenableNext(ths, next) {\n", - " next.style.pointerEvents='auto';\n", - " /* ths.tabIndex= 0;*/\n", - " /* ths.focus(); */\n", - "}\n", - "\n", - "\n", - "\n", - "function slide2(containerId) {\n", - " var container = document.getElementById(containerId);\n", - " var next=document.getElementById(containerId+'-next');\n", - " var frontcard = container.children[0];\n", - " var backcard = container.children[1];\n", - " container.style.pointerEvents='none';\n", - " /* container.removeAttribute(\"tabindex\");*/\n", - " /* container.blur(); */\n", - " //backcard.style.pointerEvents='none';\n", - " next.style.pointerEvents='none';\n", - " next.classList.remove('flipped');\n", - " next.classList.add('hide');\n", - "\n", - " //container.classList.add(\"prepare\");\n", - " \n", - " container.className=\"flip-container slide\";\n", - " backcard.parentElement.removeChild(frontcard);\n", - " backcard.parentElement.appendChild(frontcard);\n", - " setTimeout(slideback, 600, container, frontcard, backcard, next);\n", - " \n", - "}\n", - "\n", - "\n", - "window.checkFlip = function checkFlip(containerId) {\n", - " var container = document.getElementById(containerId);\n", - "\n", - "\n", - " if (container.classList.contains('flip')) {\n", - " container.classList.remove('flip');\n", - " setTimeout(slide2, 600, containerId);\n", - " } \n", - " else {\n", - " slide2(containerId);\n", - " }\n", - "}\n", - "\n", - "\n", - "function slideback(container, frontcard, backcard, next) {\n", - " container.className=\"flip-container slideback\";\n", - " setTimeout(cleanup, 550, container, frontcard, backcard, next);\n", - "}\n", - "\n", - "function cleanup(container, frontcard, backcard, next) {\n", - " container.removeChild(frontcard);\n", - " backcard.className=\"flipper frontcard\";\n", - " container.className=\"flip-container\";\n", - "\n", - " var cardnum=parseInt(container.dataset.cardnum);\n", - " var cards=eval('cards'+container.id);\n", - " var flipper=createOneCard(container, false, cards, cardnum);\n", - " container.append(flipper);\n", - " cardnum= (cardnum+1) % parseInt(container.dataset.numCards);\n", - " container.dataset.cardnum=cardnum;\n", - " if (cardnum != 1){\n", - " next.innerHTML=\"Next >\";\n", - " } else {\n", - " //next.innerHTML=\"Reload \\\\(\\\\circlearrowleft\\\\) \";\n", - " next.innerHTML='Reload '\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([next]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " }\n", - "\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset();\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " next.style.pointerEvents='auto';\n", - " container.style.pointerEvents='auto';\n", - " /* container.tabIndex= 0; */\n", - " /* container.focus(); */\n", - " next.classList.remove('hide');\n", - " container.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(container.id);\n", - " }, {once: true });\n", - "\n", - "\n", - "}\n", - "\n", - "\n", - "function createOneCard (mydiv, frontCard, cards, cardnum) {\n", - " var colors=[\n", - " '--asparagus',\n", - " '--terra-cotta',\n", - " '--cyan-process'\n", - " ]\n", - "\n", - " var flipper = document.createElement('div');\n", - " if (frontCard){\n", - " flipper.className=\"flipper frontcard\"; \n", - " }\n", - " else {\n", - " flipper.className=\"flipper backcard\"; \n", - " }\n", - "\n", - " var front = document.createElement('div');\n", - " front.className='front flashcard';\n", - "\n", - " var frontSpan= document.createElement('span');\n", - " frontSpan.className='flashcardtext';\n", - " frontSpan.innerHTML=jaxify(cards[cardnum]['front']);\n", - " //frontSpan.textContent=jaxify(cards[cardnum]['front']);\n", - " front.style.background='var(' + colors[cardnum % colors.length] + ')';\n", - "\n", - "\n", - " front.append(frontSpan);\n", - " flipper.append(front);\n", - "\n", - " var back = document.createElement('div');\n", - " back.className='back flashcard';\n", - "\n", - " var backSpan= document.createElement('span');\n", - " backSpan.className='flashcardtext';\n", - " backSpan.innerHTML=jaxify(cards[cardnum]['back']);\n", - " back.append(backSpan);\n", - "\n", - " flipper.append(back);\n", - "\n", - " return flipper;\n", - "\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "function createCards(id, keyControl) {\n", - " console.log(id);\n", - " \n", - " var mydiv=document.getElementById(id);\n", - " /*mydiv.onclick = window.flipCard(mydiv);*/\n", - " /*\n", - " mydiv.addEventListener('click', function(){window.flipCard(mydiv);}, false);\n", - " mydiv.addEventListener('keydown', function(event){window.checkKey(mydiv,event);}, true);\n", - " */\n", - " mydiv.onclick = function(){window.flipCard(mydiv);};\n", - " console.log(keyControl);\n", - " if (keyControl == \"True\"){\n", - " mydiv.onkeydown = function(event){window.checkKey(mydiv,event);};\n", - " }\n", - " /* mydiv.addEventListener('keydown', function(event){event.stopPropagation(); console.log(event); event.preventDefault();}, true); */\n", - " /*mydiv.onkeypress = function(event){console.log(event); event.preventDefault();};*/\n", - "\n", - " console.log(mydiv);\n", - " \n", - " var cards=eval('cards'+id);\n", - " mydiv.dataset.cardnum=0;\n", - " mydiv.dataset.numCards=cards.length;\n", - " mydiv.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(id);\n", - " }, {once: true});\n", - "\n", - " var cardnum=0;\n", - " \n", - " for (var i=0; i<2; i++) {\n", - " \n", - " var flipper;\n", - " if (i==0){\n", - " flipper=createOneCard(mydiv, true, cards, cardnum);\n", - " }\n", - " else {\n", - " flipper=createOneCard(mydiv, false, cards, cardnum);\n", - " }\n", - "\n", - " mydiv.append(flipper);\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " if (typeof version == 'undefined') {\n", - " setTimeout(function(){\n", - " var version = MathJax.version;\n", - " console.log('After sleep, MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }, 500);\n", - " } else{\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " cardnum = (cardnum + 1) % mydiv.dataset.numCards;\n", - " }\n", - " mydiv.dataset.cardnum = cardnum;\n", - "\n", - " var next=document.getElementById(id+'-next');\n", - " if (cards.length==1) {\n", - " // Don't show next if no other cards!\n", - " next.style.pointerEvents='none';\n", - " next.classList.add('hide');\n", - " } else {\n", - " next.innerHTML=\"Next >\";\n", - " }\n", - "\n", - " mydiv.focus();\n", - "\n", - " return flipper;\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "var cardscBpXoRtWJBdJ=[\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \"zcat gcp_research_workflow/SRR1039508_1.chr20.fastq.gz | sed -n '4~4p' | head -n 10000 | grep -o .| grep -c \\\"#\\\" \"\n", - " }\n", - "];\n", - " \n", - " createCards(\"cBpXoRtWJBdJ\", \"True\");\n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from jupytercards import display_flashcards\n", "cards='/home/jupyter/flashcards/'\n", @@ -659,31 +13,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "tf2-gpu.2-8.m102", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/tf2-gpu.2-8:m102" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/AWS/quiz_files/quiz4-1.ipynb b/AWS/quiz_files/quiz4-1.ipynb index a23a430..61af203 100644 --- a/AWS/quiz_files/quiz4-1.ipynb +++ b/AWS/quiz_files/quiz4-1.ipynb @@ -2,656 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "113fb089-7d61-481e-9473-f72bf2ed5371", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "/*!\n", - " * swiped-events.js - v1.1.4\n", - " * Pure JavaScript swipe events\n", - " * https://github.com/john-doherty/swiped-events\n", - " * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element\n", - " * @author John Doherty \n", - " * @license MIT\n", - " */\n", - "!function(t,e){\"use strict\";\"function\"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=e.createEvent(\"CustomEvent\");return a.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),a},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener(\"touchstart\",function(t){if(\"true\"===t.target.getAttribute(\"data-swipe-ignore\"))return;s=t.target,r=Date.now(),n=t.touches[0].clientX,a=t.touches[0].clientY,u=0,i=0},!1),e.addEventListener(\"touchmove\",function(t){if(!n||!a)return;var e=t.touches[0].clientX,r=t.touches[0].clientY;u=n-e,i=a-r},!1),e.addEventListener(\"touchend\",function(t){if(s!==t.target)return;var e=parseInt(l(s,\"data-swipe-threshold\",\"20\"),10),o=parseInt(l(s,\"data-swipe-timeout\",\"500\"),10),c=Date.now()-r,d=\"\",p=t.changedTouches||t.touches||[];Math.abs(u)>Math.abs(i)?Math.abs(u)>e&&c0?\"swiped-left\":\"swiped-right\"):Math.abs(i)>e&&c0?\"swiped-up\":\"swiped-down\");if(\"\"!==d){var b={dir:d.replace(/swiped-/,\"\"),xStart:parseInt(n,10),xEnd:parseInt((p[0]||{}).clientX||-1,10),yStart:parseInt(a,10),yEnd:parseInt((p[0]||{}).clientY||-1,10)};s.dispatchEvent(new CustomEvent(\"swiped\",{bubbles:!0,cancelable:!0,detail:b})),s.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:b}))}n=null,a=null,r=null},!1);var n=null,a=null,u=null,i=null,r=null,s=null;function l(t,n,a){for(;t&&t!==e.documentElement;){var u=t.getAttribute(n);if(u)return u;t=t.parentNode}return a}}(window,document);\n", - "\n", - "function jaxify(string) {\n", - " var mystring = string;\n", - " console.log(mystring);\n", - "\n", - " var count = 0;\n", - " var loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - "\n", - " var count2 = 0;\n", - " var loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - "\n", - " //console.log(loc);\n", - "\n", - " while ((loc >= 0) || (loc2 >= 0)) {\n", - "\n", - " /* Have to replace all the double $$ first with current implementation */\n", - " if (loc2 >= 0) {\n", - " if (count2 % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\[\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\]\");\n", - " }\n", - " count2++;\n", - " } else {\n", - " if (count % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\(\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\)\");\n", - " }\n", - " count++;\n", - " }\n", - " loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - " loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - " //console.log(mystring,\", loc:\",loc,\", loc2:\",loc2);\n", - " }\n", - "\n", - " //console.log(mystring);\n", - " return mystring;\n", - "}\n", - "\n", - "window.flipCard = function flipCard(ths) {\n", - " console.log(ths);\n", - " console.log(ths.id);\n", - " ths.classList.toggle(\"flip\"); \n", - " var next=document.getElementById(ths.id+'-next');\n", - " next.style.pointerEvents='none';\n", - " /* ths.blur(); */\n", - " next.classList.add('flipped');\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([ths]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " setTimeout(reenableNext, 600, ths, next);\n", - "}\n", - "\n", - "window.checkKey = function checkKey(container, event) {\n", - " event.stopPropagation();\n", - " /*\n", - " console.log(container);\n", - " console.log(event.key);\n", - " console.log(event.code);\n", - " */\n", - " /* JMS: Working here*/\n", - " var next=document.getElementById(container.id+'-next');\n", - " /* Only react if not already sliding */\n", - " if (! next.classList.contains(\"hide\")) {\n", - " if ((event.key == \"j\") || (event.key == \"Enter\") || (event.key == \"ArrowRight\")) {\n", - " window.checkFlip(container.id);\n", - " }\n", - " if (event.key == \" \") {\n", - " window.flipCard(container);\n", - " }\n", - " }\n", - " event.preventDefault();\n", - "}\n", - "\n", - "\n", - "function reenableNext(ths, next) {\n", - " next.style.pointerEvents='auto';\n", - " /* ths.tabIndex= 0;*/\n", - " /* ths.focus(); */\n", - "}\n", - "\n", - "\n", - "\n", - "function slide2(containerId) {\n", - " var container = document.getElementById(containerId);\n", - " var next=document.getElementById(containerId+'-next');\n", - " var frontcard = container.children[0];\n", - " var backcard = container.children[1];\n", - " container.style.pointerEvents='none';\n", - " /* container.removeAttribute(\"tabindex\");*/\n", - " /* container.blur(); */\n", - " //backcard.style.pointerEvents='none';\n", - " next.style.pointerEvents='none';\n", - " next.classList.remove('flipped');\n", - " next.classList.add('hide');\n", - "\n", - " //container.classList.add(\"prepare\");\n", - " \n", - " container.className=\"flip-container slide\";\n", - " backcard.parentElement.removeChild(frontcard);\n", - " backcard.parentElement.appendChild(frontcard);\n", - " setTimeout(slideback, 600, container, frontcard, backcard, next);\n", - " \n", - "}\n", - "\n", - "\n", - "window.checkFlip = function checkFlip(containerId) {\n", - " var container = document.getElementById(containerId);\n", - "\n", - "\n", - " if (container.classList.contains('flip')) {\n", - " container.classList.remove('flip');\n", - " setTimeout(slide2, 600, containerId);\n", - " } \n", - " else {\n", - " slide2(containerId);\n", - " }\n", - "}\n", - "\n", - "\n", - "function slideback(container, frontcard, backcard, next) {\n", - " container.className=\"flip-container slideback\";\n", - " setTimeout(cleanup, 550, container, frontcard, backcard, next);\n", - "}\n", - "\n", - "function cleanup(container, frontcard, backcard, next) {\n", - " container.removeChild(frontcard);\n", - " backcard.className=\"flipper frontcard\";\n", - " container.className=\"flip-container\";\n", - "\n", - " var cardnum=parseInt(container.dataset.cardnum);\n", - " var cards=eval('cards'+container.id);\n", - " var flipper=createOneCard(container, false, cards, cardnum);\n", - " container.append(flipper);\n", - " cardnum= (cardnum+1) % parseInt(container.dataset.numCards);\n", - " container.dataset.cardnum=cardnum;\n", - " if (cardnum != 1){\n", - " next.innerHTML=\"Next >\";\n", - " } else {\n", - " //next.innerHTML=\"Reload \\\\(\\\\circlearrowleft\\\\) \";\n", - " next.innerHTML='Reload '\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([next]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " }\n", - "\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset();\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " next.style.pointerEvents='auto';\n", - " container.style.pointerEvents='auto';\n", - " /* container.tabIndex= 0; */\n", - " /* container.focus(); */\n", - " next.classList.remove('hide');\n", - " container.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(container.id);\n", - " }, {once: true });\n", - "\n", - "\n", - "}\n", - "\n", - "\n", - "function createOneCard (mydiv, frontCard, cards, cardnum) {\n", - " var colors=[\n", - " '--asparagus',\n", - " '--terra-cotta',\n", - " '--cyan-process'\n", - " ]\n", - "\n", - " var flipper = document.createElement('div');\n", - " if (frontCard){\n", - " flipper.className=\"flipper frontcard\"; \n", - " }\n", - " else {\n", - " flipper.className=\"flipper backcard\"; \n", - " }\n", - "\n", - " var front = document.createElement('div');\n", - " front.className='front flashcard';\n", - "\n", - " var frontSpan= document.createElement('span');\n", - " frontSpan.className='flashcardtext';\n", - " frontSpan.innerHTML=jaxify(cards[cardnum]['front']);\n", - " //frontSpan.textContent=jaxify(cards[cardnum]['front']);\n", - " front.style.background='var(' + colors[cardnum % colors.length] + ')';\n", - "\n", - "\n", - " front.append(frontSpan);\n", - " flipper.append(front);\n", - "\n", - " var back = document.createElement('div');\n", - " back.className='back flashcard';\n", - "\n", - " var backSpan= document.createElement('span');\n", - " backSpan.className='flashcardtext';\n", - " backSpan.innerHTML=jaxify(cards[cardnum]['back']);\n", - " back.append(backSpan);\n", - "\n", - " flipper.append(back);\n", - "\n", - " return flipper;\n", - "\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "function createCards(id, keyControl) {\n", - " console.log(id);\n", - " \n", - " var mydiv=document.getElementById(id);\n", - " /*mydiv.onclick = window.flipCard(mydiv);*/\n", - " /*\n", - " mydiv.addEventListener('click', function(){window.flipCard(mydiv);}, false);\n", - " mydiv.addEventListener('keydown', function(event){window.checkKey(mydiv,event);}, true);\n", - " */\n", - " mydiv.onclick = function(){window.flipCard(mydiv);};\n", - " console.log(keyControl);\n", - " if (keyControl == \"True\"){\n", - " mydiv.onkeydown = function(event){window.checkKey(mydiv,event);};\n", - " }\n", - " /* mydiv.addEventListener('keydown', function(event){event.stopPropagation(); console.log(event); event.preventDefault();}, true); */\n", - " /*mydiv.onkeypress = function(event){console.log(event); event.preventDefault();};*/\n", - "\n", - " console.log(mydiv);\n", - " \n", - " var cards=eval('cards'+id);\n", - " mydiv.dataset.cardnum=0;\n", - " mydiv.dataset.numCards=cards.length;\n", - " mydiv.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(id);\n", - " }, {once: true});\n", - "\n", - " var cardnum=0;\n", - " \n", - " for (var i=0; i<2; i++) {\n", - " \n", - " var flipper;\n", - " if (i==0){\n", - " flipper=createOneCard(mydiv, true, cards, cardnum);\n", - " }\n", - " else {\n", - " flipper=createOneCard(mydiv, false, cards, cardnum);\n", - " }\n", - "\n", - " mydiv.append(flipper);\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " if (typeof version == 'undefined') {\n", - " setTimeout(function(){\n", - " var version = MathJax.version;\n", - " console.log('After sleep, MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }, 500);\n", - " } else{\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " cardnum = (cardnum + 1) % mydiv.dataset.numCards;\n", - " }\n", - " mydiv.dataset.cardnum = cardnum;\n", - "\n", - " var next=document.getElementById(id+'-next');\n", - " if (cards.length==1) {\n", - " // Don't show next if no other cards!\n", - " next.style.pointerEvents='none';\n", - " next.classList.add('hide');\n", - " } else {\n", - " next.innerHTML=\"Next >\";\n", - " }\n", - "\n", - " mydiv.focus();\n", - "\n", - " return flipper;\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "var cardszqWGSgJDQtPI=[\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \"for i in \\{1..25\\}
do echo $i
done
\"\n", - " }\n", - "];\n", - " \n", - " createCards(\"zqWGSgJDQtPI\", \"True\");\n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from jupytercards import display_flashcards\n", "cards='/home/jupyter/flashcards/'\n", @@ -667,31 +21,7 @@ "source": [] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "tf2-gpu.2-8.m102", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/tf2-gpu.2-8:m102" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/AWS/quiz_files/quiz4-2.ipynb b/AWS/quiz_files/quiz4-2.ipynb index eb168de..a23a449 100644 --- a/AWS/quiz_files/quiz4-2.ipynb +++ b/AWS/quiz_files/quiz4-2.ipynb @@ -2,656 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "113fb089-7d61-481e-9473-f72bf2ed5371", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "/*!\n", - " * swiped-events.js - v1.1.4\n", - " * Pure JavaScript swipe events\n", - " * https://github.com/john-doherty/swiped-events\n", - " * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element\n", - " * @author John Doherty \n", - " * @license MIT\n", - " */\n", - "!function(t,e){\"use strict\";\"function\"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=e.createEvent(\"CustomEvent\");return a.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),a},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener(\"touchstart\",function(t){if(\"true\"===t.target.getAttribute(\"data-swipe-ignore\"))return;s=t.target,r=Date.now(),n=t.touches[0].clientX,a=t.touches[0].clientY,u=0,i=0},!1),e.addEventListener(\"touchmove\",function(t){if(!n||!a)return;var e=t.touches[0].clientX,r=t.touches[0].clientY;u=n-e,i=a-r},!1),e.addEventListener(\"touchend\",function(t){if(s!==t.target)return;var e=parseInt(l(s,\"data-swipe-threshold\",\"20\"),10),o=parseInt(l(s,\"data-swipe-timeout\",\"500\"),10),c=Date.now()-r,d=\"\",p=t.changedTouches||t.touches||[];Math.abs(u)>Math.abs(i)?Math.abs(u)>e&&c0?\"swiped-left\":\"swiped-right\"):Math.abs(i)>e&&c0?\"swiped-up\":\"swiped-down\");if(\"\"!==d){var b={dir:d.replace(/swiped-/,\"\"),xStart:parseInt(n,10),xEnd:parseInt((p[0]||{}).clientX||-1,10),yStart:parseInt(a,10),yEnd:parseInt((p[0]||{}).clientY||-1,10)};s.dispatchEvent(new CustomEvent(\"swiped\",{bubbles:!0,cancelable:!0,detail:b})),s.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:b}))}n=null,a=null,r=null},!1);var n=null,a=null,u=null,i=null,r=null,s=null;function l(t,n,a){for(;t&&t!==e.documentElement;){var u=t.getAttribute(n);if(u)return u;t=t.parentNode}return a}}(window,document);\n", - "\n", - "function jaxify(string) {\n", - " var mystring = string;\n", - " console.log(mystring);\n", - "\n", - " var count = 0;\n", - " var loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - "\n", - " var count2 = 0;\n", - " var loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - "\n", - " //console.log(loc);\n", - "\n", - " while ((loc >= 0) || (loc2 >= 0)) {\n", - "\n", - " /* Have to replace all the double $$ first with current implementation */\n", - " if (loc2 >= 0) {\n", - " if (count2 % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\[\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\]\");\n", - " }\n", - " count2++;\n", - " } else {\n", - " if (count % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\(\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\)\");\n", - " }\n", - " count++;\n", - " }\n", - " loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - " loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - " //console.log(mystring,\", loc:\",loc,\", loc2:\",loc2);\n", - " }\n", - "\n", - " //console.log(mystring);\n", - " return mystring;\n", - "}\n", - "\n", - "window.flipCard = function flipCard(ths) {\n", - " console.log(ths);\n", - " console.log(ths.id);\n", - " ths.classList.toggle(\"flip\"); \n", - " var next=document.getElementById(ths.id+'-next');\n", - " next.style.pointerEvents='none';\n", - " /* ths.blur(); */\n", - " next.classList.add('flipped');\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([ths]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " setTimeout(reenableNext, 600, ths, next);\n", - "}\n", - "\n", - "window.checkKey = function checkKey(container, event) {\n", - " event.stopPropagation();\n", - " /*\n", - " console.log(container);\n", - " console.log(event.key);\n", - " console.log(event.code);\n", - " */\n", - " /* JMS: Working here*/\n", - " var next=document.getElementById(container.id+'-next');\n", - " /* Only react if not already sliding */\n", - " if (! next.classList.contains(\"hide\")) {\n", - " if ((event.key == \"j\") || (event.key == \"Enter\") || (event.key == \"ArrowRight\")) {\n", - " window.checkFlip(container.id);\n", - " }\n", - " if (event.key == \" \") {\n", - " window.flipCard(container);\n", - " }\n", - " }\n", - " event.preventDefault();\n", - "}\n", - "\n", - "\n", - "function reenableNext(ths, next) {\n", - " next.style.pointerEvents='auto';\n", - " /* ths.tabIndex= 0;*/\n", - " /* ths.focus(); */\n", - "}\n", - "\n", - "\n", - "\n", - "function slide2(containerId) {\n", - " var container = document.getElementById(containerId);\n", - " var next=document.getElementById(containerId+'-next');\n", - " var frontcard = container.children[0];\n", - " var backcard = container.children[1];\n", - " container.style.pointerEvents='none';\n", - " /* container.removeAttribute(\"tabindex\");*/\n", - " /* container.blur(); */\n", - " //backcard.style.pointerEvents='none';\n", - " next.style.pointerEvents='none';\n", - " next.classList.remove('flipped');\n", - " next.classList.add('hide');\n", - "\n", - " //container.classList.add(\"prepare\");\n", - " \n", - " container.className=\"flip-container slide\";\n", - " backcard.parentElement.removeChild(frontcard);\n", - " backcard.parentElement.appendChild(frontcard);\n", - " setTimeout(slideback, 600, container, frontcard, backcard, next);\n", - " \n", - "}\n", - "\n", - "\n", - "window.checkFlip = function checkFlip(containerId) {\n", - " var container = document.getElementById(containerId);\n", - "\n", - "\n", - " if (container.classList.contains('flip')) {\n", - " container.classList.remove('flip');\n", - " setTimeout(slide2, 600, containerId);\n", - " } \n", - " else {\n", - " slide2(containerId);\n", - " }\n", - "}\n", - "\n", - "\n", - "function slideback(container, frontcard, backcard, next) {\n", - " container.className=\"flip-container slideback\";\n", - " setTimeout(cleanup, 550, container, frontcard, backcard, next);\n", - "}\n", - "\n", - "function cleanup(container, frontcard, backcard, next) {\n", - " container.removeChild(frontcard);\n", - " backcard.className=\"flipper frontcard\";\n", - " container.className=\"flip-container\";\n", - "\n", - " var cardnum=parseInt(container.dataset.cardnum);\n", - " var cards=eval('cards'+container.id);\n", - " var flipper=createOneCard(container, false, cards, cardnum);\n", - " container.append(flipper);\n", - " cardnum= (cardnum+1) % parseInt(container.dataset.numCards);\n", - " container.dataset.cardnum=cardnum;\n", - " if (cardnum != 1){\n", - " next.innerHTML=\"Next >\";\n", - " } else {\n", - " //next.innerHTML=\"Reload \\\\(\\\\circlearrowleft\\\\) \";\n", - " next.innerHTML='Reload '\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([next]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " }\n", - "\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset();\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " next.style.pointerEvents='auto';\n", - " container.style.pointerEvents='auto';\n", - " /* container.tabIndex= 0; */\n", - " /* container.focus(); */\n", - " next.classList.remove('hide');\n", - " container.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(container.id);\n", - " }, {once: true });\n", - "\n", - "\n", - "}\n", - "\n", - "\n", - "function createOneCard (mydiv, frontCard, cards, cardnum) {\n", - " var colors=[\n", - " '--asparagus',\n", - " '--terra-cotta',\n", - " '--cyan-process'\n", - " ]\n", - "\n", - " var flipper = document.createElement('div');\n", - " if (frontCard){\n", - " flipper.className=\"flipper frontcard\"; \n", - " }\n", - " else {\n", - " flipper.className=\"flipper backcard\"; \n", - " }\n", - "\n", - " var front = document.createElement('div');\n", - " front.className='front flashcard';\n", - "\n", - " var frontSpan= document.createElement('span');\n", - " frontSpan.className='flashcardtext';\n", - " frontSpan.innerHTML=jaxify(cards[cardnum]['front']);\n", - " //frontSpan.textContent=jaxify(cards[cardnum]['front']);\n", - " front.style.background='var(' + colors[cardnum % colors.length] + ')';\n", - "\n", - "\n", - " front.append(frontSpan);\n", - " flipper.append(front);\n", - "\n", - " var back = document.createElement('div');\n", - " back.className='back flashcard';\n", - "\n", - " var backSpan= document.createElement('span');\n", - " backSpan.className='flashcardtext';\n", - " backSpan.innerHTML=jaxify(cards[cardnum]['back']);\n", - " back.append(backSpan);\n", - "\n", - " flipper.append(back);\n", - "\n", - " return flipper;\n", - "\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "function createCards(id, keyControl) {\n", - " console.log(id);\n", - " \n", - " var mydiv=document.getElementById(id);\n", - " /*mydiv.onclick = window.flipCard(mydiv);*/\n", - " /*\n", - " mydiv.addEventListener('click', function(){window.flipCard(mydiv);}, false);\n", - " mydiv.addEventListener('keydown', function(event){window.checkKey(mydiv,event);}, true);\n", - " */\n", - " mydiv.onclick = function(){window.flipCard(mydiv);};\n", - " console.log(keyControl);\n", - " if (keyControl == \"True\"){\n", - " mydiv.onkeydown = function(event){window.checkKey(mydiv,event);};\n", - " }\n", - " /* mydiv.addEventListener('keydown', function(event){event.stopPropagation(); console.log(event); event.preventDefault();}, true); */\n", - " /*mydiv.onkeypress = function(event){console.log(event); event.preventDefault();};*/\n", - "\n", - " console.log(mydiv);\n", - " \n", - " var cards=eval('cards'+id);\n", - " mydiv.dataset.cardnum=0;\n", - " mydiv.dataset.numCards=cards.length;\n", - " mydiv.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(id);\n", - " }, {once: true});\n", - "\n", - " var cardnum=0;\n", - " \n", - " for (var i=0; i<2; i++) {\n", - " \n", - " var flipper;\n", - " if (i==0){\n", - " flipper=createOneCard(mydiv, true, cards, cardnum);\n", - " }\n", - " else {\n", - " flipper=createOneCard(mydiv, false, cards, cardnum);\n", - " }\n", - "\n", - " mydiv.append(flipper);\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " if (typeof version == 'undefined') {\n", - " setTimeout(function(){\n", - " var version = MathJax.version;\n", - " console.log('After sleep, MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }, 500);\n", - " } else{\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " cardnum = (cardnum + 1) % mydiv.dataset.numCards;\n", - " }\n", - " mydiv.dataset.cardnum = cardnum;\n", - "\n", - " var next=document.getElementById(id+'-next');\n", - " if (cards.length==1) {\n", - " // Don't show next if no other cards!\n", - " next.style.pointerEvents='none';\n", - " next.classList.add('hide');\n", - " } else {\n", - " next.innerHTML=\"Next >\";\n", - " }\n", - "\n", - " mydiv.focus();\n", - "\n", - " return flipper;\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "var cardsIXBZndvaGdYK=[\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \"The redirect command will replace the result each time the loop is run and the final file will have only a single result.\"\n", - " }\n", - "];\n", - " \n", - " createCards(\"IXBZndvaGdYK\", \"True\");\n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from jupytercards import display_flashcards\n", "cards='/home/jupyter/flashcards/'\n", @@ -659,31 +13,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "tf2-gpu.2-8.m102", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/tf2-gpu.2-8:m102" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/AWS/quiz_files/quiz5-1.ipynb b/AWS/quiz_files/quiz5-1.ipynb index eba1688..cf9d6fc 100644 --- a/AWS/quiz_files/quiz5-1.ipynb +++ b/AWS/quiz_files/quiz5-1.ipynb @@ -2,660 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "113fb089-7d61-481e-9473-f72bf2ed5371", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "/*!\n", - " * swiped-events.js - v1.1.4\n", - " * Pure JavaScript swipe events\n", - " * https://github.com/john-doherty/swiped-events\n", - " * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element\n", - " * @author John Doherty \n", - " * @license MIT\n", - " */\n", - "!function(t,e){\"use strict\";\"function\"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=e.createEvent(\"CustomEvent\");return a.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),a},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener(\"touchstart\",function(t){if(\"true\"===t.target.getAttribute(\"data-swipe-ignore\"))return;s=t.target,r=Date.now(),n=t.touches[0].clientX,a=t.touches[0].clientY,u=0,i=0},!1),e.addEventListener(\"touchmove\",function(t){if(!n||!a)return;var e=t.touches[0].clientX,r=t.touches[0].clientY;u=n-e,i=a-r},!1),e.addEventListener(\"touchend\",function(t){if(s!==t.target)return;var e=parseInt(l(s,\"data-swipe-threshold\",\"20\"),10),o=parseInt(l(s,\"data-swipe-timeout\",\"500\"),10),c=Date.now()-r,d=\"\",p=t.changedTouches||t.touches||[];Math.abs(u)>Math.abs(i)?Math.abs(u)>e&&c0?\"swiped-left\":\"swiped-right\"):Math.abs(i)>e&&c0?\"swiped-up\":\"swiped-down\");if(\"\"!==d){var b={dir:d.replace(/swiped-/,\"\"),xStart:parseInt(n,10),xEnd:parseInt((p[0]||{}).clientX||-1,10),yStart:parseInt(a,10),yEnd:parseInt((p[0]||{}).clientY||-1,10)};s.dispatchEvent(new CustomEvent(\"swiped\",{bubbles:!0,cancelable:!0,detail:b})),s.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:b}))}n=null,a=null,r=null},!1);var n=null,a=null,u=null,i=null,r=null,s=null;function l(t,n,a){for(;t&&t!==e.documentElement;){var u=t.getAttribute(n);if(u)return u;t=t.parentNode}return a}}(window,document);\n", - "\n", - "function jaxify(string) {\n", - " var mystring = string;\n", - " console.log(mystring);\n", - "\n", - " var count = 0;\n", - " var loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - "\n", - " var count2 = 0;\n", - " var loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - "\n", - " //console.log(loc);\n", - "\n", - " while ((loc >= 0) || (loc2 >= 0)) {\n", - "\n", - " /* Have to replace all the double $$ first with current implementation */\n", - " if (loc2 >= 0) {\n", - " if (count2 % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\[\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\]\");\n", - " }\n", - " count2++;\n", - " } else {\n", - " if (count % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\(\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\)\");\n", - " }\n", - " count++;\n", - " }\n", - " loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - " loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - " //console.log(mystring,\", loc:\",loc,\", loc2:\",loc2);\n", - " }\n", - "\n", - " //console.log(mystring);\n", - " return mystring;\n", - "}\n", - "\n", - "window.flipCard = function flipCard(ths) {\n", - " console.log(ths);\n", - " console.log(ths.id);\n", - " ths.classList.toggle(\"flip\"); \n", - " var next=document.getElementById(ths.id+'-next');\n", - " next.style.pointerEvents='none';\n", - " /* ths.blur(); */\n", - " next.classList.add('flipped');\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([ths]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " setTimeout(reenableNext, 600, ths, next);\n", - "}\n", - "\n", - "window.checkKey = function checkKey(container, event) {\n", - " event.stopPropagation();\n", - " /*\n", - " console.log(container);\n", - " console.log(event.key);\n", - " console.log(event.code);\n", - " */\n", - " /* JMS: Working here*/\n", - " var next=document.getElementById(container.id+'-next');\n", - " /* Only react if not already sliding */\n", - " if (! next.classList.contains(\"hide\")) {\n", - " if ((event.key == \"j\") || (event.key == \"Enter\") || (event.key == \"ArrowRight\")) {\n", - " window.checkFlip(container.id);\n", - " }\n", - " if (event.key == \" \") {\n", - " window.flipCard(container);\n", - " }\n", - " }\n", - " event.preventDefault();\n", - "}\n", - "\n", - "\n", - "function reenableNext(ths, next) {\n", - " next.style.pointerEvents='auto';\n", - " /* ths.tabIndex= 0;*/\n", - " /* ths.focus(); */\n", - "}\n", - "\n", - "\n", - "\n", - "function slide2(containerId) {\n", - " var container = document.getElementById(containerId);\n", - " var next=document.getElementById(containerId+'-next');\n", - " var frontcard = container.children[0];\n", - " var backcard = container.children[1];\n", - " container.style.pointerEvents='none';\n", - " /* container.removeAttribute(\"tabindex\");*/\n", - " /* container.blur(); */\n", - " //backcard.style.pointerEvents='none';\n", - " next.style.pointerEvents='none';\n", - " next.classList.remove('flipped');\n", - " next.classList.add('hide');\n", - "\n", - " //container.classList.add(\"prepare\");\n", - " \n", - " container.className=\"flip-container slide\";\n", - " backcard.parentElement.removeChild(frontcard);\n", - " backcard.parentElement.appendChild(frontcard);\n", - " setTimeout(slideback, 600, container, frontcard, backcard, next);\n", - " \n", - "}\n", - "\n", - "\n", - "window.checkFlip = function checkFlip(containerId) {\n", - " var container = document.getElementById(containerId);\n", - "\n", - "\n", - " if (container.classList.contains('flip')) {\n", - " container.classList.remove('flip');\n", - " setTimeout(slide2, 600, containerId);\n", - " } \n", - " else {\n", - " slide2(containerId);\n", - " }\n", - "}\n", - "\n", - "\n", - "function slideback(container, frontcard, backcard, next) {\n", - " container.className=\"flip-container slideback\";\n", - " setTimeout(cleanup, 550, container, frontcard, backcard, next);\n", - "}\n", - "\n", - "function cleanup(container, frontcard, backcard, next) {\n", - " container.removeChild(frontcard);\n", - " backcard.className=\"flipper frontcard\";\n", - " container.className=\"flip-container\";\n", - "\n", - " var cardnum=parseInt(container.dataset.cardnum);\n", - " var cards=eval('cards'+container.id);\n", - " var flipper=createOneCard(container, false, cards, cardnum);\n", - " container.append(flipper);\n", - " cardnum= (cardnum+1) % parseInt(container.dataset.numCards);\n", - " container.dataset.cardnum=cardnum;\n", - " if (cardnum != 1){\n", - " next.innerHTML=\"Next >\";\n", - " } else {\n", - " //next.innerHTML=\"Reload \\\\(\\\\circlearrowleft\\\\) \";\n", - " next.innerHTML='Reload '\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([next]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " }\n", - "\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset();\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " next.style.pointerEvents='auto';\n", - " container.style.pointerEvents='auto';\n", - " /* container.tabIndex= 0; */\n", - " /* container.focus(); */\n", - " next.classList.remove('hide');\n", - " container.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(container.id);\n", - " }, {once: true });\n", - "\n", - "\n", - "}\n", - "\n", - "\n", - "function createOneCard (mydiv, frontCard, cards, cardnum) {\n", - " var colors=[\n", - " '--asparagus',\n", - " '--terra-cotta',\n", - " '--cyan-process'\n", - " ]\n", - "\n", - " var flipper = document.createElement('div');\n", - " if (frontCard){\n", - " flipper.className=\"flipper frontcard\"; \n", - " }\n", - " else {\n", - " flipper.className=\"flipper backcard\"; \n", - " }\n", - "\n", - " var front = document.createElement('div');\n", - " front.className='front flashcard';\n", - "\n", - " var frontSpan= document.createElement('span');\n", - " frontSpan.className='flashcardtext';\n", - " frontSpan.innerHTML=jaxify(cards[cardnum]['front']);\n", - " //frontSpan.textContent=jaxify(cards[cardnum]['front']);\n", - " front.style.background='var(' + colors[cardnum % colors.length] + ')';\n", - "\n", - "\n", - " front.append(frontSpan);\n", - " flipper.append(front);\n", - "\n", - " var back = document.createElement('div');\n", - " back.className='back flashcard';\n", - "\n", - " var backSpan= document.createElement('span');\n", - " backSpan.className='flashcardtext';\n", - " backSpan.innerHTML=jaxify(cards[cardnum]['back']);\n", - " back.append(backSpan);\n", - "\n", - " flipper.append(back);\n", - "\n", - " return flipper;\n", - "\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "function createCards(id, keyControl) {\n", - " console.log(id);\n", - " \n", - " var mydiv=document.getElementById(id);\n", - " /*mydiv.onclick = window.flipCard(mydiv);*/\n", - " /*\n", - " mydiv.addEventListener('click', function(){window.flipCard(mydiv);}, false);\n", - " mydiv.addEventListener('keydown', function(event){window.checkKey(mydiv,event);}, true);\n", - " */\n", - " mydiv.onclick = function(){window.flipCard(mydiv);};\n", - " console.log(keyControl);\n", - " if (keyControl == \"True\"){\n", - " mydiv.onkeydown = function(event){window.checkKey(mydiv,event);};\n", - " }\n", - " /* mydiv.addEventListener('keydown', function(event){event.stopPropagation(); console.log(event); event.preventDefault();}, true); */\n", - " /*mydiv.onkeypress = function(event){console.log(event); event.preventDefault();};*/\n", - "\n", - " console.log(mydiv);\n", - " \n", - " var cards=eval('cards'+id);\n", - " mydiv.dataset.cardnum=0;\n", - " mydiv.dataset.numCards=cards.length;\n", - " mydiv.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(id);\n", - " }, {once: true});\n", - "\n", - " var cardnum=0;\n", - " \n", - " for (var i=0; i<2; i++) {\n", - " \n", - " var flipper;\n", - " if (i==0){\n", - " flipper=createOneCard(mydiv, true, cards, cardnum);\n", - " }\n", - " else {\n", - " flipper=createOneCard(mydiv, false, cards, cardnum);\n", - " }\n", - "\n", - " mydiv.append(flipper);\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " if (typeof version == 'undefined') {\n", - " setTimeout(function(){\n", - " var version = MathJax.version;\n", - " console.log('After sleep, MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }, 500);\n", - " } else{\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " cardnum = (cardnum + 1) % mydiv.dataset.numCards;\n", - " }\n", - " mydiv.dataset.cardnum = cardnum;\n", - "\n", - " var next=document.getElementById(id+'-next');\n", - " if (cards.length==1) {\n", - " // Don't show next if no other cards!\n", - " next.style.pointerEvents='none';\n", - " next.classList.add('hide');\n", - " } else {\n", - " next.innerHTML=\"Next >\";\n", - " }\n", - "\n", - " mydiv.focus();\n", - "\n", - " return flipper;\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "var cardsXukImPnoZdMs=[\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \"ls gcp_research_workflow/*.fastq.gz | while read x
do fastqc -t 4 -o fastqc $x
done\"\n", - " },\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \"Multithreading within the loop doesn't speed up the analysis because only one file is considered in each cycle of the loop.\"\n", - " }\n", - "];\n", - " \n", - " createCards(\"XukImPnoZdMs\", \"True\");\n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from jupytercards import display_flashcards\n", "cards='/home/jupyter/flashcards/'\n", @@ -663,31 +13,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "tf2-gpu.2-8.m102", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/tf2-gpu.2-8:m102" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/AWS/quiz_files/quiz6-1.ipynb b/AWS/quiz_files/quiz6-1.ipynb index ecaa904..c05b243 100644 --- a/AWS/quiz_files/quiz6-1.ipynb +++ b/AWS/quiz_files/quiz6-1.ipynb @@ -2,656 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "113fb089-7d61-481e-9473-f72bf2ed5371", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "/*!\n", - " * swiped-events.js - v1.1.4\n", - " * Pure JavaScript swipe events\n", - " * https://github.com/john-doherty/swiped-events\n", - " * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element\n", - " * @author John Doherty \n", - " * @license MIT\n", - " */\n", - "!function(t,e){\"use strict\";\"function\"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=e.createEvent(\"CustomEvent\");return a.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),a},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener(\"touchstart\",function(t){if(\"true\"===t.target.getAttribute(\"data-swipe-ignore\"))return;s=t.target,r=Date.now(),n=t.touches[0].clientX,a=t.touches[0].clientY,u=0,i=0},!1),e.addEventListener(\"touchmove\",function(t){if(!n||!a)return;var e=t.touches[0].clientX,r=t.touches[0].clientY;u=n-e,i=a-r},!1),e.addEventListener(\"touchend\",function(t){if(s!==t.target)return;var e=parseInt(l(s,\"data-swipe-threshold\",\"20\"),10),o=parseInt(l(s,\"data-swipe-timeout\",\"500\"),10),c=Date.now()-r,d=\"\",p=t.changedTouches||t.touches||[];Math.abs(u)>Math.abs(i)?Math.abs(u)>e&&c0?\"swiped-left\":\"swiped-right\"):Math.abs(i)>e&&c0?\"swiped-up\":\"swiped-down\");if(\"\"!==d){var b={dir:d.replace(/swiped-/,\"\"),xStart:parseInt(n,10),xEnd:parseInt((p[0]||{}).clientX||-1,10),yStart:parseInt(a,10),yEnd:parseInt((p[0]||{}).clientY||-1,10)};s.dispatchEvent(new CustomEvent(\"swiped\",{bubbles:!0,cancelable:!0,detail:b})),s.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:b}))}n=null,a=null,r=null},!1);var n=null,a=null,u=null,i=null,r=null,s=null;function l(t,n,a){for(;t&&t!==e.documentElement;){var u=t.getAttribute(n);if(u)return u;t=t.parentNode}return a}}(window,document);\n", - "\n", - "function jaxify(string) {\n", - " var mystring = string;\n", - " console.log(mystring);\n", - "\n", - " var count = 0;\n", - " var loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - "\n", - " var count2 = 0;\n", - " var loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - "\n", - " //console.log(loc);\n", - "\n", - " while ((loc >= 0) || (loc2 >= 0)) {\n", - "\n", - " /* Have to replace all the double $$ first with current implementation */\n", - " if (loc2 >= 0) {\n", - " if (count2 % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\[\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\]\");\n", - " }\n", - " count2++;\n", - " } else {\n", - " if (count % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\(\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\)\");\n", - " }\n", - " count++;\n", - " }\n", - " loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - " loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - " //console.log(mystring,\", loc:\",loc,\", loc2:\",loc2);\n", - " }\n", - "\n", - " //console.log(mystring);\n", - " return mystring;\n", - "}\n", - "\n", - "window.flipCard = function flipCard(ths) {\n", - " console.log(ths);\n", - " console.log(ths.id);\n", - " ths.classList.toggle(\"flip\"); \n", - " var next=document.getElementById(ths.id+'-next');\n", - " next.style.pointerEvents='none';\n", - " /* ths.blur(); */\n", - " next.classList.add('flipped');\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([ths]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " setTimeout(reenableNext, 600, ths, next);\n", - "}\n", - "\n", - "window.checkKey = function checkKey(container, event) {\n", - " event.stopPropagation();\n", - " /*\n", - " console.log(container);\n", - " console.log(event.key);\n", - " console.log(event.code);\n", - " */\n", - " /* JMS: Working here*/\n", - " var next=document.getElementById(container.id+'-next');\n", - " /* Only react if not already sliding */\n", - " if (! next.classList.contains(\"hide\")) {\n", - " if ((event.key == \"j\") || (event.key == \"Enter\") || (event.key == \"ArrowRight\")) {\n", - " window.checkFlip(container.id);\n", - " }\n", - " if (event.key == \" \") {\n", - " window.flipCard(container);\n", - " }\n", - " }\n", - " event.preventDefault();\n", - "}\n", - "\n", - "\n", - "function reenableNext(ths, next) {\n", - " next.style.pointerEvents='auto';\n", - " /* ths.tabIndex= 0;*/\n", - " /* ths.focus(); */\n", - "}\n", - "\n", - "\n", - "\n", - "function slide2(containerId) {\n", - " var container = document.getElementById(containerId);\n", - " var next=document.getElementById(containerId+'-next');\n", - " var frontcard = container.children[0];\n", - " var backcard = container.children[1];\n", - " container.style.pointerEvents='none';\n", - " /* container.removeAttribute(\"tabindex\");*/\n", - " /* container.blur(); */\n", - " //backcard.style.pointerEvents='none';\n", - " next.style.pointerEvents='none';\n", - " next.classList.remove('flipped');\n", - " next.classList.add('hide');\n", - "\n", - " //container.classList.add(\"prepare\");\n", - " \n", - " container.className=\"flip-container slide\";\n", - " backcard.parentElement.removeChild(frontcard);\n", - " backcard.parentElement.appendChild(frontcard);\n", - " setTimeout(slideback, 600, container, frontcard, backcard, next);\n", - " \n", - "}\n", - "\n", - "\n", - "window.checkFlip = function checkFlip(containerId) {\n", - " var container = document.getElementById(containerId);\n", - "\n", - "\n", - " if (container.classList.contains('flip')) {\n", - " container.classList.remove('flip');\n", - " setTimeout(slide2, 600, containerId);\n", - " } \n", - " else {\n", - " slide2(containerId);\n", - " }\n", - "}\n", - "\n", - "\n", - "function slideback(container, frontcard, backcard, next) {\n", - " container.className=\"flip-container slideback\";\n", - " setTimeout(cleanup, 550, container, frontcard, backcard, next);\n", - "}\n", - "\n", - "function cleanup(container, frontcard, backcard, next) {\n", - " container.removeChild(frontcard);\n", - " backcard.className=\"flipper frontcard\";\n", - " container.className=\"flip-container\";\n", - "\n", - " var cardnum=parseInt(container.dataset.cardnum);\n", - " var cards=eval('cards'+container.id);\n", - " var flipper=createOneCard(container, false, cards, cardnum);\n", - " container.append(flipper);\n", - " cardnum= (cardnum+1) % parseInt(container.dataset.numCards);\n", - " container.dataset.cardnum=cardnum;\n", - " if (cardnum != 1){\n", - " next.innerHTML=\"Next >\";\n", - " } else {\n", - " //next.innerHTML=\"Reload \\\\(\\\\circlearrowleft\\\\) \";\n", - " next.innerHTML='Reload '\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([next]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " }\n", - "\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset();\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " next.style.pointerEvents='auto';\n", - " container.style.pointerEvents='auto';\n", - " /* container.tabIndex= 0; */\n", - " /* container.focus(); */\n", - " next.classList.remove('hide');\n", - " container.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(container.id);\n", - " }, {once: true });\n", - "\n", - "\n", - "}\n", - "\n", - "\n", - "function createOneCard (mydiv, frontCard, cards, cardnum) {\n", - " var colors=[\n", - " '--asparagus',\n", - " '--terra-cotta',\n", - " '--cyan-process'\n", - " ]\n", - "\n", - " var flipper = document.createElement('div');\n", - " if (frontCard){\n", - " flipper.className=\"flipper frontcard\"; \n", - " }\n", - " else {\n", - " flipper.className=\"flipper backcard\"; \n", - " }\n", - "\n", - " var front = document.createElement('div');\n", - " front.className='front flashcard';\n", - "\n", - " var frontSpan= document.createElement('span');\n", - " frontSpan.className='flashcardtext';\n", - " frontSpan.innerHTML=jaxify(cards[cardnum]['front']);\n", - " //frontSpan.textContent=jaxify(cards[cardnum]['front']);\n", - " front.style.background='var(' + colors[cardnum % colors.length] + ')';\n", - "\n", - "\n", - " front.append(frontSpan);\n", - " flipper.append(front);\n", - "\n", - " var back = document.createElement('div');\n", - " back.className='back flashcard';\n", - "\n", - " var backSpan= document.createElement('span');\n", - " backSpan.className='flashcardtext';\n", - " backSpan.innerHTML=jaxify(cards[cardnum]['back']);\n", - " back.append(backSpan);\n", - "\n", - " flipper.append(back);\n", - "\n", - " return flipper;\n", - "\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "function createCards(id, keyControl) {\n", - " console.log(id);\n", - " \n", - " var mydiv=document.getElementById(id);\n", - " /*mydiv.onclick = window.flipCard(mydiv);*/\n", - " /*\n", - " mydiv.addEventListener('click', function(){window.flipCard(mydiv);}, false);\n", - " mydiv.addEventListener('keydown', function(event){window.checkKey(mydiv,event);}, true);\n", - " */\n", - " mydiv.onclick = function(){window.flipCard(mydiv);};\n", - " console.log(keyControl);\n", - " if (keyControl == \"True\"){\n", - " mydiv.onkeydown = function(event){window.checkKey(mydiv,event);};\n", - " }\n", - " /* mydiv.addEventListener('keydown', function(event){event.stopPropagation(); console.log(event); event.preventDefault();}, true); */\n", - " /*mydiv.onkeypress = function(event){console.log(event); event.preventDefault();};*/\n", - "\n", - " console.log(mydiv);\n", - " \n", - " var cards=eval('cards'+id);\n", - " mydiv.dataset.cardnum=0;\n", - " mydiv.dataset.numCards=cards.length;\n", - " mydiv.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(id);\n", - " }, {once: true});\n", - "\n", - " var cardnum=0;\n", - " \n", - " for (var i=0; i<2; i++) {\n", - " \n", - " var flipper;\n", - " if (i==0){\n", - " flipper=createOneCard(mydiv, true, cards, cardnum);\n", - " }\n", - " else {\n", - " flipper=createOneCard(mydiv, false, cards, cardnum);\n", - " }\n", - "\n", - " mydiv.append(flipper);\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " if (typeof version == 'undefined') {\n", - " setTimeout(function(){\n", - " var version = MathJax.version;\n", - " console.log('After sleep, MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }, 500);\n", - " } else{\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " cardnum = (cardnum + 1) % mydiv.dataset.numCards;\n", - " }\n", - " mydiv.dataset.cardnum = cardnum;\n", - "\n", - " var next=document.getElementById(id+'-next');\n", - " if (cards.length==1) {\n", - " // Don't show next if no other cards!\n", - " next.style.pointerEvents='none';\n", - " next.classList.add('hide');\n", - " } else {\n", - " next.innerHTML=\"Next >\";\n", - " }\n", - "\n", - " mydiv.focus();\n", - "\n", - " return flipper;\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "var cardsUoSThogulCCq=[\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \"ls assembly_test/*.fastq | while read x
do fastqc -o assembly_test $x
done\"\n", - " }\n", - "];\n", - " \n", - " createCards(\"UoSThogulCCq\", \"True\");\n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from jupytercards import display_flashcards\n", "cards='/home/jupyter/flashcards/'\n", @@ -659,31 +13,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "tf2-gpu.2-8.m102", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/tf2-gpu.2-8:m102" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/AWS/quiz_files/quiz6-2.ipynb b/AWS/quiz_files/quiz6-2.ipynb index 30861c0..0b8e9f8 100644 --- a/AWS/quiz_files/quiz6-2.ipynb +++ b/AWS/quiz_files/quiz6-2.ipynb @@ -2,656 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "113fb089-7d61-481e-9473-f72bf2ed5371", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "/*!\n", - " * swiped-events.js - v1.1.4\n", - " * Pure JavaScript swipe events\n", - " * https://github.com/john-doherty/swiped-events\n", - " * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element\n", - " * @author John Doherty \n", - " * @license MIT\n", - " */\n", - "!function(t,e){\"use strict\";\"function\"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=e.createEvent(\"CustomEvent\");return a.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),a},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener(\"touchstart\",function(t){if(\"true\"===t.target.getAttribute(\"data-swipe-ignore\"))return;s=t.target,r=Date.now(),n=t.touches[0].clientX,a=t.touches[0].clientY,u=0,i=0},!1),e.addEventListener(\"touchmove\",function(t){if(!n||!a)return;var e=t.touches[0].clientX,r=t.touches[0].clientY;u=n-e,i=a-r},!1),e.addEventListener(\"touchend\",function(t){if(s!==t.target)return;var e=parseInt(l(s,\"data-swipe-threshold\",\"20\"),10),o=parseInt(l(s,\"data-swipe-timeout\",\"500\"),10),c=Date.now()-r,d=\"\",p=t.changedTouches||t.touches||[];Math.abs(u)>Math.abs(i)?Math.abs(u)>e&&c0?\"swiped-left\":\"swiped-right\"):Math.abs(i)>e&&c0?\"swiped-up\":\"swiped-down\");if(\"\"!==d){var b={dir:d.replace(/swiped-/,\"\"),xStart:parseInt(n,10),xEnd:parseInt((p[0]||{}).clientX||-1,10),yStart:parseInt(a,10),yEnd:parseInt((p[0]||{}).clientY||-1,10)};s.dispatchEvent(new CustomEvent(\"swiped\",{bubbles:!0,cancelable:!0,detail:b})),s.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:b}))}n=null,a=null,r=null},!1);var n=null,a=null,u=null,i=null,r=null,s=null;function l(t,n,a){for(;t&&t!==e.documentElement;){var u=t.getAttribute(n);if(u)return u;t=t.parentNode}return a}}(window,document);\n", - "\n", - "function jaxify(string) {\n", - " var mystring = string;\n", - " console.log(mystring);\n", - "\n", - " var count = 0;\n", - " var loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - "\n", - " var count2 = 0;\n", - " var loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - "\n", - " //console.log(loc);\n", - "\n", - " while ((loc >= 0) || (loc2 >= 0)) {\n", - "\n", - " /* Have to replace all the double $$ first with current implementation */\n", - " if (loc2 >= 0) {\n", - " if (count2 % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\[\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\]\");\n", - " }\n", - " count2++;\n", - " } else {\n", - " if (count % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\(\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\)\");\n", - " }\n", - " count++;\n", - " }\n", - " loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - " loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - " //console.log(mystring,\", loc:\",loc,\", loc2:\",loc2);\n", - " }\n", - "\n", - " //console.log(mystring);\n", - " return mystring;\n", - "}\n", - "\n", - "window.flipCard = function flipCard(ths) {\n", - " console.log(ths);\n", - " console.log(ths.id);\n", - " ths.classList.toggle(\"flip\"); \n", - " var next=document.getElementById(ths.id+'-next');\n", - " next.style.pointerEvents='none';\n", - " /* ths.blur(); */\n", - " next.classList.add('flipped');\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([ths]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " setTimeout(reenableNext, 600, ths, next);\n", - "}\n", - "\n", - "window.checkKey = function checkKey(container, event) {\n", - " event.stopPropagation();\n", - " /*\n", - " console.log(container);\n", - " console.log(event.key);\n", - " console.log(event.code);\n", - " */\n", - " /* JMS: Working here*/\n", - " var next=document.getElementById(container.id+'-next');\n", - " /* Only react if not already sliding */\n", - " if (! next.classList.contains(\"hide\")) {\n", - " if ((event.key == \"j\") || (event.key == \"Enter\") || (event.key == \"ArrowRight\")) {\n", - " window.checkFlip(container.id);\n", - " }\n", - " if (event.key == \" \") {\n", - " window.flipCard(container);\n", - " }\n", - " }\n", - " event.preventDefault();\n", - "}\n", - "\n", - "\n", - "function reenableNext(ths, next) {\n", - " next.style.pointerEvents='auto';\n", - " /* ths.tabIndex= 0;*/\n", - " /* ths.focus(); */\n", - "}\n", - "\n", - "\n", - "\n", - "function slide2(containerId) {\n", - " var container = document.getElementById(containerId);\n", - " var next=document.getElementById(containerId+'-next');\n", - " var frontcard = container.children[0];\n", - " var backcard = container.children[1];\n", - " container.style.pointerEvents='none';\n", - " /* container.removeAttribute(\"tabindex\");*/\n", - " /* container.blur(); */\n", - " //backcard.style.pointerEvents='none';\n", - " next.style.pointerEvents='none';\n", - " next.classList.remove('flipped');\n", - " next.classList.add('hide');\n", - "\n", - " //container.classList.add(\"prepare\");\n", - " \n", - " container.className=\"flip-container slide\";\n", - " backcard.parentElement.removeChild(frontcard);\n", - " backcard.parentElement.appendChild(frontcard);\n", - " setTimeout(slideback, 600, container, frontcard, backcard, next);\n", - " \n", - "}\n", - "\n", - "\n", - "window.checkFlip = function checkFlip(containerId) {\n", - " var container = document.getElementById(containerId);\n", - "\n", - "\n", - " if (container.classList.contains('flip')) {\n", - " container.classList.remove('flip');\n", - " setTimeout(slide2, 600, containerId);\n", - " } \n", - " else {\n", - " slide2(containerId);\n", - " }\n", - "}\n", - "\n", - "\n", - "function slideback(container, frontcard, backcard, next) {\n", - " container.className=\"flip-container slideback\";\n", - " setTimeout(cleanup, 550, container, frontcard, backcard, next);\n", - "}\n", - "\n", - "function cleanup(container, frontcard, backcard, next) {\n", - " container.removeChild(frontcard);\n", - " backcard.className=\"flipper frontcard\";\n", - " container.className=\"flip-container\";\n", - "\n", - " var cardnum=parseInt(container.dataset.cardnum);\n", - " var cards=eval('cards'+container.id);\n", - " var flipper=createOneCard(container, false, cards, cardnum);\n", - " container.append(flipper);\n", - " cardnum= (cardnum+1) % parseInt(container.dataset.numCards);\n", - " container.dataset.cardnum=cardnum;\n", - " if (cardnum != 1){\n", - " next.innerHTML=\"Next >\";\n", - " } else {\n", - " //next.innerHTML=\"Reload \\\\(\\\\circlearrowleft\\\\) \";\n", - " next.innerHTML='Reload '\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([next]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " }\n", - "\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset();\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " next.style.pointerEvents='auto';\n", - " container.style.pointerEvents='auto';\n", - " /* container.tabIndex= 0; */\n", - " /* container.focus(); */\n", - " next.classList.remove('hide');\n", - " container.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(container.id);\n", - " }, {once: true });\n", - "\n", - "\n", - "}\n", - "\n", - "\n", - "function createOneCard (mydiv, frontCard, cards, cardnum) {\n", - " var colors=[\n", - " '--asparagus',\n", - " '--terra-cotta',\n", - " '--cyan-process'\n", - " ]\n", - "\n", - " var flipper = document.createElement('div');\n", - " if (frontCard){\n", - " flipper.className=\"flipper frontcard\"; \n", - " }\n", - " else {\n", - " flipper.className=\"flipper backcard\"; \n", - " }\n", - "\n", - " var front = document.createElement('div');\n", - " front.className='front flashcard';\n", - "\n", - " var frontSpan= document.createElement('span');\n", - " frontSpan.className='flashcardtext';\n", - " frontSpan.innerHTML=jaxify(cards[cardnum]['front']);\n", - " //frontSpan.textContent=jaxify(cards[cardnum]['front']);\n", - " front.style.background='var(' + colors[cardnum % colors.length] + ')';\n", - "\n", - "\n", - " front.append(frontSpan);\n", - " flipper.append(front);\n", - "\n", - " var back = document.createElement('div');\n", - " back.className='back flashcard';\n", - "\n", - " var backSpan= document.createElement('span');\n", - " backSpan.className='flashcardtext';\n", - " backSpan.innerHTML=jaxify(cards[cardnum]['back']);\n", - " back.append(backSpan);\n", - "\n", - " flipper.append(back);\n", - "\n", - " return flipper;\n", - "\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "function createCards(id, keyControl) {\n", - " console.log(id);\n", - " \n", - " var mydiv=document.getElementById(id);\n", - " /*mydiv.onclick = window.flipCard(mydiv);*/\n", - " /*\n", - " mydiv.addEventListener('click', function(){window.flipCard(mydiv);}, false);\n", - " mydiv.addEventListener('keydown', function(event){window.checkKey(mydiv,event);}, true);\n", - " */\n", - " mydiv.onclick = function(){window.flipCard(mydiv);};\n", - " console.log(keyControl);\n", - " if (keyControl == \"True\"){\n", - " mydiv.onkeydown = function(event){window.checkKey(mydiv,event);};\n", - " }\n", - " /* mydiv.addEventListener('keydown', function(event){event.stopPropagation(); console.log(event); event.preventDefault();}, true); */\n", - " /*mydiv.onkeypress = function(event){console.log(event); event.preventDefault();};*/\n", - "\n", - " console.log(mydiv);\n", - " \n", - " var cards=eval('cards'+id);\n", - " mydiv.dataset.cardnum=0;\n", - " mydiv.dataset.numCards=cards.length;\n", - " mydiv.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(id);\n", - " }, {once: true});\n", - "\n", - " var cardnum=0;\n", - " \n", - " for (var i=0; i<2; i++) {\n", - " \n", - " var flipper;\n", - " if (i==0){\n", - " flipper=createOneCard(mydiv, true, cards, cardnum);\n", - " }\n", - " else {\n", - " flipper=createOneCard(mydiv, false, cards, cardnum);\n", - " }\n", - "\n", - " mydiv.append(flipper);\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " if (typeof version == 'undefined') {\n", - " setTimeout(function(){\n", - " var version = MathJax.version;\n", - " console.log('After sleep, MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }, 500);\n", - " } else{\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " cardnum = (cardnum + 1) % mydiv.dataset.numCards;\n", - " }\n", - " mydiv.dataset.cardnum = cardnum;\n", - "\n", - " var next=document.getElementById(id+'-next');\n", - " if (cards.length==1) {\n", - " // Don't show next if no other cards!\n", - " next.style.pointerEvents='none';\n", - " next.classList.add('hide');\n", - " } else {\n", - " next.innerHTML=\"Next >\";\n", - " }\n", - "\n", - " mydiv.focus();\n", - "\n", - " return flipper;\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "var cardsiXXrkDxAbeBZ=[\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \"prokka assembly_test/scaffolds.fasta --outdir assembly_test --force --prefix SRR18241034 --centre test --compliant\"\n", - " }\n", - "];\n", - " \n", - " createCards(\"iXXrkDxAbeBZ\", \"True\");\n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from jupytercards import display_flashcards\n", "cards='../flashcards/'\n", @@ -667,31 +21,7 @@ "source": [] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "common-cpu.m102", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/base-cpu:m102" - }, - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/AWS/quiz_files/quiz6-3.ipynb b/AWS/quiz_files/quiz6-3.ipynb index ea5326b..0c3ffd4 100644 --- a/AWS/quiz_files/quiz6-3.ipynb +++ b/AWS/quiz_files/quiz6-3.ipynb @@ -2,656 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "113fb089-7d61-481e-9473-f72bf2ed5371", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "/*!\n", - " * swiped-events.js - v1.1.4\n", - " * Pure JavaScript swipe events\n", - " * https://github.com/john-doherty/swiped-events\n", - " * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element\n", - " * @author John Doherty \n", - " * @license MIT\n", - " */\n", - "!function(t,e){\"use strict\";\"function\"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=e.createEvent(\"CustomEvent\");return a.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),a},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener(\"touchstart\",function(t){if(\"true\"===t.target.getAttribute(\"data-swipe-ignore\"))return;s=t.target,r=Date.now(),n=t.touches[0].clientX,a=t.touches[0].clientY,u=0,i=0},!1),e.addEventListener(\"touchmove\",function(t){if(!n||!a)return;var e=t.touches[0].clientX,r=t.touches[0].clientY;u=n-e,i=a-r},!1),e.addEventListener(\"touchend\",function(t){if(s!==t.target)return;var e=parseInt(l(s,\"data-swipe-threshold\",\"20\"),10),o=parseInt(l(s,\"data-swipe-timeout\",\"500\"),10),c=Date.now()-r,d=\"\",p=t.changedTouches||t.touches||[];Math.abs(u)>Math.abs(i)?Math.abs(u)>e&&c0?\"swiped-left\":\"swiped-right\"):Math.abs(i)>e&&c0?\"swiped-up\":\"swiped-down\");if(\"\"!==d){var b={dir:d.replace(/swiped-/,\"\"),xStart:parseInt(n,10),xEnd:parseInt((p[0]||{}).clientX||-1,10),yStart:parseInt(a,10),yEnd:parseInt((p[0]||{}).clientY||-1,10)};s.dispatchEvent(new CustomEvent(\"swiped\",{bubbles:!0,cancelable:!0,detail:b})),s.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:b}))}n=null,a=null,r=null},!1);var n=null,a=null,u=null,i=null,r=null,s=null;function l(t,n,a){for(;t&&t!==e.documentElement;){var u=t.getAttribute(n);if(u)return u;t=t.parentNode}return a}}(window,document);\n", - "\n", - "function jaxify(string) {\n", - " var mystring = string;\n", - " console.log(mystring);\n", - "\n", - " var count = 0;\n", - " var loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - "\n", - " var count2 = 0;\n", - " var loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - "\n", - " //console.log(loc);\n", - "\n", - " while ((loc >= 0) || (loc2 >= 0)) {\n", - "\n", - " /* Have to replace all the double $$ first with current implementation */\n", - " if (loc2 >= 0) {\n", - " if (count2 % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\[\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\]\");\n", - " }\n", - " count2++;\n", - " } else {\n", - " if (count % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\(\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\)\");\n", - " }\n", - " count++;\n", - " }\n", - " loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - " loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - " //console.log(mystring,\", loc:\",loc,\", loc2:\",loc2);\n", - " }\n", - "\n", - " //console.log(mystring);\n", - " return mystring;\n", - "}\n", - "\n", - "window.flipCard = function flipCard(ths) {\n", - " console.log(ths);\n", - " console.log(ths.id);\n", - " ths.classList.toggle(\"flip\"); \n", - " var next=document.getElementById(ths.id+'-next');\n", - " next.style.pointerEvents='none';\n", - " /* ths.blur(); */\n", - " next.classList.add('flipped');\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([ths]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " setTimeout(reenableNext, 600, ths, next);\n", - "}\n", - "\n", - "window.checkKey = function checkKey(container, event) {\n", - " event.stopPropagation();\n", - " /*\n", - " console.log(container);\n", - " console.log(event.key);\n", - " console.log(event.code);\n", - " */\n", - " /* JMS: Working here*/\n", - " var next=document.getElementById(container.id+'-next');\n", - " /* Only react if not already sliding */\n", - " if (! next.classList.contains(\"hide\")) {\n", - " if ((event.key == \"j\") || (event.key == \"Enter\") || (event.key == \"ArrowRight\")) {\n", - " window.checkFlip(container.id);\n", - " }\n", - " if (event.key == \" \") {\n", - " window.flipCard(container);\n", - " }\n", - " }\n", - " event.preventDefault();\n", - "}\n", - "\n", - "\n", - "function reenableNext(ths, next) {\n", - " next.style.pointerEvents='auto';\n", - " /* ths.tabIndex= 0;*/\n", - " /* ths.focus(); */\n", - "}\n", - "\n", - "\n", - "\n", - "function slide2(containerId) {\n", - " var container = document.getElementById(containerId);\n", - " var next=document.getElementById(containerId+'-next');\n", - " var frontcard = container.children[0];\n", - " var backcard = container.children[1];\n", - " container.style.pointerEvents='none';\n", - " /* container.removeAttribute(\"tabindex\");*/\n", - " /* container.blur(); */\n", - " //backcard.style.pointerEvents='none';\n", - " next.style.pointerEvents='none';\n", - " next.classList.remove('flipped');\n", - " next.classList.add('hide');\n", - "\n", - " //container.classList.add(\"prepare\");\n", - " \n", - " container.className=\"flip-container slide\";\n", - " backcard.parentElement.removeChild(frontcard);\n", - " backcard.parentElement.appendChild(frontcard);\n", - " setTimeout(slideback, 600, container, frontcard, backcard, next);\n", - " \n", - "}\n", - "\n", - "\n", - "window.checkFlip = function checkFlip(containerId) {\n", - " var container = document.getElementById(containerId);\n", - "\n", - "\n", - " if (container.classList.contains('flip')) {\n", - " container.classList.remove('flip');\n", - " setTimeout(slide2, 600, containerId);\n", - " } \n", - " else {\n", - " slide2(containerId);\n", - " }\n", - "}\n", - "\n", - "\n", - "function slideback(container, frontcard, backcard, next) {\n", - " container.className=\"flip-container slideback\";\n", - " setTimeout(cleanup, 550, container, frontcard, backcard, next);\n", - "}\n", - "\n", - "function cleanup(container, frontcard, backcard, next) {\n", - " container.removeChild(frontcard);\n", - " backcard.className=\"flipper frontcard\";\n", - " container.className=\"flip-container\";\n", - "\n", - " var cardnum=parseInt(container.dataset.cardnum);\n", - " var cards=eval('cards'+container.id);\n", - " var flipper=createOneCard(container, false, cards, cardnum);\n", - " container.append(flipper);\n", - " cardnum= (cardnum+1) % parseInt(container.dataset.numCards);\n", - " container.dataset.cardnum=cardnum;\n", - " if (cardnum != 1){\n", - " next.innerHTML=\"Next >\";\n", - " } else {\n", - " //next.innerHTML=\"Reload \\\\(\\\\circlearrowleft\\\\) \";\n", - " next.innerHTML='Reload '\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([next]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " }\n", - "\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset();\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " next.style.pointerEvents='auto';\n", - " container.style.pointerEvents='auto';\n", - " /* container.tabIndex= 0; */\n", - " /* container.focus(); */\n", - " next.classList.remove('hide');\n", - " container.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(container.id);\n", - " }, {once: true });\n", - "\n", - "\n", - "}\n", - "\n", - "\n", - "function createOneCard (mydiv, frontCard, cards, cardnum) {\n", - " var colors=[\n", - " '--asparagus',\n", - " '--terra-cotta',\n", - " '--cyan-process'\n", - " ]\n", - "\n", - " var flipper = document.createElement('div');\n", - " if (frontCard){\n", - " flipper.className=\"flipper frontcard\"; \n", - " }\n", - " else {\n", - " flipper.className=\"flipper backcard\"; \n", - " }\n", - "\n", - " var front = document.createElement('div');\n", - " front.className='front flashcard';\n", - "\n", - " var frontSpan= document.createElement('span');\n", - " frontSpan.className='flashcardtext';\n", - " frontSpan.innerHTML=jaxify(cards[cardnum]['front']);\n", - " //frontSpan.textContent=jaxify(cards[cardnum]['front']);\n", - " front.style.background='var(' + colors[cardnum % colors.length] + ')';\n", - "\n", - "\n", - " front.append(frontSpan);\n", - " flipper.append(front);\n", - "\n", - " var back = document.createElement('div');\n", - " back.className='back flashcard';\n", - "\n", - " var backSpan= document.createElement('span');\n", - " backSpan.className='flashcardtext';\n", - " backSpan.innerHTML=jaxify(cards[cardnum]['back']);\n", - " back.append(backSpan);\n", - "\n", - " flipper.append(back);\n", - "\n", - " return flipper;\n", - "\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "function createCards(id, keyControl) {\n", - " console.log(id);\n", - " \n", - " var mydiv=document.getElementById(id);\n", - " /*mydiv.onclick = window.flipCard(mydiv);*/\n", - " /*\n", - " mydiv.addEventListener('click', function(){window.flipCard(mydiv);}, false);\n", - " mydiv.addEventListener('keydown', function(event){window.checkKey(mydiv,event);}, true);\n", - " */\n", - " mydiv.onclick = function(){window.flipCard(mydiv);};\n", - " console.log(keyControl);\n", - " if (keyControl == \"True\"){\n", - " mydiv.onkeydown = function(event){window.checkKey(mydiv,event);};\n", - " }\n", - " /* mydiv.addEventListener('keydown', function(event){event.stopPropagation(); console.log(event); event.preventDefault();}, true); */\n", - " /*mydiv.onkeypress = function(event){console.log(event); event.preventDefault();};*/\n", - "\n", - " console.log(mydiv);\n", - " \n", - " var cards=eval('cards'+id);\n", - " mydiv.dataset.cardnum=0;\n", - " mydiv.dataset.numCards=cards.length;\n", - " mydiv.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(id);\n", - " }, {once: true});\n", - "\n", - " var cardnum=0;\n", - " \n", - " for (var i=0; i<2; i++) {\n", - " \n", - " var flipper;\n", - " if (i==0){\n", - " flipper=createOneCard(mydiv, true, cards, cardnum);\n", - " }\n", - " else {\n", - " flipper=createOneCard(mydiv, false, cards, cardnum);\n", - " }\n", - "\n", - " mydiv.append(flipper);\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " if (typeof version == 'undefined') {\n", - " setTimeout(function(){\n", - " var version = MathJax.version;\n", - " console.log('After sleep, MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }, 500);\n", - " } else{\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " cardnum = (cardnum + 1) % mydiv.dataset.numCards;\n", - " }\n", - " mydiv.dataset.cardnum = cardnum;\n", - "\n", - " var next=document.getElementById(id+'-next');\n", - " if (cards.length==1) {\n", - " // Don't show next if no other cards!\n", - " next.style.pointerEvents='none';\n", - " next.classList.add('hide');\n", - " } else {\n", - " next.innerHTML=\"Next >\";\n", - " }\n", - "\n", - " mydiv.focus();\n", - "\n", - " return flipper;\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "var cardsttnhQuOfaeEJ=[\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \" gsutil cp assembly_test/*.html gs://$BUCKET\"\n", - " }\n", - "];\n", - " \n", - " createCards(\"ttnhQuOfaeEJ\", \"True\");\n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from jupytercards import display_flashcards\n", "cards='/home/jupyter/flashcards/'\n", @@ -659,31 +13,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "tf2-gpu.2-8.m102", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/tf2-gpu.2-8:m102" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/AWS/quiz_files/quiz6-4.ipynb b/AWS/quiz_files/quiz6-4.ipynb index 9f43905..da2e157 100644 --- a/AWS/quiz_files/quiz6-4.ipynb +++ b/AWS/quiz_files/quiz6-4.ipynb @@ -2,656 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "113fb089-7d61-481e-9473-f72bf2ed5371", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "/*!\n", - " * swiped-events.js - v1.1.4\n", - " * Pure JavaScript swipe events\n", - " * https://github.com/john-doherty/swiped-events\n", - " * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element\n", - " * @author John Doherty \n", - " * @license MIT\n", - " */\n", - "!function(t,e){\"use strict\";\"function\"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=e.createEvent(\"CustomEvent\");return a.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),a},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener(\"touchstart\",function(t){if(\"true\"===t.target.getAttribute(\"data-swipe-ignore\"))return;s=t.target,r=Date.now(),n=t.touches[0].clientX,a=t.touches[0].clientY,u=0,i=0},!1),e.addEventListener(\"touchmove\",function(t){if(!n||!a)return;var e=t.touches[0].clientX,r=t.touches[0].clientY;u=n-e,i=a-r},!1),e.addEventListener(\"touchend\",function(t){if(s!==t.target)return;var e=parseInt(l(s,\"data-swipe-threshold\",\"20\"),10),o=parseInt(l(s,\"data-swipe-timeout\",\"500\"),10),c=Date.now()-r,d=\"\",p=t.changedTouches||t.touches||[];Math.abs(u)>Math.abs(i)?Math.abs(u)>e&&c0?\"swiped-left\":\"swiped-right\"):Math.abs(i)>e&&c0?\"swiped-up\":\"swiped-down\");if(\"\"!==d){var b={dir:d.replace(/swiped-/,\"\"),xStart:parseInt(n,10),xEnd:parseInt((p[0]||{}).clientX||-1,10),yStart:parseInt(a,10),yEnd:parseInt((p[0]||{}).clientY||-1,10)};s.dispatchEvent(new CustomEvent(\"swiped\",{bubbles:!0,cancelable:!0,detail:b})),s.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:b}))}n=null,a=null,r=null},!1);var n=null,a=null,u=null,i=null,r=null,s=null;function l(t,n,a){for(;t&&t!==e.documentElement;){var u=t.getAttribute(n);if(u)return u;t=t.parentNode}return a}}(window,document);\n", - "\n", - "function jaxify(string) {\n", - " var mystring = string;\n", - " console.log(mystring);\n", - "\n", - " var count = 0;\n", - " var loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - "\n", - " var count2 = 0;\n", - " var loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - "\n", - " //console.log(loc);\n", - "\n", - " while ((loc >= 0) || (loc2 >= 0)) {\n", - "\n", - " /* Have to replace all the double $$ first with current implementation */\n", - " if (loc2 >= 0) {\n", - " if (count2 % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\[\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\]\");\n", - " }\n", - " count2++;\n", - " } else {\n", - " if (count % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\(\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\)\");\n", - " }\n", - " count++;\n", - " }\n", - " loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - " loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - " //console.log(mystring,\", loc:\",loc,\", loc2:\",loc2);\n", - " }\n", - "\n", - " //console.log(mystring);\n", - " return mystring;\n", - "}\n", - "\n", - "window.flipCard = function flipCard(ths) {\n", - " console.log(ths);\n", - " console.log(ths.id);\n", - " ths.classList.toggle(\"flip\"); \n", - " var next=document.getElementById(ths.id+'-next');\n", - " next.style.pointerEvents='none';\n", - " /* ths.blur(); */\n", - " next.classList.add('flipped');\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([ths]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " setTimeout(reenableNext, 600, ths, next);\n", - "}\n", - "\n", - "window.checkKey = function checkKey(container, event) {\n", - " event.stopPropagation();\n", - " /*\n", - " console.log(container);\n", - " console.log(event.key);\n", - " console.log(event.code);\n", - " */\n", - " /* JMS: Working here*/\n", - " var next=document.getElementById(container.id+'-next');\n", - " /* Only react if not already sliding */\n", - " if (! next.classList.contains(\"hide\")) {\n", - " if ((event.key == \"j\") || (event.key == \"Enter\") || (event.key == \"ArrowRight\")) {\n", - " window.checkFlip(container.id);\n", - " }\n", - " if (event.key == \" \") {\n", - " window.flipCard(container);\n", - " }\n", - " }\n", - " event.preventDefault();\n", - "}\n", - "\n", - "\n", - "function reenableNext(ths, next) {\n", - " next.style.pointerEvents='auto';\n", - " /* ths.tabIndex= 0;*/\n", - " /* ths.focus(); */\n", - "}\n", - "\n", - "\n", - "\n", - "function slide2(containerId) {\n", - " var container = document.getElementById(containerId);\n", - " var next=document.getElementById(containerId+'-next');\n", - " var frontcard = container.children[0];\n", - " var backcard = container.children[1];\n", - " container.style.pointerEvents='none';\n", - " /* container.removeAttribute(\"tabindex\");*/\n", - " /* container.blur(); */\n", - " //backcard.style.pointerEvents='none';\n", - " next.style.pointerEvents='none';\n", - " next.classList.remove('flipped');\n", - " next.classList.add('hide');\n", - "\n", - " //container.classList.add(\"prepare\");\n", - " \n", - " container.className=\"flip-container slide\";\n", - " backcard.parentElement.removeChild(frontcard);\n", - " backcard.parentElement.appendChild(frontcard);\n", - " setTimeout(slideback, 600, container, frontcard, backcard, next);\n", - " \n", - "}\n", - "\n", - "\n", - "window.checkFlip = function checkFlip(containerId) {\n", - " var container = document.getElementById(containerId);\n", - "\n", - "\n", - " if (container.classList.contains('flip')) {\n", - " container.classList.remove('flip');\n", - " setTimeout(slide2, 600, containerId);\n", - " } \n", - " else {\n", - " slide2(containerId);\n", - " }\n", - "}\n", - "\n", - "\n", - "function slideback(container, frontcard, backcard, next) {\n", - " container.className=\"flip-container slideback\";\n", - " setTimeout(cleanup, 550, container, frontcard, backcard, next);\n", - "}\n", - "\n", - "function cleanup(container, frontcard, backcard, next) {\n", - " container.removeChild(frontcard);\n", - " backcard.className=\"flipper frontcard\";\n", - " container.className=\"flip-container\";\n", - "\n", - " var cardnum=parseInt(container.dataset.cardnum);\n", - " var cards=eval('cards'+container.id);\n", - " var flipper=createOneCard(container, false, cards, cardnum);\n", - " container.append(flipper);\n", - " cardnum= (cardnum+1) % parseInt(container.dataset.numCards);\n", - " container.dataset.cardnum=cardnum;\n", - " if (cardnum != 1){\n", - " next.innerHTML=\"Next >\";\n", - " } else {\n", - " //next.innerHTML=\"Reload \\\\(\\\\circlearrowleft\\\\) \";\n", - " next.innerHTML='Reload '\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([next]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " }\n", - "\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset();\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " next.style.pointerEvents='auto';\n", - " container.style.pointerEvents='auto';\n", - " /* container.tabIndex= 0; */\n", - " /* container.focus(); */\n", - " next.classList.remove('hide');\n", - " container.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(container.id);\n", - " }, {once: true });\n", - "\n", - "\n", - "}\n", - "\n", - "\n", - "function createOneCard (mydiv, frontCard, cards, cardnum) {\n", - " var colors=[\n", - " '--asparagus',\n", - " '--terra-cotta',\n", - " '--cyan-process'\n", - " ]\n", - "\n", - " var flipper = document.createElement('div');\n", - " if (frontCard){\n", - " flipper.className=\"flipper frontcard\"; \n", - " }\n", - " else {\n", - " flipper.className=\"flipper backcard\"; \n", - " }\n", - "\n", - " var front = document.createElement('div');\n", - " front.className='front flashcard';\n", - "\n", - " var frontSpan= document.createElement('span');\n", - " frontSpan.className='flashcardtext';\n", - " frontSpan.innerHTML=jaxify(cards[cardnum]['front']);\n", - " //frontSpan.textContent=jaxify(cards[cardnum]['front']);\n", - " front.style.background='var(' + colors[cardnum % colors.length] + ')';\n", - "\n", - "\n", - " front.append(frontSpan);\n", - " flipper.append(front);\n", - "\n", - " var back = document.createElement('div');\n", - " back.className='back flashcard';\n", - "\n", - " var backSpan= document.createElement('span');\n", - " backSpan.className='flashcardtext';\n", - " backSpan.innerHTML=jaxify(cards[cardnum]['back']);\n", - " back.append(backSpan);\n", - "\n", - " flipper.append(back);\n", - "\n", - " return flipper;\n", - "\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "function createCards(id, keyControl) {\n", - " console.log(id);\n", - " \n", - " var mydiv=document.getElementById(id);\n", - " /*mydiv.onclick = window.flipCard(mydiv);*/\n", - " /*\n", - " mydiv.addEventListener('click', function(){window.flipCard(mydiv);}, false);\n", - " mydiv.addEventListener('keydown', function(event){window.checkKey(mydiv,event);}, true);\n", - " */\n", - " mydiv.onclick = function(){window.flipCard(mydiv);};\n", - " console.log(keyControl);\n", - " if (keyControl == \"True\"){\n", - " mydiv.onkeydown = function(event){window.checkKey(mydiv,event);};\n", - " }\n", - " /* mydiv.addEventListener('keydown', function(event){event.stopPropagation(); console.log(event); event.preventDefault();}, true); */\n", - " /*mydiv.onkeypress = function(event){console.log(event); event.preventDefault();};*/\n", - "\n", - " console.log(mydiv);\n", - " \n", - " var cards=eval('cards'+id);\n", - " mydiv.dataset.cardnum=0;\n", - " mydiv.dataset.numCards=cards.length;\n", - " mydiv.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(id);\n", - " }, {once: true});\n", - "\n", - " var cardnum=0;\n", - " \n", - " for (var i=0; i<2; i++) {\n", - " \n", - " var flipper;\n", - " if (i==0){\n", - " flipper=createOneCard(mydiv, true, cards, cardnum);\n", - " }\n", - " else {\n", - " flipper=createOneCard(mydiv, false, cards, cardnum);\n", - " }\n", - "\n", - " mydiv.append(flipper);\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " if (typeof version == 'undefined') {\n", - " setTimeout(function(){\n", - " var version = MathJax.version;\n", - " console.log('After sleep, MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }, 500);\n", - " } else{\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " cardnum = (cardnum + 1) % mydiv.dataset.numCards;\n", - " }\n", - " mydiv.dataset.cardnum = cardnum;\n", - "\n", - " var next=document.getElementById(id+'-next');\n", - " if (cards.length==1) {\n", - " // Don't show next if no other cards!\n", - " next.style.pointerEvents='none';\n", - " next.classList.add('hide');\n", - " } else {\n", - " next.innerHTML=\"Next >\";\n", - " }\n", - "\n", - " mydiv.focus();\n", - "\n", - " return flipper;\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "var cardsJDatXLVXOEST=[\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \" gsutil cp assembly_test/*.gff gs://$BUCKET\"\n", - " }\n", - "];\n", - " \n", - " createCards(\"JDatXLVXOEST\", \"True\");\n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from jupytercards import display_flashcards\n", "cards='/home/jupyter/flashcards/'\n", @@ -659,31 +13,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "tf2-gpu.2-8.m102", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/tf2-gpu.2-8:m102" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/AWS/quiz_files/quiz7-1.ipynb b/AWS/quiz_files/quiz7-1.ipynb index ea4e75c..195560d 100644 --- a/AWS/quiz_files/quiz7-1.ipynb +++ b/AWS/quiz_files/quiz7-1.ipynb @@ -2,656 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "113fb089-7d61-481e-9473-f72bf2ed5371", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "/*!\n", - " * swiped-events.js - v1.1.4\n", - " * Pure JavaScript swipe events\n", - " * https://github.com/john-doherty/swiped-events\n", - " * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element\n", - " * @author John Doherty \n", - " * @license MIT\n", - " */\n", - "!function(t,e){\"use strict\";\"function\"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=e.createEvent(\"CustomEvent\");return a.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),a},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener(\"touchstart\",function(t){if(\"true\"===t.target.getAttribute(\"data-swipe-ignore\"))return;s=t.target,r=Date.now(),n=t.touches[0].clientX,a=t.touches[0].clientY,u=0,i=0},!1),e.addEventListener(\"touchmove\",function(t){if(!n||!a)return;var e=t.touches[0].clientX,r=t.touches[0].clientY;u=n-e,i=a-r},!1),e.addEventListener(\"touchend\",function(t){if(s!==t.target)return;var e=parseInt(l(s,\"data-swipe-threshold\",\"20\"),10),o=parseInt(l(s,\"data-swipe-timeout\",\"500\"),10),c=Date.now()-r,d=\"\",p=t.changedTouches||t.touches||[];Math.abs(u)>Math.abs(i)?Math.abs(u)>e&&c0?\"swiped-left\":\"swiped-right\"):Math.abs(i)>e&&c0?\"swiped-up\":\"swiped-down\");if(\"\"!==d){var b={dir:d.replace(/swiped-/,\"\"),xStart:parseInt(n,10),xEnd:parseInt((p[0]||{}).clientX||-1,10),yStart:parseInt(a,10),yEnd:parseInt((p[0]||{}).clientY||-1,10)};s.dispatchEvent(new CustomEvent(\"swiped\",{bubbles:!0,cancelable:!0,detail:b})),s.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:b}))}n=null,a=null,r=null},!1);var n=null,a=null,u=null,i=null,r=null,s=null;function l(t,n,a){for(;t&&t!==e.documentElement;){var u=t.getAttribute(n);if(u)return u;t=t.parentNode}return a}}(window,document);\n", - "\n", - "function jaxify(string) {\n", - " var mystring = string;\n", - " console.log(mystring);\n", - "\n", - " var count = 0;\n", - " var loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - "\n", - " var count2 = 0;\n", - " var loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - "\n", - " //console.log(loc);\n", - "\n", - " while ((loc >= 0) || (loc2 >= 0)) {\n", - "\n", - " /* Have to replace all the double $$ first with current implementation */\n", - " if (loc2 >= 0) {\n", - " if (count2 % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\[\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\]\");\n", - " }\n", - " count2++;\n", - " } else {\n", - " if (count % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\(\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\)\");\n", - " }\n", - " count++;\n", - " }\n", - " loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - " loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - " //console.log(mystring,\", loc:\",loc,\", loc2:\",loc2);\n", - " }\n", - "\n", - " //console.log(mystring);\n", - " return mystring;\n", - "}\n", - "\n", - "window.flipCard = function flipCard(ths) {\n", - " console.log(ths);\n", - " console.log(ths.id);\n", - " ths.classList.toggle(\"flip\"); \n", - " var next=document.getElementById(ths.id+'-next');\n", - " next.style.pointerEvents='none';\n", - " /* ths.blur(); */\n", - " next.classList.add('flipped');\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([ths]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " setTimeout(reenableNext, 600, ths, next);\n", - "}\n", - "\n", - "window.checkKey = function checkKey(container, event) {\n", - " event.stopPropagation();\n", - " /*\n", - " console.log(container);\n", - " console.log(event.key);\n", - " console.log(event.code);\n", - " */\n", - " /* JMS: Working here*/\n", - " var next=document.getElementById(container.id+'-next');\n", - " /* Only react if not already sliding */\n", - " if (! next.classList.contains(\"hide\")) {\n", - " if ((event.key == \"j\") || (event.key == \"Enter\") || (event.key == \"ArrowRight\")) {\n", - " window.checkFlip(container.id);\n", - " }\n", - " if (event.key == \" \") {\n", - " window.flipCard(container);\n", - " }\n", - " }\n", - " event.preventDefault();\n", - "}\n", - "\n", - "\n", - "function reenableNext(ths, next) {\n", - " next.style.pointerEvents='auto';\n", - " /* ths.tabIndex= 0;*/\n", - " /* ths.focus(); */\n", - "}\n", - "\n", - "\n", - "\n", - "function slide2(containerId) {\n", - " var container = document.getElementById(containerId);\n", - " var next=document.getElementById(containerId+'-next');\n", - " var frontcard = container.children[0];\n", - " var backcard = container.children[1];\n", - " container.style.pointerEvents='none';\n", - " /* container.removeAttribute(\"tabindex\");*/\n", - " /* container.blur(); */\n", - " //backcard.style.pointerEvents='none';\n", - " next.style.pointerEvents='none';\n", - " next.classList.remove('flipped');\n", - " next.classList.add('hide');\n", - "\n", - " //container.classList.add(\"prepare\");\n", - " \n", - " container.className=\"flip-container slide\";\n", - " backcard.parentElement.removeChild(frontcard);\n", - " backcard.parentElement.appendChild(frontcard);\n", - " setTimeout(slideback, 600, container, frontcard, backcard, next);\n", - " \n", - "}\n", - "\n", - "\n", - "window.checkFlip = function checkFlip(containerId) {\n", - " var container = document.getElementById(containerId);\n", - "\n", - "\n", - " if (container.classList.contains('flip')) {\n", - " container.classList.remove('flip');\n", - " setTimeout(slide2, 600, containerId);\n", - " } \n", - " else {\n", - " slide2(containerId);\n", - " }\n", - "}\n", - "\n", - "\n", - "function slideback(container, frontcard, backcard, next) {\n", - " container.className=\"flip-container slideback\";\n", - " setTimeout(cleanup, 550, container, frontcard, backcard, next);\n", - "}\n", - "\n", - "function cleanup(container, frontcard, backcard, next) {\n", - " container.removeChild(frontcard);\n", - " backcard.className=\"flipper frontcard\";\n", - " container.className=\"flip-container\";\n", - "\n", - " var cardnum=parseInt(container.dataset.cardnum);\n", - " var cards=eval('cards'+container.id);\n", - " var flipper=createOneCard(container, false, cards, cardnum);\n", - " container.append(flipper);\n", - " cardnum= (cardnum+1) % parseInt(container.dataset.numCards);\n", - " container.dataset.cardnum=cardnum;\n", - " if (cardnum != 1){\n", - " next.innerHTML=\"Next >\";\n", - " } else {\n", - " //next.innerHTML=\"Reload \\\\(\\\\circlearrowleft\\\\) \";\n", - " next.innerHTML='Reload '\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([next]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " }\n", - "\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset();\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " next.style.pointerEvents='auto';\n", - " container.style.pointerEvents='auto';\n", - " /* container.tabIndex= 0; */\n", - " /* container.focus(); */\n", - " next.classList.remove('hide');\n", - " container.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(container.id);\n", - " }, {once: true });\n", - "\n", - "\n", - "}\n", - "\n", - "\n", - "function createOneCard (mydiv, frontCard, cards, cardnum) {\n", - " var colors=[\n", - " '--asparagus',\n", - " '--terra-cotta',\n", - " '--cyan-process'\n", - " ]\n", - "\n", - " var flipper = document.createElement('div');\n", - " if (frontCard){\n", - " flipper.className=\"flipper frontcard\"; \n", - " }\n", - " else {\n", - " flipper.className=\"flipper backcard\"; \n", - " }\n", - "\n", - " var front = document.createElement('div');\n", - " front.className='front flashcard';\n", - "\n", - " var frontSpan= document.createElement('span');\n", - " frontSpan.className='flashcardtext';\n", - " frontSpan.innerHTML=jaxify(cards[cardnum]['front']);\n", - " //frontSpan.textContent=jaxify(cards[cardnum]['front']);\n", - " front.style.background='var(' + colors[cardnum % colors.length] + ')';\n", - "\n", - "\n", - " front.append(frontSpan);\n", - " flipper.append(front);\n", - "\n", - " var back = document.createElement('div');\n", - " back.className='back flashcard';\n", - "\n", - " var backSpan= document.createElement('span');\n", - " backSpan.className='flashcardtext';\n", - " backSpan.innerHTML=jaxify(cards[cardnum]['back']);\n", - " back.append(backSpan);\n", - "\n", - " flipper.append(back);\n", - "\n", - " return flipper;\n", - "\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "function createCards(id, keyControl) {\n", - " console.log(id);\n", - " \n", - " var mydiv=document.getElementById(id);\n", - " /*mydiv.onclick = window.flipCard(mydiv);*/\n", - " /*\n", - " mydiv.addEventListener('click', function(){window.flipCard(mydiv);}, false);\n", - " mydiv.addEventListener('keydown', function(event){window.checkKey(mydiv,event);}, true);\n", - " */\n", - " mydiv.onclick = function(){window.flipCard(mydiv);};\n", - " console.log(keyControl);\n", - " if (keyControl == \"True\"){\n", - " mydiv.onkeydown = function(event){window.checkKey(mydiv,event);};\n", - " }\n", - " /* mydiv.addEventListener('keydown', function(event){event.stopPropagation(); console.log(event); event.preventDefault();}, true); */\n", - " /*mydiv.onkeypress = function(event){console.log(event); event.preventDefault();};*/\n", - "\n", - " console.log(mydiv);\n", - " \n", - " var cards=eval('cards'+id);\n", - " mydiv.dataset.cardnum=0;\n", - " mydiv.dataset.numCards=cards.length;\n", - " mydiv.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(id);\n", - " }, {once: true});\n", - "\n", - " var cardnum=0;\n", - " \n", - " for (var i=0; i<2; i++) {\n", - " \n", - " var flipper;\n", - " if (i==0){\n", - " flipper=createOneCard(mydiv, true, cards, cardnum);\n", - " }\n", - " else {\n", - " flipper=createOneCard(mydiv, false, cards, cardnum);\n", - " }\n", - "\n", - " mydiv.append(flipper);\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " if (typeof version == 'undefined') {\n", - " setTimeout(function(){\n", - " var version = MathJax.version;\n", - " console.log('After sleep, MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }, 500);\n", - " } else{\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " cardnum = (cardnum + 1) % mydiv.dataset.numCards;\n", - " }\n", - " mydiv.dataset.cardnum = cardnum;\n", - "\n", - " var next=document.getElementById(id+'-next');\n", - " if (cards.length==1) {\n", - " // Don't show next if no other cards!\n", - " next.style.pointerEvents='none';\n", - " next.classList.add('hide');\n", - " } else {\n", - " next.innerHTML=\"Next >\";\n", - " }\n", - "\n", - " mydiv.focus();\n", - "\n", - " return flipper;\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "var cardsziCoVVJXaXfq=[\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \"The second grep command in the pipe is looking for a lowercase n rather than an uppercase N.\"\n", - " }\n", - "];\n", - " \n", - " createCards(\"ziCoVVJXaXfq\", \"True\");\n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from jupytercards import display_flashcards\n", "cards='/home/jupyter/flashcards/'\n", @@ -659,31 +13,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "tf2-gpu.2-8.m102", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/tf2-gpu.2-8:m102" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/AWS/quiz_files/quiz7-2.ipynb b/AWS/quiz_files/quiz7-2.ipynb index 678e2c5..1ed6384 100644 --- a/AWS/quiz_files/quiz7-2.ipynb +++ b/AWS/quiz_files/quiz7-2.ipynb @@ -2,656 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "113fb089-7d61-481e-9473-f72bf2ed5371", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "/*!\n", - " * swiped-events.js - v1.1.4\n", - " * Pure JavaScript swipe events\n", - " * https://github.com/john-doherty/swiped-events\n", - " * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element\n", - " * @author John Doherty \n", - " * @license MIT\n", - " */\n", - "!function(t,e){\"use strict\";\"function\"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=e.createEvent(\"CustomEvent\");return a.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),a},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener(\"touchstart\",function(t){if(\"true\"===t.target.getAttribute(\"data-swipe-ignore\"))return;s=t.target,r=Date.now(),n=t.touches[0].clientX,a=t.touches[0].clientY,u=0,i=0},!1),e.addEventListener(\"touchmove\",function(t){if(!n||!a)return;var e=t.touches[0].clientX,r=t.touches[0].clientY;u=n-e,i=a-r},!1),e.addEventListener(\"touchend\",function(t){if(s!==t.target)return;var e=parseInt(l(s,\"data-swipe-threshold\",\"20\"),10),o=parseInt(l(s,\"data-swipe-timeout\",\"500\"),10),c=Date.now()-r,d=\"\",p=t.changedTouches||t.touches||[];Math.abs(u)>Math.abs(i)?Math.abs(u)>e&&c0?\"swiped-left\":\"swiped-right\"):Math.abs(i)>e&&c0?\"swiped-up\":\"swiped-down\");if(\"\"!==d){var b={dir:d.replace(/swiped-/,\"\"),xStart:parseInt(n,10),xEnd:parseInt((p[0]||{}).clientX||-1,10),yStart:parseInt(a,10),yEnd:parseInt((p[0]||{}).clientY||-1,10)};s.dispatchEvent(new CustomEvent(\"swiped\",{bubbles:!0,cancelable:!0,detail:b})),s.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:b}))}n=null,a=null,r=null},!1);var n=null,a=null,u=null,i=null,r=null,s=null;function l(t,n,a){for(;t&&t!==e.documentElement;){var u=t.getAttribute(n);if(u)return u;t=t.parentNode}return a}}(window,document);\n", - "\n", - "function jaxify(string) {\n", - " var mystring = string;\n", - " console.log(mystring);\n", - "\n", - " var count = 0;\n", - " var loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - "\n", - " var count2 = 0;\n", - " var loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - "\n", - " //console.log(loc);\n", - "\n", - " while ((loc >= 0) || (loc2 >= 0)) {\n", - "\n", - " /* Have to replace all the double $$ first with current implementation */\n", - " if (loc2 >= 0) {\n", - " if (count2 % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\[\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\]\");\n", - " }\n", - " count2++;\n", - " } else {\n", - " if (count % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\(\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\)\");\n", - " }\n", - " count++;\n", - " }\n", - " loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - " loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - " //console.log(mystring,\", loc:\",loc,\", loc2:\",loc2);\n", - " }\n", - "\n", - " //console.log(mystring);\n", - " return mystring;\n", - "}\n", - "\n", - "window.flipCard = function flipCard(ths) {\n", - " console.log(ths);\n", - " console.log(ths.id);\n", - " ths.classList.toggle(\"flip\"); \n", - " var next=document.getElementById(ths.id+'-next');\n", - " next.style.pointerEvents='none';\n", - " /* ths.blur(); */\n", - " next.classList.add('flipped');\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([ths]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " setTimeout(reenableNext, 600, ths, next);\n", - "}\n", - "\n", - "window.checkKey = function checkKey(container, event) {\n", - " event.stopPropagation();\n", - " /*\n", - " console.log(container);\n", - " console.log(event.key);\n", - " console.log(event.code);\n", - " */\n", - " /* JMS: Working here*/\n", - " var next=document.getElementById(container.id+'-next');\n", - " /* Only react if not already sliding */\n", - " if (! next.classList.contains(\"hide\")) {\n", - " if ((event.key == \"j\") || (event.key == \"Enter\") || (event.key == \"ArrowRight\")) {\n", - " window.checkFlip(container.id);\n", - " }\n", - " if (event.key == \" \") {\n", - " window.flipCard(container);\n", - " }\n", - " }\n", - " event.preventDefault();\n", - "}\n", - "\n", - "\n", - "function reenableNext(ths, next) {\n", - " next.style.pointerEvents='auto';\n", - " /* ths.tabIndex= 0;*/\n", - " /* ths.focus(); */\n", - "}\n", - "\n", - "\n", - "\n", - "function slide2(containerId) {\n", - " var container = document.getElementById(containerId);\n", - " var next=document.getElementById(containerId+'-next');\n", - " var frontcard = container.children[0];\n", - " var backcard = container.children[1];\n", - " container.style.pointerEvents='none';\n", - " /* container.removeAttribute(\"tabindex\");*/\n", - " /* container.blur(); */\n", - " //backcard.style.pointerEvents='none';\n", - " next.style.pointerEvents='none';\n", - " next.classList.remove('flipped');\n", - " next.classList.add('hide');\n", - "\n", - " //container.classList.add(\"prepare\");\n", - " \n", - " container.className=\"flip-container slide\";\n", - " backcard.parentElement.removeChild(frontcard);\n", - " backcard.parentElement.appendChild(frontcard);\n", - " setTimeout(slideback, 600, container, frontcard, backcard, next);\n", - " \n", - "}\n", - "\n", - "\n", - "window.checkFlip = function checkFlip(containerId) {\n", - " var container = document.getElementById(containerId);\n", - "\n", - "\n", - " if (container.classList.contains('flip')) {\n", - " container.classList.remove('flip');\n", - " setTimeout(slide2, 600, containerId);\n", - " } \n", - " else {\n", - " slide2(containerId);\n", - " }\n", - "}\n", - "\n", - "\n", - "function slideback(container, frontcard, backcard, next) {\n", - " container.className=\"flip-container slideback\";\n", - " setTimeout(cleanup, 550, container, frontcard, backcard, next);\n", - "}\n", - "\n", - "function cleanup(container, frontcard, backcard, next) {\n", - " container.removeChild(frontcard);\n", - " backcard.className=\"flipper frontcard\";\n", - " container.className=\"flip-container\";\n", - "\n", - " var cardnum=parseInt(container.dataset.cardnum);\n", - " var cards=eval('cards'+container.id);\n", - " var flipper=createOneCard(container, false, cards, cardnum);\n", - " container.append(flipper);\n", - " cardnum= (cardnum+1) % parseInt(container.dataset.numCards);\n", - " container.dataset.cardnum=cardnum;\n", - " if (cardnum != 1){\n", - " next.innerHTML=\"Next >\";\n", - " } else {\n", - " //next.innerHTML=\"Reload \\\\(\\\\circlearrowleft\\\\) \";\n", - " next.innerHTML='Reload '\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([next]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " }\n", - "\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset();\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " next.style.pointerEvents='auto';\n", - " container.style.pointerEvents='auto';\n", - " /* container.tabIndex= 0; */\n", - " /* container.focus(); */\n", - " next.classList.remove('hide');\n", - " container.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(container.id);\n", - " }, {once: true });\n", - "\n", - "\n", - "}\n", - "\n", - "\n", - "function createOneCard (mydiv, frontCard, cards, cardnum) {\n", - " var colors=[\n", - " '--asparagus',\n", - " '--terra-cotta',\n", - " '--cyan-process'\n", - " ]\n", - "\n", - " var flipper = document.createElement('div');\n", - " if (frontCard){\n", - " flipper.className=\"flipper frontcard\"; \n", - " }\n", - " else {\n", - " flipper.className=\"flipper backcard\"; \n", - " }\n", - "\n", - " var front = document.createElement('div');\n", - " front.className='front flashcard';\n", - "\n", - " var frontSpan= document.createElement('span');\n", - " frontSpan.className='flashcardtext';\n", - " frontSpan.innerHTML=jaxify(cards[cardnum]['front']);\n", - " //frontSpan.textContent=jaxify(cards[cardnum]['front']);\n", - " front.style.background='var(' + colors[cardnum % colors.length] + ')';\n", - "\n", - "\n", - " front.append(frontSpan);\n", - " flipper.append(front);\n", - "\n", - " var back = document.createElement('div');\n", - " back.className='back flashcard';\n", - "\n", - " var backSpan= document.createElement('span');\n", - " backSpan.className='flashcardtext';\n", - " backSpan.innerHTML=jaxify(cards[cardnum]['back']);\n", - " back.append(backSpan);\n", - "\n", - " flipper.append(back);\n", - "\n", - " return flipper;\n", - "\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "function createCards(id, keyControl) {\n", - " console.log(id);\n", - " \n", - " var mydiv=document.getElementById(id);\n", - " /*mydiv.onclick = window.flipCard(mydiv);*/\n", - " /*\n", - " mydiv.addEventListener('click', function(){window.flipCard(mydiv);}, false);\n", - " mydiv.addEventListener('keydown', function(event){window.checkKey(mydiv,event);}, true);\n", - " */\n", - " mydiv.onclick = function(){window.flipCard(mydiv);};\n", - " console.log(keyControl);\n", - " if (keyControl == \"True\"){\n", - " mydiv.onkeydown = function(event){window.checkKey(mydiv,event);};\n", - " }\n", - " /* mydiv.addEventListener('keydown', function(event){event.stopPropagation(); console.log(event); event.preventDefault();}, true); */\n", - " /*mydiv.onkeypress = function(event){console.log(event); event.preventDefault();};*/\n", - "\n", - " console.log(mydiv);\n", - " \n", - " var cards=eval('cards'+id);\n", - " mydiv.dataset.cardnum=0;\n", - " mydiv.dataset.numCards=cards.length;\n", - " mydiv.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(id);\n", - " }, {once: true});\n", - "\n", - " var cardnum=0;\n", - " \n", - " for (var i=0; i<2; i++) {\n", - " \n", - " var flipper;\n", - " if (i==0){\n", - " flipper=createOneCard(mydiv, true, cards, cardnum);\n", - " }\n", - " else {\n", - " flipper=createOneCard(mydiv, false, cards, cardnum);\n", - " }\n", - "\n", - " mydiv.append(flipper);\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " if (typeof version == 'undefined') {\n", - " setTimeout(function(){\n", - " var version = MathJax.version;\n", - " console.log('After sleep, MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }, 500);\n", - " } else{\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " cardnum = (cardnum + 1) % mydiv.dataset.numCards;\n", - " }\n", - " mydiv.dataset.cardnum = cardnum;\n", - "\n", - " var next=document.getElementById(id+'-next');\n", - " if (cards.length==1) {\n", - " // Don't show next if no other cards!\n", - " next.style.pointerEvents='none';\n", - " next.classList.add('hide');\n", - " } else {\n", - " next.innerHTML=\"Next >\";\n", - " }\n", - "\n", - " mydiv.focus();\n", - "\n", - " return flipper;\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "var cardswrmiNMQoBInQ=[\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \"The variable in the loop set up is i but the variable in the body of the loop is x. If you change these variables so they match the loop will run.\"\n", - " }\n", - "];\n", - " \n", - " createCards(\"wrmiNMQoBInQ\", \"True\");\n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from jupytercards import display_flashcards\n", "cards='/home/jupyter/flashcards/'\n", @@ -659,31 +13,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "tf2-gpu.2-8.m102", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/tf2-gpu.2-8:m102" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/AWS/submodule01_Intro_to_terminal.ipynb b/AWS/submodule01_Intro_to_terminal.ipynb index 8158f0d..2561d2f 100644 --- a/AWS/submodule01_Intro_to_terminal.ipynb +++ b/AWS/submodule01_Intro_to_terminal.ipynb @@ -29,9 +29,7 @@ { "cell_type": "markdown", "id": "bf672094-38a4-4e24-87de-598a0befd5d1", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "\n", "## Jupyter Notebook Basics\n", @@ -57,9 +55,7 @@ "cell_type": "code", "execution_count": null, "id": "37a3c9e6-9725-41eb-a284-774efe841bcf", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -71,9 +67,7 @@ { "cell_type": "markdown", "id": "54959383-4605-42ad-bd55-fe2c09d4d498", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "
\n", " \n", @@ -88,9 +82,7 @@ "cell_type": "code", "execution_count": null, "id": "b94461dd-996b-4419-9822-127a46967918", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -106,33 +98,10 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "dd071114-5301-4650-8f0a-15b99e65b230", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "execution_count": 2, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "# FLASHCARDS\n", "\n", @@ -143,10 +112,7 @@ { "cell_type": "markdown", "id": "a26ac6a7-05e0-4c99-ad3a-32f2829d2b14", - "metadata": { - "jp-MarkdownHeadingCollapsed": true, - "tags": [] - }, + "metadata": {}, "source": [ "\n", "You may notice that each cell has a vertical line to the left of it when the cell has been selected, you can click on the vertical line and collapse the cell. The same is true for the output of the code cell. Collapsing cells comes in pretty handy when the results of the code cell are long! Another way to manage commands with lengthy results is by enabling scrolling. To do this right click anywhere within the notebook and select the option for `Enable Scrolling for Outputs`.\n", @@ -207,9 +173,7 @@ { "cell_type": "markdown", "id": "ffdf8adf-ce9e-462d-94d4-3d44b850c0ee", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "\n", "### Getting Started in the Terminal Environment\n", @@ -241,9 +205,7 @@ "cell_type": "code", "execution_count": null, "id": "054614c2-3eb0-46bc-91a1-2578593f3687", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -255,9 +217,7 @@ { "cell_type": "markdown", "id": "7353d25e-9eed-4ff7-9176-502a0b3b9773", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "Notice that in the terminal window to exit out of the manual we had to use the `q` to get the prompt to return. Another way of looking at a summary of the information in the manual page is with the `--help` flag. Try typing `mkdir --help` in the terminal window. The information in the manual pages tends to be more clearly laid out and better organized, but the `--help` flag is a quick and easy way to remind yourself of the flags available.\n", "\n", @@ -339,9 +299,7 @@ "cell_type": "code", "execution_count": null, "id": "f49506c2-6c72-449e-9197-542f50d14678", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -359,9 +317,7 @@ { "cell_type": "markdown", "id": "2cda9c8c-d2d0-4380-b332-4ff1a644ea51", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "## Paths, Where Is Your Data Stored?\n", "-------------------\n", @@ -383,9 +339,7 @@ "cell_type": "code", "execution_count": null, "id": "f4dc07da-3f1f-4c3e-bc97-b61c25451c72", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -410,9 +364,7 @@ { "cell_type": "markdown", "id": "e71c89cd-0c6a-4da2-915c-46ec1f975ae6", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "You can see that we are in the `jupyter` directory and this directory is inside a directory called `home`. \n", "\n", @@ -423,9 +375,7 @@ "cell_type": "code", "execution_count": null, "id": "e520676d-3e75-4d54-b488-2944e5478b1f", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -548,33 +498,10 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "bfccc937-62e7-48c8-9745-1e03236f3e2c", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "# FLASHCARD\n", "from IPython.display import IFrame\n", @@ -584,9 +511,7 @@ { "cell_type": "markdown", "id": "3ae4b9a0-4eff-427e-bc7e-a292dc42f76d", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "## File Naming Considerations\n", "---------\n", @@ -665,31 +590,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "common-cpu.m104", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/base-cpu:m104" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.12.4" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/AWS/submodule02_Intro_to_cloud_computing.ipynb b/AWS/submodule02_Intro_to_cloud_computing.ipynb index 920aed8..02b365a 100644 --- a/AWS/submodule02_Intro_to_cloud_computing.ipynb +++ b/AWS/submodule02_Intro_to_cloud_computing.ipynb @@ -3,13 +3,7 @@ { "cell_type": "markdown", "id": "40ee29a5-94d5-4a06-9e45-40f95df8a650", - "metadata": { - "editable": true, - "slideshow": { - "slide_type": "" - }, - "tags": [] - }, + "metadata": {}, "source": [ "# Cloud computing\n", "\n", @@ -113,9 +107,7 @@ { "cell_type": "markdown", "id": "415ae2bc-59f1-4a01-afc1-cc4b1c9f3f4c", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "## Amazon S3 Buckets, One Option for Long Term Data Storage\n", "--------\n", @@ -152,9 +144,7 @@ "cell_type": "code", "execution_count": null, "id": "ffcb317d-d2b7-4d11-b08c-da6840ef24f0", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -165,31 +155,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "common-cpu.m104", - "type": "aws", - "uri": "amazonaws.com" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.12.4" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/AWS/submodule03_genomics_file_format.ipynb b/AWS/submodule03_genomics_file_format.ipynb index 9ab9270..284fdc7 100644 --- a/AWS/submodule03_genomics_file_format.ipynb +++ b/AWS/submodule03_genomics_file_format.ipynb @@ -23,9 +23,7 @@ { "cell_type": "markdown", "id": "1cbeaea5-8155-4ed4-b951-e641f533be7b", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "## Genomic Annotation Data, GFF/GTF file Format\n", "------\n", @@ -322,9 +320,7 @@ "cell_type": "code", "execution_count": null, "id": "9fc00331-2d69-49ba-8e49-047cb81566d2", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -341,9 +337,7 @@ { "cell_type": "markdown", "id": "ed33c67a-1ef0-4491-b59d-776dfff623a6", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "## Genomic Sequence Data, Fasta Files\n", "----------------\n", @@ -396,9 +390,7 @@ "cell_type": "code", "execution_count": null, "id": "a5754551-bf07-4025-8d8e-ac5cbbfd95a9", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -452,9 +444,7 @@ "cell_type": "code", "execution_count": null, "id": "0991d53a-cefb-40b9-8807-f819434d7afd", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -507,9 +497,7 @@ "cell_type": "code", "execution_count": null, "id": "fbde4a80-e24b-46e0-ae0e-e003315d1256", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -536,9 +524,7 @@ { "cell_type": "markdown", "id": "55c6610f-52db-4d00-a354-81c2fddada07", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "The sequence alphabet of this file indicates that these are protein sequences and you'll notice that each sequences is about the same length. There isn't a lot of information in the headers, but we can see that each sequence comes from a different species and we know that there are the same number of headers and sequence lines. Together this information indicates that these sequences are from a protein alignment. To be sure we can use NCBI's [BLAST tool](https://blast.ncbi.nlm.nih.gov/Blast.cgi?PROGRAM=blastp&PAGE_TYPE=BlastSearch&LINK_LOC=blasthome) to check the identity of some of these sequences. \n", "\n", @@ -659,9 +645,7 @@ { "cell_type": "markdown", "id": "49b4c02a-b675-4f96-85c8-fc54c3329480", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "## Raw Sequencing Data, FASTQ Files\n", "------------------------------\n", @@ -900,31 +884,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "common-cpu.m104", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/base-cpu:m104" - }, - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/AWS/submodule04_beyond_basic_bash.ipynb b/AWS/submodule04_beyond_basic_bash.ipynb index adabfe6..a169bdc 100644 --- a/AWS/submodule04_beyond_basic_bash.ipynb +++ b/AWS/submodule04_beyond_basic_bash.ipynb @@ -3,9 +3,7 @@ { "cell_type": "markdown", "id": "6963dbcc-0794-4f51-b589-5c3bf1ff4103", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "# Beyond Basic BASH Coding\n", "------\n", @@ -104,9 +102,7 @@ { "cell_type": "markdown", "id": "f1c37b72-36be-4141-a692-caa954d9e8ad", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "## For & While Loops\n", "-------\n", @@ -128,9 +124,7 @@ "cell_type": "code", "execution_count": null, "id": "cbcae554-f686-4114-b129-b1f636988495", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -184,9 +178,7 @@ { "cell_type": "markdown", "id": "32debf32-ce7c-4b4b-88e8-0d55fb7d5810", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "### For Loop\n", "\n", @@ -197,9 +189,7 @@ "cell_type": "code", "execution_count": null, "id": "a9046c97-b8dc-4b55-af3b-e875fade21b2", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -238,9 +228,7 @@ "cell_type": "code", "execution_count": null, "id": "474b7da7-b213-4874-ab65-3b06ea3562ad", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -256,9 +244,7 @@ { "cell_type": "markdown", "id": "e58ab4a4-c787-4939-adb3-146b95585eb8", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "Now let's use variations on some of the complex code we wrote in the earlier lesson **Genomic File Formats** to write a loop to check how many reads contain the start codon `ATG`. We can do this by searching for matches with `grep` and counting how many times it was found with `wc -l` (literally how many lines are returned), and repeating this process for each sample using a while loop.\n" ] @@ -267,9 +253,7 @@ "cell_type": "code", "execution_count": null, "id": "6705dc4f-a7d3-4fb4-9189-bc4af0e78891", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -352,9 +336,7 @@ "cell_type": "code", "execution_count": null, "id": "100a2f16-c778-4b08-a6b7-c2460b4ab219", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -375,9 +357,7 @@ "cell_type": "code", "execution_count": null, "id": "65fa9ddd-5c35-4c9f-8728-e19b7ad4b41e", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -400,9 +380,7 @@ "cell_type": "code", "execution_count": null, "id": "2f8185c6-b059-4023-b654-182199dc625f", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -487,9 +465,7 @@ "cell_type": "code", "execution_count": null, "id": "729b493c-8971-4d2c-a74e-4ffd930506cb", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -499,31 +475,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "common-cpu.m104", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/base-cpu:m104" - }, - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/AWS/submodule05_software_management.ipynb b/AWS/submodule05_software_management.ipynb index 85c4793..c065a2a 100644 --- a/AWS/submodule05_software_management.ipynb +++ b/AWS/submodule05_software_management.ipynb @@ -3,9 +3,7 @@ { "cell_type": "markdown", "id": "1553273d-c130-4398-8256-2d3d7b2aa66a", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "# Installing and Managing Bioinformatic Software\n", "\n", @@ -200,9 +198,7 @@ { "cell_type": "markdown", "id": "21e21a1b-c662-4d9c-856b-a800bbf1f853", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "## Creating a Conda Environment\n", "--------\n", @@ -300,9 +296,7 @@ "cell_type": "code", "execution_count": null, "id": "b9642a1e-5154-44b9-990f-5dc5209ae0f3", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -325,9 +319,7 @@ "cell_type": "code", "execution_count": null, "id": "61c54ef1-6cf6-4d53-af7d-8d37cbe1bd20", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -395,9 +387,7 @@ "cell_type": "code", "execution_count": null, "id": "c149e564-2bfc-4b2e-99f9-ac3f2b6a499c", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -497,9 +487,7 @@ "cell_type": "code", "execution_count": null, "id": "39a3979a-2147-4237-973b-7ddfd40e7585", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -524,9 +512,7 @@ "cell_type": "code", "execution_count": null, "id": "8f1b018a-9538-4cce-885f-aeaf4add3a2a", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -559,9 +545,7 @@ "cell_type": "code", "execution_count": null, "id": "195d98c4-5cf0-4c78-8f78-443dd4524e43", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -573,9 +557,7 @@ { "cell_type": "markdown", "id": "9e0a5c00-f5fe-49cf-8331-931d469685af", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "You will notice that in the first run where we only used one thread the output indicated that the analysis analyzed each file sequentially, whereas when we used two threads the files were analyzed in parallel and finished at almost the same time. The parellelization in this case uses one thread per file so using more than two threads would not have sped up the analysis time.\n", "\n", @@ -600,9 +582,7 @@ "cell_type": "code", "execution_count": null, "id": "86432f8c-0cb7-4807-ae09-a69d4c6293f2", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -642,9 +622,7 @@ "cell_type": "code", "execution_count": null, "id": "0d1e9ef6-f108-486b-9dab-926a6f5be466", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -670,9 +648,7 @@ "cell_type": "code", "execution_count": null, "id": "48625ab6-243c-4491-ba5d-66d258a86bcd", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -712,31 +688,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "common-cpu.m104", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/base-cpu:m104" - }, - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.12.4" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/AWS/submodule06_putting_it_all_together.ipynb b/AWS/submodule06_putting_it_all_together.ipynb index 0d82b3b..14c4ce3 100644 --- a/AWS/submodule06_putting_it_all_together.ipynb +++ b/AWS/submodule06_putting_it_all_together.ipynb @@ -23,9 +23,7 @@ "cell_type": "code", "execution_count": null, "id": "ac12ca19-ef6a-4554-92b2-9b4489a4b107", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -156,9 +154,7 @@ "cell_type": "code", "execution_count": null, "id": "9199a45e-5711-464f-8ff5-0dc9708c1f3b", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -225,9 +221,7 @@ { "cell_type": "markdown", "id": "dd70fe01-c2a7-4978-a655-8b94c41c76a3", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "## Assembling the Genome (Spades)\n", "----------\n", @@ -259,10 +253,7 @@ "cell_type": "code", "execution_count": null, "id": "fcf66e46-7861-43d5-b2d5-3105229c7dd3", - "metadata": { - "scrolled": true, - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -502,31 +493,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "conda-env-annotation-py", - "name": "common-cpu.m104", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/base-cpu:m104" - }, - "kernelspec": { - "display_name": "Python [conda env:annotation]", - "language": "python", - "name": "conda-env-annotation-py" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.9.16" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/AWS/submodule07_error_mitigation.ipynb b/AWS/submodule07_error_mitigation.ipynb index 703c78f..53a33bc 100644 --- a/AWS/submodule07_error_mitigation.ipynb +++ b/AWS/submodule07_error_mitigation.ipynb @@ -34,9 +34,7 @@ "cell_type": "code", "execution_count": null, "id": "0fdcc3f2-47f0-48f1-91c4-7a04992e96fc", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -62,9 +60,7 @@ "cell_type": "code", "execution_count": null, "id": "fc6dfb9c-9426-4c93-954f-06fdb3a85c37", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -77,9 +73,7 @@ "cell_type": "code", "execution_count": null, "id": "548c4ed9-8c75-4020-a69a-d376a42f6ec0", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -93,9 +87,7 @@ "cell_type": "code", "execution_count": null, "id": "aa1eb263-207e-4645-8c5c-f0138ba9c5da", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -109,9 +101,7 @@ "cell_type": "code", "execution_count": null, "id": "61e2398c-17b7-4211-9c82-588f745b94e4", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -147,9 +137,7 @@ "cell_type": "code", "execution_count": null, "id": "9e42dd93-8400-46bf-bca0-6a9ee18136d0", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -175,9 +163,7 @@ "cell_type": "code", "execution_count": null, "id": "58f4370f-27c5-4dc9-b17b-26528029e35f", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -223,9 +209,7 @@ { "cell_type": "markdown", "id": "f925eb00-3958-40d4-9ef6-0bd704b8347e", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "We started with typos because these are the most common mistakes we diagnose in our workshops, especially with regard to case. \n", "\n", @@ -244,9 +228,7 @@ "cell_type": "code", "execution_count": null, "id": "455892b0-5d8c-4b62-ae95-231fff74909d", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -338,31 +320,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "conda-env-annotation-py", - "name": "common-cpu.m104", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/base-cpu:m104" - }, - "kernelspec": { - "display_name": "Python [conda env:annotation]", - "language": "python", - "name": "conda-env-annotation-py" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.9.16" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/GoogleCloud/quiz_files/quiz1-1.ipynb b/GoogleCloud/quiz_files/quiz1-1.ipynb index 14d8d2a..6187480 100644 --- a/GoogleCloud/quiz_files/quiz1-1.ipynb +++ b/GoogleCloud/quiz_files/quiz1-1.ipynb @@ -2,656 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "56f9232e-9d74-495f-87d8-20a2498d2f86", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "/*!\n", - " * swiped-events.js - v1.1.4\n", - " * Pure JavaScript swipe events\n", - " * https://github.com/john-doherty/swiped-events\n", - " * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element\n", - " * @author John Doherty \n", - " * @license MIT\n", - " */\n", - "!function(t,e){\"use strict\";\"function\"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=e.createEvent(\"CustomEvent\");return a.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),a},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener(\"touchstart\",function(t){if(\"true\"===t.target.getAttribute(\"data-swipe-ignore\"))return;s=t.target,r=Date.now(),n=t.touches[0].clientX,a=t.touches[0].clientY,u=0,i=0},!1),e.addEventListener(\"touchmove\",function(t){if(!n||!a)return;var e=t.touches[0].clientX,r=t.touches[0].clientY;u=n-e,i=a-r},!1),e.addEventListener(\"touchend\",function(t){if(s!==t.target)return;var e=parseInt(l(s,\"data-swipe-threshold\",\"20\"),10),o=parseInt(l(s,\"data-swipe-timeout\",\"500\"),10),c=Date.now()-r,d=\"\",p=t.changedTouches||t.touches||[];Math.abs(u)>Math.abs(i)?Math.abs(u)>e&&c0?\"swiped-left\":\"swiped-right\"):Math.abs(i)>e&&c0?\"swiped-up\":\"swiped-down\");if(\"\"!==d){var b={dir:d.replace(/swiped-/,\"\"),xStart:parseInt(n,10),xEnd:parseInt((p[0]||{}).clientX||-1,10),yStart:parseInt(a,10),yEnd:parseInt((p[0]||{}).clientY||-1,10)};s.dispatchEvent(new CustomEvent(\"swiped\",{bubbles:!0,cancelable:!0,detail:b})),s.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:b}))}n=null,a=null,r=null},!1);var n=null,a=null,u=null,i=null,r=null,s=null;function l(t,n,a){for(;t&&t!==e.documentElement;){var u=t.getAttribute(n);if(u)return u;t=t.parentNode}return a}}(window,document);\n", - "\n", - "function jaxify(string) {\n", - " var mystring = string;\n", - " console.log(mystring);\n", - "\n", - " var count = 0;\n", - " var loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - "\n", - " var count2 = 0;\n", - " var loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - "\n", - " //console.log(loc);\n", - "\n", - " while ((loc >= 0) || (loc2 >= 0)) {\n", - "\n", - " /* Have to replace all the double $$ first with current implementation */\n", - " if (loc2 >= 0) {\n", - " if (count2 % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\[\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\]\");\n", - " }\n", - " count2++;\n", - " } else {\n", - " if (count % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\(\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\)\");\n", - " }\n", - " count++;\n", - " }\n", - " loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - " loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - " //console.log(mystring,\", loc:\",loc,\", loc2:\",loc2);\n", - " }\n", - "\n", - " //console.log(mystring);\n", - " return mystring;\n", - "}\n", - "\n", - "window.flipCard = function flipCard(ths) {\n", - " console.log(ths);\n", - " console.log(ths.id);\n", - " ths.classList.toggle(\"flip\"); \n", - " var next=document.getElementById(ths.id+'-next');\n", - " next.style.pointerEvents='none';\n", - " /* ths.blur(); */\n", - " next.classList.add('flipped');\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([ths]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " setTimeout(reenableNext, 600, ths, next);\n", - "}\n", - "\n", - "window.checkKey = function checkKey(container, event) {\n", - " event.stopPropagation();\n", - " /*\n", - " console.log(container);\n", - " console.log(event.key);\n", - " console.log(event.code);\n", - " */\n", - " /* JMS: Working here*/\n", - " var next=document.getElementById(container.id+'-next');\n", - " /* Only react if not already sliding */\n", - " if (! next.classList.contains(\"hide\")) {\n", - " if ((event.key == \"j\") || (event.key == \"Enter\") || (event.key == \"ArrowRight\")) {\n", - " window.checkFlip(container.id);\n", - " }\n", - " if (event.key == \" \") {\n", - " window.flipCard(container);\n", - " }\n", - " }\n", - " event.preventDefault();\n", - "}\n", - "\n", - "\n", - "function reenableNext(ths, next) {\n", - " next.style.pointerEvents='auto';\n", - " /* ths.tabIndex= 0;*/\n", - " /* ths.focus(); */\n", - "}\n", - "\n", - "\n", - "\n", - "function slide2(containerId) {\n", - " var container = document.getElementById(containerId);\n", - " var next=document.getElementById(containerId+'-next');\n", - " var frontcard = container.children[0];\n", - " var backcard = container.children[1];\n", - " container.style.pointerEvents='none';\n", - " /* container.removeAttribute(\"tabindex\");*/\n", - " /* container.blur(); */\n", - " //backcard.style.pointerEvents='none';\n", - " next.style.pointerEvents='none';\n", - " next.classList.remove('flipped');\n", - " next.classList.add('hide');\n", - "\n", - " //container.classList.add(\"prepare\");\n", - " \n", - " container.className=\"flip-container slide\";\n", - " backcard.parentElement.removeChild(frontcard);\n", - " backcard.parentElement.appendChild(frontcard);\n", - " setTimeout(slideback, 600, container, frontcard, backcard, next);\n", - " \n", - "}\n", - "\n", - "\n", - "window.checkFlip = function checkFlip(containerId) {\n", - " var container = document.getElementById(containerId);\n", - "\n", - "\n", - " if (container.classList.contains('flip')) {\n", - " container.classList.remove('flip');\n", - " setTimeout(slide2, 600, containerId);\n", - " } \n", - " else {\n", - " slide2(containerId);\n", - " }\n", - "}\n", - "\n", - "\n", - "function slideback(container, frontcard, backcard, next) {\n", - " container.className=\"flip-container slideback\";\n", - " setTimeout(cleanup, 550, container, frontcard, backcard, next);\n", - "}\n", - "\n", - "function cleanup(container, frontcard, backcard, next) {\n", - " container.removeChild(frontcard);\n", - " backcard.className=\"flipper frontcard\";\n", - " container.className=\"flip-container\";\n", - "\n", - " var cardnum=parseInt(container.dataset.cardnum);\n", - " var cards=eval('cards'+container.id);\n", - " var flipper=createOneCard(container, false, cards, cardnum);\n", - " container.append(flipper);\n", - " cardnum= (cardnum+1) % parseInt(container.dataset.numCards);\n", - " container.dataset.cardnum=cardnum;\n", - " if (cardnum != 1){\n", - " next.innerHTML=\"Next >\";\n", - " } else {\n", - " //next.innerHTML=\"Reload \\\\(\\\\circlearrowleft\\\\) \";\n", - " next.innerHTML='Reload '\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([next]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " }\n", - "\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset();\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " next.style.pointerEvents='auto';\n", - " container.style.pointerEvents='auto';\n", - " /* container.tabIndex= 0; */\n", - " /* container.focus(); */\n", - " next.classList.remove('hide');\n", - " container.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(container.id);\n", - " }, {once: true });\n", - "\n", - "\n", - "}\n", - "\n", - "\n", - "function createOneCard (mydiv, frontCard, cards, cardnum) {\n", - " var colors=[\n", - " '--asparagus',\n", - " '--terra-cotta',\n", - " '--cyan-process'\n", - " ]\n", - "\n", - " var flipper = document.createElement('div');\n", - " if (frontCard){\n", - " flipper.className=\"flipper frontcard\"; \n", - " }\n", - " else {\n", - " flipper.className=\"flipper backcard\"; \n", - " }\n", - "\n", - " var front = document.createElement('div');\n", - " front.className='front flashcard';\n", - "\n", - " var frontSpan= document.createElement('span');\n", - " frontSpan.className='flashcardtext';\n", - " frontSpan.innerHTML=jaxify(cards[cardnum]['front']);\n", - " //frontSpan.textContent=jaxify(cards[cardnum]['front']);\n", - " front.style.background='var(' + colors[cardnum % colors.length] + ')';\n", - "\n", - "\n", - " front.append(frontSpan);\n", - " flipper.append(front);\n", - "\n", - " var back = document.createElement('div');\n", - " back.className='back flashcard';\n", - "\n", - " var backSpan= document.createElement('span');\n", - " backSpan.className='flashcardtext';\n", - " backSpan.innerHTML=jaxify(cards[cardnum]['back']);\n", - " back.append(backSpan);\n", - "\n", - " flipper.append(back);\n", - "\n", - " return flipper;\n", - "\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "function createCards(id, keyControl) {\n", - " console.log(id);\n", - " \n", - " var mydiv=document.getElementById(id);\n", - " /*mydiv.onclick = window.flipCard(mydiv);*/\n", - " /*\n", - " mydiv.addEventListener('click', function(){window.flipCard(mydiv);}, false);\n", - " mydiv.addEventListener('keydown', function(event){window.checkKey(mydiv,event);}, true);\n", - " */\n", - " mydiv.onclick = function(){window.flipCard(mydiv);};\n", - " console.log(keyControl);\n", - " if (keyControl == \"True\"){\n", - " mydiv.onkeydown = function(event){window.checkKey(mydiv,event);};\n", - " }\n", - " /* mydiv.addEventListener('keydown', function(event){event.stopPropagation(); console.log(event); event.preventDefault();}, true); */\n", - " /*mydiv.onkeypress = function(event){console.log(event); event.preventDefault();};*/\n", - "\n", - " console.log(mydiv);\n", - " \n", - " var cards=eval('cards'+id);\n", - " mydiv.dataset.cardnum=0;\n", - " mydiv.dataset.numCards=cards.length;\n", - " mydiv.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(id);\n", - " }, {once: true});\n", - "\n", - " var cardnum=0;\n", - " \n", - " for (var i=0; i<2; i++) {\n", - " \n", - " var flipper;\n", - " if (i==0){\n", - " flipper=createOneCard(mydiv, true, cards, cardnum);\n", - " }\n", - " else {\n", - " flipper=createOneCard(mydiv, false, cards, cardnum);\n", - " }\n", - "\n", - " mydiv.append(flipper);\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " if (typeof version == 'undefined') {\n", - " setTimeout(function(){\n", - " var version = MathJax.version;\n", - " console.log('After sleep, MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }, 500);\n", - " } else{\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " cardnum = (cardnum + 1) % mydiv.dataset.numCards;\n", - " }\n", - " mydiv.dataset.cardnum = cardnum;\n", - "\n", - " var next=document.getElementById(id+'-next');\n", - " if (cards.length==1) {\n", - " // Don't show next if no other cards!\n", - " next.style.pointerEvents='none';\n", - " next.classList.add('hide');\n", - " } else {\n", - " next.innerHTML=\"Next >\";\n", - " }\n", - "\n", - " mydiv.focus();\n", - "\n", - " return flipper;\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "var cardshRwdEmEhQweG=[\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \"The # sign comments out whatever is typed after it, this is helpful for annotating code blocks, or running only specific lines of code.\"\n", - " }\n", - "];\n", - " \n", - " createCards(\"hRwdEmEhQweG\", \"True\");\n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from jupytercards import display_flashcards\n", "#cards='/home/jupyter/flashcards/'\n", @@ -659,31 +13,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "tf2-gpu.2-8.m102", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/tf2-gpu.2-8:m102" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/GoogleCloud/quiz_files/quiz1-2.ipynb b/GoogleCloud/quiz_files/quiz1-2.ipynb index 5136248..9e2b1da 100644 --- a/GoogleCloud/quiz_files/quiz1-2.ipynb +++ b/GoogleCloud/quiz_files/quiz1-2.ipynb @@ -2,660 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "bcd03b54-2de6-45d4-a128-b76b3c4b5177", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "/*!\n", - " * swiped-events.js - v1.1.4\n", - " * Pure JavaScript swipe events\n", - " * https://github.com/john-doherty/swiped-events\n", - " * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element\n", - " * @author John Doherty \n", - " * @license MIT\n", - " */\n", - "!function(t,e){\"use strict\";\"function\"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=e.createEvent(\"CustomEvent\");return a.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),a},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener(\"touchstart\",function(t){if(\"true\"===t.target.getAttribute(\"data-swipe-ignore\"))return;s=t.target,r=Date.now(),n=t.touches[0].clientX,a=t.touches[0].clientY,u=0,i=0},!1),e.addEventListener(\"touchmove\",function(t){if(!n||!a)return;var e=t.touches[0].clientX,r=t.touches[0].clientY;u=n-e,i=a-r},!1),e.addEventListener(\"touchend\",function(t){if(s!==t.target)return;var e=parseInt(l(s,\"data-swipe-threshold\",\"20\"),10),o=parseInt(l(s,\"data-swipe-timeout\",\"500\"),10),c=Date.now()-r,d=\"\",p=t.changedTouches||t.touches||[];Math.abs(u)>Math.abs(i)?Math.abs(u)>e&&c0?\"swiped-left\":\"swiped-right\"):Math.abs(i)>e&&c0?\"swiped-up\":\"swiped-down\");if(\"\"!==d){var b={dir:d.replace(/swiped-/,\"\"),xStart:parseInt(n,10),xEnd:parseInt((p[0]||{}).clientX||-1,10),yStart:parseInt(a,10),yEnd:parseInt((p[0]||{}).clientY||-1,10)};s.dispatchEvent(new CustomEvent(\"swiped\",{bubbles:!0,cancelable:!0,detail:b})),s.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:b}))}n=null,a=null,r=null},!1);var n=null,a=null,u=null,i=null,r=null,s=null;function l(t,n,a){for(;t&&t!==e.documentElement;){var u=t.getAttribute(n);if(u)return u;t=t.parentNode}return a}}(window,document);\n", - "\n", - "function jaxify(string) {\n", - " var mystring = string;\n", - " console.log(mystring);\n", - "\n", - " var count = 0;\n", - " var loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - "\n", - " var count2 = 0;\n", - " var loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - "\n", - " //console.log(loc);\n", - "\n", - " while ((loc >= 0) || (loc2 >= 0)) {\n", - "\n", - " /* Have to replace all the double $$ first with current implementation */\n", - " if (loc2 >= 0) {\n", - " if (count2 % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\[\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\]\");\n", - " }\n", - " count2++;\n", - " } else {\n", - " if (count % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\(\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\)\");\n", - " }\n", - " count++;\n", - " }\n", - " loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - " loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - " //console.log(mystring,\", loc:\",loc,\", loc2:\",loc2);\n", - " }\n", - "\n", - " //console.log(mystring);\n", - " return mystring;\n", - "}\n", - "\n", - "window.flipCard = function flipCard(ths) {\n", - " console.log(ths);\n", - " console.log(ths.id);\n", - " ths.classList.toggle(\"flip\"); \n", - " var next=document.getElementById(ths.id+'-next');\n", - " next.style.pointerEvents='none';\n", - " /* ths.blur(); */\n", - " next.classList.add('flipped');\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([ths]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " setTimeout(reenableNext, 600, ths, next);\n", - "}\n", - "\n", - "window.checkKey = function checkKey(container, event) {\n", - " event.stopPropagation();\n", - " /*\n", - " console.log(container);\n", - " console.log(event.key);\n", - " console.log(event.code);\n", - " */\n", - " /* JMS: Working here*/\n", - " var next=document.getElementById(container.id+'-next');\n", - " /* Only react if not already sliding */\n", - " if (! next.classList.contains(\"hide\")) {\n", - " if ((event.key == \"j\") || (event.key == \"Enter\") || (event.key == \"ArrowRight\")) {\n", - " window.checkFlip(container.id);\n", - " }\n", - " if (event.key == \" \") {\n", - " window.flipCard(container);\n", - " }\n", - " }\n", - " event.preventDefault();\n", - "}\n", - "\n", - "\n", - "function reenableNext(ths, next) {\n", - " next.style.pointerEvents='auto';\n", - " /* ths.tabIndex= 0;*/\n", - " /* ths.focus(); */\n", - "}\n", - "\n", - "\n", - "\n", - "function slide2(containerId) {\n", - " var container = document.getElementById(containerId);\n", - " var next=document.getElementById(containerId+'-next');\n", - " var frontcard = container.children[0];\n", - " var backcard = container.children[1];\n", - " container.style.pointerEvents='none';\n", - " /* container.removeAttribute(\"tabindex\");*/\n", - " /* container.blur(); */\n", - " //backcard.style.pointerEvents='none';\n", - " next.style.pointerEvents='none';\n", - " next.classList.remove('flipped');\n", - " next.classList.add('hide');\n", - "\n", - " //container.classList.add(\"prepare\");\n", - " \n", - " container.className=\"flip-container slide\";\n", - " backcard.parentElement.removeChild(frontcard);\n", - " backcard.parentElement.appendChild(frontcard);\n", - " setTimeout(slideback, 600, container, frontcard, backcard, next);\n", - " \n", - "}\n", - "\n", - "\n", - "window.checkFlip = function checkFlip(containerId) {\n", - " var container = document.getElementById(containerId);\n", - "\n", - "\n", - " if (container.classList.contains('flip')) {\n", - " container.classList.remove('flip');\n", - " setTimeout(slide2, 600, containerId);\n", - " } \n", - " else {\n", - " slide2(containerId);\n", - " }\n", - "}\n", - "\n", - "\n", - "function slideback(container, frontcard, backcard, next) {\n", - " container.className=\"flip-container slideback\";\n", - " setTimeout(cleanup, 550, container, frontcard, backcard, next);\n", - "}\n", - "\n", - "function cleanup(container, frontcard, backcard, next) {\n", - " container.removeChild(frontcard);\n", - " backcard.className=\"flipper frontcard\";\n", - " container.className=\"flip-container\";\n", - "\n", - " var cardnum=parseInt(container.dataset.cardnum);\n", - " var cards=eval('cards'+container.id);\n", - " var flipper=createOneCard(container, false, cards, cardnum);\n", - " container.append(flipper);\n", - " cardnum= (cardnum+1) % parseInt(container.dataset.numCards);\n", - " container.dataset.cardnum=cardnum;\n", - " if (cardnum != 1){\n", - " next.innerHTML=\"Next >\";\n", - " } else {\n", - " //next.innerHTML=\"Reload \\\\(\\\\circlearrowleft\\\\) \";\n", - " next.innerHTML='Reload '\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([next]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " }\n", - "\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset();\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " next.style.pointerEvents='auto';\n", - " container.style.pointerEvents='auto';\n", - " /* container.tabIndex= 0; */\n", - " /* container.focus(); */\n", - " next.classList.remove('hide');\n", - " container.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(container.id);\n", - " }, {once: true });\n", - "\n", - "\n", - "}\n", - "\n", - "\n", - "function createOneCard (mydiv, frontCard, cards, cardnum) {\n", - " var colors=[\n", - " '--asparagus',\n", - " '--terra-cotta',\n", - " '--cyan-process'\n", - " ]\n", - "\n", - " var flipper = document.createElement('div');\n", - " if (frontCard){\n", - " flipper.className=\"flipper frontcard\"; \n", - " }\n", - " else {\n", - " flipper.className=\"flipper backcard\"; \n", - " }\n", - "\n", - " var front = document.createElement('div');\n", - " front.className='front flashcard';\n", - "\n", - " var frontSpan= document.createElement('span');\n", - " frontSpan.className='flashcardtext';\n", - " frontSpan.innerHTML=jaxify(cards[cardnum]['front']);\n", - " //frontSpan.textContent=jaxify(cards[cardnum]['front']);\n", - " front.style.background='var(' + colors[cardnum % colors.length] + ')';\n", - "\n", - "\n", - " front.append(frontSpan);\n", - " flipper.append(front);\n", - "\n", - " var back = document.createElement('div');\n", - " back.className='back flashcard';\n", - "\n", - " var backSpan= document.createElement('span');\n", - " backSpan.className='flashcardtext';\n", - " backSpan.innerHTML=jaxify(cards[cardnum]['back']);\n", - " back.append(backSpan);\n", - "\n", - " flipper.append(back);\n", - "\n", - " return flipper;\n", - "\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "function createCards(id, keyControl) {\n", - " console.log(id);\n", - " \n", - " var mydiv=document.getElementById(id);\n", - " /*mydiv.onclick = window.flipCard(mydiv);*/\n", - " /*\n", - " mydiv.addEventListener('click', function(){window.flipCard(mydiv);}, false);\n", - " mydiv.addEventListener('keydown', function(event){window.checkKey(mydiv,event);}, true);\n", - " */\n", - " mydiv.onclick = function(){window.flipCard(mydiv);};\n", - " console.log(keyControl);\n", - " if (keyControl == \"True\"){\n", - " mydiv.onkeydown = function(event){window.checkKey(mydiv,event);};\n", - " }\n", - " /* mydiv.addEventListener('keydown', function(event){event.stopPropagation(); console.log(event); event.preventDefault();}, true); */\n", - " /*mydiv.onkeypress = function(event){console.log(event); event.preventDefault();};*/\n", - "\n", - " console.log(mydiv);\n", - " \n", - " var cards=eval('cards'+id);\n", - " mydiv.dataset.cardnum=0;\n", - " mydiv.dataset.numCards=cards.length;\n", - " mydiv.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(id);\n", - " }, {once: true});\n", - "\n", - " var cardnum=0;\n", - " \n", - " for (var i=0; i<2; i++) {\n", - " \n", - " var flipper;\n", - " if (i==0){\n", - " flipper=createOneCard(mydiv, true, cards, cardnum);\n", - " }\n", - " else {\n", - " flipper=createOneCard(mydiv, false, cards, cardnum);\n", - " }\n", - "\n", - " mydiv.append(flipper);\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " if (typeof version == 'undefined') {\n", - " setTimeout(function(){\n", - " var version = MathJax.version;\n", - " console.log('After sleep, MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }, 500);\n", - " } else{\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " cardnum = (cardnum + 1) % mydiv.dataset.numCards;\n", - " }\n", - " mydiv.dataset.cardnum = cardnum;\n", - "\n", - " var next=document.getElementById(id+'-next');\n", - " if (cards.length==1) {\n", - " // Don't show next if no other cards!\n", - " next.style.pointerEvents='none';\n", - " next.classList.add('hide');\n", - " } else {\n", - " next.innerHTML=\"Next >\";\n", - " }\n", - "\n", - " mydiv.focus();\n", - "\n", - " return flipper;\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "var cardslhohnItYRLgs=[\n", - " {\n", - " \"front\": \"hint\",\n", - " \"back\": \"mkdir creates new directories.\"\n", - " },\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \"mkdir -p /home/jupyter/my_directory
mkdir -p /home/jupyter/new_dir\"\n", - " }\n", - "];\n", - " \n", - " createCards(\"lhohnItYRLgs\", \"True\");\n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from jupytercards import display_flashcards\n", "cards='/home/jupyter/flashcards/'\n", @@ -663,31 +13,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "tf2-gpu.2-8.m102", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/tf2-gpu.2-8:m102" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/GoogleCloud/quiz_files/quiz1-3.ipynb b/GoogleCloud/quiz_files/quiz1-3.ipynb index e0f43d3..b70b691 100644 --- a/GoogleCloud/quiz_files/quiz1-3.ipynb +++ b/GoogleCloud/quiz_files/quiz1-3.ipynb @@ -2,660 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "113fb089-7d61-481e-9473-f72bf2ed5371", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "/*!\n", - " * swiped-events.js - v1.1.4\n", - " * Pure JavaScript swipe events\n", - " * https://github.com/john-doherty/swiped-events\n", - " * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element\n", - " * @author John Doherty \n", - " * @license MIT\n", - " */\n", - "!function(t,e){\"use strict\";\"function\"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=e.createEvent(\"CustomEvent\");return a.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),a},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener(\"touchstart\",function(t){if(\"true\"===t.target.getAttribute(\"data-swipe-ignore\"))return;s=t.target,r=Date.now(),n=t.touches[0].clientX,a=t.touches[0].clientY,u=0,i=0},!1),e.addEventListener(\"touchmove\",function(t){if(!n||!a)return;var e=t.touches[0].clientX,r=t.touches[0].clientY;u=n-e,i=a-r},!1),e.addEventListener(\"touchend\",function(t){if(s!==t.target)return;var e=parseInt(l(s,\"data-swipe-threshold\",\"20\"),10),o=parseInt(l(s,\"data-swipe-timeout\",\"500\"),10),c=Date.now()-r,d=\"\",p=t.changedTouches||t.touches||[];Math.abs(u)>Math.abs(i)?Math.abs(u)>e&&c0?\"swiped-left\":\"swiped-right\"):Math.abs(i)>e&&c0?\"swiped-up\":\"swiped-down\");if(\"\"!==d){var b={dir:d.replace(/swiped-/,\"\"),xStart:parseInt(n,10),xEnd:parseInt((p[0]||{}).clientX||-1,10),yStart:parseInt(a,10),yEnd:parseInt((p[0]||{}).clientY||-1,10)};s.dispatchEvent(new CustomEvent(\"swiped\",{bubbles:!0,cancelable:!0,detail:b})),s.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:b}))}n=null,a=null,r=null},!1);var n=null,a=null,u=null,i=null,r=null,s=null;function l(t,n,a){for(;t&&t!==e.documentElement;){var u=t.getAttribute(n);if(u)return u;t=t.parentNode}return a}}(window,document);\n", - "\n", - "function jaxify(string) {\n", - " var mystring = string;\n", - " console.log(mystring);\n", - "\n", - " var count = 0;\n", - " var loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - "\n", - " var count2 = 0;\n", - " var loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - "\n", - " //console.log(loc);\n", - "\n", - " while ((loc >= 0) || (loc2 >= 0)) {\n", - "\n", - " /* Have to replace all the double $$ first with current implementation */\n", - " if (loc2 >= 0) {\n", - " if (count2 % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\[\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\]\");\n", - " }\n", - " count2++;\n", - " } else {\n", - " if (count % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\(\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\)\");\n", - " }\n", - " count++;\n", - " }\n", - " loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - " loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - " //console.log(mystring,\", loc:\",loc,\", loc2:\",loc2);\n", - " }\n", - "\n", - " //console.log(mystring);\n", - " return mystring;\n", - "}\n", - "\n", - "window.flipCard = function flipCard(ths) {\n", - " console.log(ths);\n", - " console.log(ths.id);\n", - " ths.classList.toggle(\"flip\"); \n", - " var next=document.getElementById(ths.id+'-next');\n", - " next.style.pointerEvents='none';\n", - " /* ths.blur(); */\n", - " next.classList.add('flipped');\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([ths]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " setTimeout(reenableNext, 600, ths, next);\n", - "}\n", - "\n", - "window.checkKey = function checkKey(container, event) {\n", - " event.stopPropagation();\n", - " /*\n", - " console.log(container);\n", - " console.log(event.key);\n", - " console.log(event.code);\n", - " */\n", - " /* JMS: Working here*/\n", - " var next=document.getElementById(container.id+'-next');\n", - " /* Only react if not already sliding */\n", - " if (! next.classList.contains(\"hide\")) {\n", - " if ((event.key == \"j\") || (event.key == \"Enter\") || (event.key == \"ArrowRight\")) {\n", - " window.checkFlip(container.id);\n", - " }\n", - " if (event.key == \" \") {\n", - " window.flipCard(container);\n", - " }\n", - " }\n", - " event.preventDefault();\n", - "}\n", - "\n", - "\n", - "function reenableNext(ths, next) {\n", - " next.style.pointerEvents='auto';\n", - " /* ths.tabIndex= 0;*/\n", - " /* ths.focus(); */\n", - "}\n", - "\n", - "\n", - "\n", - "function slide2(containerId) {\n", - " var container = document.getElementById(containerId);\n", - " var next=document.getElementById(containerId+'-next');\n", - " var frontcard = container.children[0];\n", - " var backcard = container.children[1];\n", - " container.style.pointerEvents='none';\n", - " /* container.removeAttribute(\"tabindex\");*/\n", - " /* container.blur(); */\n", - " //backcard.style.pointerEvents='none';\n", - " next.style.pointerEvents='none';\n", - " next.classList.remove('flipped');\n", - " next.classList.add('hide');\n", - "\n", - " //container.classList.add(\"prepare\");\n", - " \n", - " container.className=\"flip-container slide\";\n", - " backcard.parentElement.removeChild(frontcard);\n", - " backcard.parentElement.appendChild(frontcard);\n", - " setTimeout(slideback, 600, container, frontcard, backcard, next);\n", - " \n", - "}\n", - "\n", - "\n", - "window.checkFlip = function checkFlip(containerId) {\n", - " var container = document.getElementById(containerId);\n", - "\n", - "\n", - " if (container.classList.contains('flip')) {\n", - " container.classList.remove('flip');\n", - " setTimeout(slide2, 600, containerId);\n", - " } \n", - " else {\n", - " slide2(containerId);\n", - " }\n", - "}\n", - "\n", - "\n", - "function slideback(container, frontcard, backcard, next) {\n", - " container.className=\"flip-container slideback\";\n", - " setTimeout(cleanup, 550, container, frontcard, backcard, next);\n", - "}\n", - "\n", - "function cleanup(container, frontcard, backcard, next) {\n", - " container.removeChild(frontcard);\n", - " backcard.className=\"flipper frontcard\";\n", - " container.className=\"flip-container\";\n", - "\n", - " var cardnum=parseInt(container.dataset.cardnum);\n", - " var cards=eval('cards'+container.id);\n", - " var flipper=createOneCard(container, false, cards, cardnum);\n", - " container.append(flipper);\n", - " cardnum= (cardnum+1) % parseInt(container.dataset.numCards);\n", - " container.dataset.cardnum=cardnum;\n", - " if (cardnum != 1){\n", - " next.innerHTML=\"Next >\";\n", - " } else {\n", - " //next.innerHTML=\"Reload \\\\(\\\\circlearrowleft\\\\) \";\n", - " next.innerHTML='Reload '\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([next]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " }\n", - "\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset();\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " next.style.pointerEvents='auto';\n", - " container.style.pointerEvents='auto';\n", - " /* container.tabIndex= 0; */\n", - " /* container.focus(); */\n", - " next.classList.remove('hide');\n", - " container.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(container.id);\n", - " }, {once: true });\n", - "\n", - "\n", - "}\n", - "\n", - "\n", - "function createOneCard (mydiv, frontCard, cards, cardnum) {\n", - " var colors=[\n", - " '--asparagus',\n", - " '--terra-cotta',\n", - " '--cyan-process'\n", - " ]\n", - "\n", - " var flipper = document.createElement('div');\n", - " if (frontCard){\n", - " flipper.className=\"flipper frontcard\"; \n", - " }\n", - " else {\n", - " flipper.className=\"flipper backcard\"; \n", - " }\n", - "\n", - " var front = document.createElement('div');\n", - " front.className='front flashcard';\n", - "\n", - " var frontSpan= document.createElement('span');\n", - " frontSpan.className='flashcardtext';\n", - " frontSpan.innerHTML=jaxify(cards[cardnum]['front']);\n", - " //frontSpan.textContent=jaxify(cards[cardnum]['front']);\n", - " front.style.background='var(' + colors[cardnum % colors.length] + ')';\n", - "\n", - "\n", - " front.append(frontSpan);\n", - " flipper.append(front);\n", - "\n", - " var back = document.createElement('div');\n", - " back.className='back flashcard';\n", - "\n", - " var backSpan= document.createElement('span');\n", - " backSpan.className='flashcardtext';\n", - " backSpan.innerHTML=jaxify(cards[cardnum]['back']);\n", - " back.append(backSpan);\n", - "\n", - " flipper.append(back);\n", - "\n", - " return flipper;\n", - "\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "function createCards(id, keyControl) {\n", - " console.log(id);\n", - " \n", - " var mydiv=document.getElementById(id);\n", - " /*mydiv.onclick = window.flipCard(mydiv);*/\n", - " /*\n", - " mydiv.addEventListener('click', function(){window.flipCard(mydiv);}, false);\n", - " mydiv.addEventListener('keydown', function(event){window.checkKey(mydiv,event);}, true);\n", - " */\n", - " mydiv.onclick = function(){window.flipCard(mydiv);};\n", - " console.log(keyControl);\n", - " if (keyControl == \"True\"){\n", - " mydiv.onkeydown = function(event){window.checkKey(mydiv,event);};\n", - " }\n", - " /* mydiv.addEventListener('keydown', function(event){event.stopPropagation(); console.log(event); event.preventDefault();}, true); */\n", - " /*mydiv.onkeypress = function(event){console.log(event); event.preventDefault();};*/\n", - "\n", - " console.log(mydiv);\n", - " \n", - " var cards=eval('cards'+id);\n", - " mydiv.dataset.cardnum=0;\n", - " mydiv.dataset.numCards=cards.length;\n", - " mydiv.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(id);\n", - " }, {once: true});\n", - "\n", - " var cardnum=0;\n", - " \n", - " for (var i=0; i<2; i++) {\n", - " \n", - " var flipper;\n", - " if (i==0){\n", - " flipper=createOneCard(mydiv, true, cards, cardnum);\n", - " }\n", - " else {\n", - " flipper=createOneCard(mydiv, false, cards, cardnum);\n", - " }\n", - "\n", - " mydiv.append(flipper);\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " if (typeof version == 'undefined') {\n", - " setTimeout(function(){\n", - " var version = MathJax.version;\n", - " console.log('After sleep, MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }, 500);\n", - " } else{\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " cardnum = (cardnum + 1) % mydiv.dataset.numCards;\n", - " }\n", - " mydiv.dataset.cardnum = cardnum;\n", - "\n", - " var next=document.getElementById(id+'-next');\n", - " if (cards.length==1) {\n", - " // Don't show next if no other cards!\n", - " next.style.pointerEvents='none';\n", - " next.classList.add('hide');\n", - " } else {\n", - " next.innerHTML=\"Next >\";\n", - " }\n", - "\n", - " mydiv.focus();\n", - "\n", - " return flipper;\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "var cardsnKNgAFpXWoik=[\n", - " {\n", - " \"front\": \"hint\",\n", - " \"back\": \"use the command pwd to remind you of the absolute path of where you are. Use this to get the absolute path of where you need to go, and use this to understand the directory structure for the relative path.\"\n", - " },\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \"cd /home/jupyter/my_directory
cd ../new_dir\"\n", - " }\n", - "];\n", - " \n", - " createCards(\"nKNgAFpXWoik\", \"True\");\n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from jupytercards import display_flashcards\n", "cards='/home/jupyter/flashcards/'\n", @@ -663,31 +13,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "tf2-gpu.2-8.m102", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/tf2-gpu.2-8:m102" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/GoogleCloud/quiz_files/quiz3-1.ipynb b/GoogleCloud/quiz_files/quiz3-1.ipynb index 7b4be41..eae5413 100644 --- a/GoogleCloud/quiz_files/quiz3-1.ipynb +++ b/GoogleCloud/quiz_files/quiz3-1.ipynb @@ -2,660 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "113fb089-7d61-481e-9473-f72bf2ed5371", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "/*!\n", - " * swiped-events.js - v1.1.4\n", - " * Pure JavaScript swipe events\n", - " * https://github.com/john-doherty/swiped-events\n", - " * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element\n", - " * @author John Doherty \n", - " * @license MIT\n", - " */\n", - "!function(t,e){\"use strict\";\"function\"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=e.createEvent(\"CustomEvent\");return a.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),a},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener(\"touchstart\",function(t){if(\"true\"===t.target.getAttribute(\"data-swipe-ignore\"))return;s=t.target,r=Date.now(),n=t.touches[0].clientX,a=t.touches[0].clientY,u=0,i=0},!1),e.addEventListener(\"touchmove\",function(t){if(!n||!a)return;var e=t.touches[0].clientX,r=t.touches[0].clientY;u=n-e,i=a-r},!1),e.addEventListener(\"touchend\",function(t){if(s!==t.target)return;var e=parseInt(l(s,\"data-swipe-threshold\",\"20\"),10),o=parseInt(l(s,\"data-swipe-timeout\",\"500\"),10),c=Date.now()-r,d=\"\",p=t.changedTouches||t.touches||[];Math.abs(u)>Math.abs(i)?Math.abs(u)>e&&c0?\"swiped-left\":\"swiped-right\"):Math.abs(i)>e&&c0?\"swiped-up\":\"swiped-down\");if(\"\"!==d){var b={dir:d.replace(/swiped-/,\"\"),xStart:parseInt(n,10),xEnd:parseInt((p[0]||{}).clientX||-1,10),yStart:parseInt(a,10),yEnd:parseInt((p[0]||{}).clientY||-1,10)};s.dispatchEvent(new CustomEvent(\"swiped\",{bubbles:!0,cancelable:!0,detail:b})),s.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:b}))}n=null,a=null,r=null},!1);var n=null,a=null,u=null,i=null,r=null,s=null;function l(t,n,a){for(;t&&t!==e.documentElement;){var u=t.getAttribute(n);if(u)return u;t=t.parentNode}return a}}(window,document);\n", - "\n", - "function jaxify(string) {\n", - " var mystring = string;\n", - " console.log(mystring);\n", - "\n", - " var count = 0;\n", - " var loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - "\n", - " var count2 = 0;\n", - " var loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - "\n", - " //console.log(loc);\n", - "\n", - " while ((loc >= 0) || (loc2 >= 0)) {\n", - "\n", - " /* Have to replace all the double $$ first with current implementation */\n", - " if (loc2 >= 0) {\n", - " if (count2 % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\[\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\]\");\n", - " }\n", - " count2++;\n", - " } else {\n", - " if (count % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\(\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\)\");\n", - " }\n", - " count++;\n", - " }\n", - " loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - " loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - " //console.log(mystring,\", loc:\",loc,\", loc2:\",loc2);\n", - " }\n", - "\n", - " //console.log(mystring);\n", - " return mystring;\n", - "}\n", - "\n", - "window.flipCard = function flipCard(ths) {\n", - " console.log(ths);\n", - " console.log(ths.id);\n", - " ths.classList.toggle(\"flip\"); \n", - " var next=document.getElementById(ths.id+'-next');\n", - " next.style.pointerEvents='none';\n", - " /* ths.blur(); */\n", - " next.classList.add('flipped');\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([ths]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " setTimeout(reenableNext, 600, ths, next);\n", - "}\n", - "\n", - "window.checkKey = function checkKey(container, event) {\n", - " event.stopPropagation();\n", - " /*\n", - " console.log(container);\n", - " console.log(event.key);\n", - " console.log(event.code);\n", - " */\n", - " /* JMS: Working here*/\n", - " var next=document.getElementById(container.id+'-next');\n", - " /* Only react if not already sliding */\n", - " if (! next.classList.contains(\"hide\")) {\n", - " if ((event.key == \"j\") || (event.key == \"Enter\") || (event.key == \"ArrowRight\")) {\n", - " window.checkFlip(container.id);\n", - " }\n", - " if (event.key == \" \") {\n", - " window.flipCard(container);\n", - " }\n", - " }\n", - " event.preventDefault();\n", - "}\n", - "\n", - "\n", - "function reenableNext(ths, next) {\n", - " next.style.pointerEvents='auto';\n", - " /* ths.tabIndex= 0;*/\n", - " /* ths.focus(); */\n", - "}\n", - "\n", - "\n", - "\n", - "function slide2(containerId) {\n", - " var container = document.getElementById(containerId);\n", - " var next=document.getElementById(containerId+'-next');\n", - " var frontcard = container.children[0];\n", - " var backcard = container.children[1];\n", - " container.style.pointerEvents='none';\n", - " /* container.removeAttribute(\"tabindex\");*/\n", - " /* container.blur(); */\n", - " //backcard.style.pointerEvents='none';\n", - " next.style.pointerEvents='none';\n", - " next.classList.remove('flipped');\n", - " next.classList.add('hide');\n", - "\n", - " //container.classList.add(\"prepare\");\n", - " \n", - " container.className=\"flip-container slide\";\n", - " backcard.parentElement.removeChild(frontcard);\n", - " backcard.parentElement.appendChild(frontcard);\n", - " setTimeout(slideback, 600, container, frontcard, backcard, next);\n", - " \n", - "}\n", - "\n", - "\n", - "window.checkFlip = function checkFlip(containerId) {\n", - " var container = document.getElementById(containerId);\n", - "\n", - "\n", - " if (container.classList.contains('flip')) {\n", - " container.classList.remove('flip');\n", - " setTimeout(slide2, 600, containerId);\n", - " } \n", - " else {\n", - " slide2(containerId);\n", - " }\n", - "}\n", - "\n", - "\n", - "function slideback(container, frontcard, backcard, next) {\n", - " container.className=\"flip-container slideback\";\n", - " setTimeout(cleanup, 550, container, frontcard, backcard, next);\n", - "}\n", - "\n", - "function cleanup(container, frontcard, backcard, next) {\n", - " container.removeChild(frontcard);\n", - " backcard.className=\"flipper frontcard\";\n", - " container.className=\"flip-container\";\n", - "\n", - " var cardnum=parseInt(container.dataset.cardnum);\n", - " var cards=eval('cards'+container.id);\n", - " var flipper=createOneCard(container, false, cards, cardnum);\n", - " container.append(flipper);\n", - " cardnum= (cardnum+1) % parseInt(container.dataset.numCards);\n", - " container.dataset.cardnum=cardnum;\n", - " if (cardnum != 1){\n", - " next.innerHTML=\"Next >\";\n", - " } else {\n", - " //next.innerHTML=\"Reload \\\\(\\\\circlearrowleft\\\\) \";\n", - " next.innerHTML='Reload '\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([next]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " }\n", - "\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset();\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " next.style.pointerEvents='auto';\n", - " container.style.pointerEvents='auto';\n", - " /* container.tabIndex= 0; */\n", - " /* container.focus(); */\n", - " next.classList.remove('hide');\n", - " container.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(container.id);\n", - " }, {once: true });\n", - "\n", - "\n", - "}\n", - "\n", - "\n", - "function createOneCard (mydiv, frontCard, cards, cardnum) {\n", - " var colors=[\n", - " '--asparagus',\n", - " '--terra-cotta',\n", - " '--cyan-process'\n", - " ]\n", - "\n", - " var flipper = document.createElement('div');\n", - " if (frontCard){\n", - " flipper.className=\"flipper frontcard\"; \n", - " }\n", - " else {\n", - " flipper.className=\"flipper backcard\"; \n", - " }\n", - "\n", - " var front = document.createElement('div');\n", - " front.className='front flashcard';\n", - "\n", - " var frontSpan= document.createElement('span');\n", - " frontSpan.className='flashcardtext';\n", - " frontSpan.innerHTML=jaxify(cards[cardnum]['front']);\n", - " //frontSpan.textContent=jaxify(cards[cardnum]['front']);\n", - " front.style.background='var(' + colors[cardnum % colors.length] + ')';\n", - "\n", - "\n", - " front.append(frontSpan);\n", - " flipper.append(front);\n", - "\n", - " var back = document.createElement('div');\n", - " back.className='back flashcard';\n", - "\n", - " var backSpan= document.createElement('span');\n", - " backSpan.className='flashcardtext';\n", - " backSpan.innerHTML=jaxify(cards[cardnum]['back']);\n", - " back.append(backSpan);\n", - "\n", - " flipper.append(back);\n", - "\n", - " return flipper;\n", - "\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "function createCards(id, keyControl) {\n", - " console.log(id);\n", - " \n", - " var mydiv=document.getElementById(id);\n", - " /*mydiv.onclick = window.flipCard(mydiv);*/\n", - " /*\n", - " mydiv.addEventListener('click', function(){window.flipCard(mydiv);}, false);\n", - " mydiv.addEventListener('keydown', function(event){window.checkKey(mydiv,event);}, true);\n", - " */\n", - " mydiv.onclick = function(){window.flipCard(mydiv);};\n", - " console.log(keyControl);\n", - " if (keyControl == \"True\"){\n", - " mydiv.onkeydown = function(event){window.checkKey(mydiv,event);};\n", - " }\n", - " /* mydiv.addEventListener('keydown', function(event){event.stopPropagation(); console.log(event); event.preventDefault();}, true); */\n", - " /*mydiv.onkeypress = function(event){console.log(event); event.preventDefault();};*/\n", - "\n", - " console.log(mydiv);\n", - " \n", - " var cards=eval('cards'+id);\n", - " mydiv.dataset.cardnum=0;\n", - " mydiv.dataset.numCards=cards.length;\n", - " mydiv.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(id);\n", - " }, {once: true});\n", - "\n", - " var cardnum=0;\n", - " \n", - " for (var i=0; i<2; i++) {\n", - " \n", - " var flipper;\n", - " if (i==0){\n", - " flipper=createOneCard(mydiv, true, cards, cardnum);\n", - " }\n", - " else {\n", - " flipper=createOneCard(mydiv, false, cards, cardnum);\n", - " }\n", - "\n", - " mydiv.append(flipper);\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " if (typeof version == 'undefined') {\n", - " setTimeout(function(){\n", - " var version = MathJax.version;\n", - " console.log('After sleep, MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }, 500);\n", - " } else{\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " cardnum = (cardnum + 1) % mydiv.dataset.numCards;\n", - " }\n", - " mydiv.dataset.cardnum = cardnum;\n", - "\n", - " var next=document.getElementById(id+'-next');\n", - " if (cards.length==1) {\n", - " // Don't show next if no other cards!\n", - " next.style.pointerEvents='none';\n", - " next.classList.add('hide');\n", - " } else {\n", - " next.innerHTML=\"Next >\";\n", - " }\n", - "\n", - " mydiv.focus();\n", - "\n", - " return flipper;\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "var cardsCSKDbPkbxvqG=[\n", - " {\n", - " \"front\": \"hint\",\n", - " \"back\": \"You can use the --help flag with any bash command to get a reminder of the usage syntax as well as the definition of available flags.\"\n", - " },\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \"wc -l FILENAME
grep -c \\\"^>\\\" FILENAME
grep -m 3 \\\"^>\\\" FILENAME
head FILENAME\"\n", - " }\n", - "];\n", - " \n", - " createCards(\"CSKDbPkbxvqG\", \"True\");\n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from jupytercards import display_flashcards\n", "cards='/home/jupyter/flashcards/'\n", @@ -663,31 +13,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "tf2-gpu.2-8.m102", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/tf2-gpu.2-8:m102" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/GoogleCloud/quiz_files/quiz3-2.ipynb b/GoogleCloud/quiz_files/quiz3-2.ipynb index 30b3878..62789ff 100644 --- a/GoogleCloud/quiz_files/quiz3-2.ipynb +++ b/GoogleCloud/quiz_files/quiz3-2.ipynb @@ -2,656 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "113fb089-7d61-481e-9473-f72bf2ed5371", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "/*!\n", - " * swiped-events.js - v1.1.4\n", - " * Pure JavaScript swipe events\n", - " * https://github.com/john-doherty/swiped-events\n", - " * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element\n", - " * @author John Doherty \n", - " * @license MIT\n", - " */\n", - "!function(t,e){\"use strict\";\"function\"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=e.createEvent(\"CustomEvent\");return a.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),a},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener(\"touchstart\",function(t){if(\"true\"===t.target.getAttribute(\"data-swipe-ignore\"))return;s=t.target,r=Date.now(),n=t.touches[0].clientX,a=t.touches[0].clientY,u=0,i=0},!1),e.addEventListener(\"touchmove\",function(t){if(!n||!a)return;var e=t.touches[0].clientX,r=t.touches[0].clientY;u=n-e,i=a-r},!1),e.addEventListener(\"touchend\",function(t){if(s!==t.target)return;var e=parseInt(l(s,\"data-swipe-threshold\",\"20\"),10),o=parseInt(l(s,\"data-swipe-timeout\",\"500\"),10),c=Date.now()-r,d=\"\",p=t.changedTouches||t.touches||[];Math.abs(u)>Math.abs(i)?Math.abs(u)>e&&c0?\"swiped-left\":\"swiped-right\"):Math.abs(i)>e&&c0?\"swiped-up\":\"swiped-down\");if(\"\"!==d){var b={dir:d.replace(/swiped-/,\"\"),xStart:parseInt(n,10),xEnd:parseInt((p[0]||{}).clientX||-1,10),yStart:parseInt(a,10),yEnd:parseInt((p[0]||{}).clientY||-1,10)};s.dispatchEvent(new CustomEvent(\"swiped\",{bubbles:!0,cancelable:!0,detail:b})),s.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:b}))}n=null,a=null,r=null},!1);var n=null,a=null,u=null,i=null,r=null,s=null;function l(t,n,a){for(;t&&t!==e.documentElement;){var u=t.getAttribute(n);if(u)return u;t=t.parentNode}return a}}(window,document);\n", - "\n", - "function jaxify(string) {\n", - " var mystring = string;\n", - " console.log(mystring);\n", - "\n", - " var count = 0;\n", - " var loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - "\n", - " var count2 = 0;\n", - " var loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - "\n", - " //console.log(loc);\n", - "\n", - " while ((loc >= 0) || (loc2 >= 0)) {\n", - "\n", - " /* Have to replace all the double $$ first with current implementation */\n", - " if (loc2 >= 0) {\n", - " if (count2 % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\[\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\]\");\n", - " }\n", - " count2++;\n", - " } else {\n", - " if (count % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\(\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\)\");\n", - " }\n", - " count++;\n", - " }\n", - " loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - " loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - " //console.log(mystring,\", loc:\",loc,\", loc2:\",loc2);\n", - " }\n", - "\n", - " //console.log(mystring);\n", - " return mystring;\n", - "}\n", - "\n", - "window.flipCard = function flipCard(ths) {\n", - " console.log(ths);\n", - " console.log(ths.id);\n", - " ths.classList.toggle(\"flip\"); \n", - " var next=document.getElementById(ths.id+'-next');\n", - " next.style.pointerEvents='none';\n", - " /* ths.blur(); */\n", - " next.classList.add('flipped');\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([ths]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " setTimeout(reenableNext, 600, ths, next);\n", - "}\n", - "\n", - "window.checkKey = function checkKey(container, event) {\n", - " event.stopPropagation();\n", - " /*\n", - " console.log(container);\n", - " console.log(event.key);\n", - " console.log(event.code);\n", - " */\n", - " /* JMS: Working here*/\n", - " var next=document.getElementById(container.id+'-next');\n", - " /* Only react if not already sliding */\n", - " if (! next.classList.contains(\"hide\")) {\n", - " if ((event.key == \"j\") || (event.key == \"Enter\") || (event.key == \"ArrowRight\")) {\n", - " window.checkFlip(container.id);\n", - " }\n", - " if (event.key == \" \") {\n", - " window.flipCard(container);\n", - " }\n", - " }\n", - " event.preventDefault();\n", - "}\n", - "\n", - "\n", - "function reenableNext(ths, next) {\n", - " next.style.pointerEvents='auto';\n", - " /* ths.tabIndex= 0;*/\n", - " /* ths.focus(); */\n", - "}\n", - "\n", - "\n", - "\n", - "function slide2(containerId) {\n", - " var container = document.getElementById(containerId);\n", - " var next=document.getElementById(containerId+'-next');\n", - " var frontcard = container.children[0];\n", - " var backcard = container.children[1];\n", - " container.style.pointerEvents='none';\n", - " /* container.removeAttribute(\"tabindex\");*/\n", - " /* container.blur(); */\n", - " //backcard.style.pointerEvents='none';\n", - " next.style.pointerEvents='none';\n", - " next.classList.remove('flipped');\n", - " next.classList.add('hide');\n", - "\n", - " //container.classList.add(\"prepare\");\n", - " \n", - " container.className=\"flip-container slide\";\n", - " backcard.parentElement.removeChild(frontcard);\n", - " backcard.parentElement.appendChild(frontcard);\n", - " setTimeout(slideback, 600, container, frontcard, backcard, next);\n", - " \n", - "}\n", - "\n", - "\n", - "window.checkFlip = function checkFlip(containerId) {\n", - " var container = document.getElementById(containerId);\n", - "\n", - "\n", - " if (container.classList.contains('flip')) {\n", - " container.classList.remove('flip');\n", - " setTimeout(slide2, 600, containerId);\n", - " } \n", - " else {\n", - " slide2(containerId);\n", - " }\n", - "}\n", - "\n", - "\n", - "function slideback(container, frontcard, backcard, next) {\n", - " container.className=\"flip-container slideback\";\n", - " setTimeout(cleanup, 550, container, frontcard, backcard, next);\n", - "}\n", - "\n", - "function cleanup(container, frontcard, backcard, next) {\n", - " container.removeChild(frontcard);\n", - " backcard.className=\"flipper frontcard\";\n", - " container.className=\"flip-container\";\n", - "\n", - " var cardnum=parseInt(container.dataset.cardnum);\n", - " var cards=eval('cards'+container.id);\n", - " var flipper=createOneCard(container, false, cards, cardnum);\n", - " container.append(flipper);\n", - " cardnum= (cardnum+1) % parseInt(container.dataset.numCards);\n", - " container.dataset.cardnum=cardnum;\n", - " if (cardnum != 1){\n", - " next.innerHTML=\"Next >\";\n", - " } else {\n", - " //next.innerHTML=\"Reload \\\\(\\\\circlearrowleft\\\\) \";\n", - " next.innerHTML='Reload '\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([next]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " }\n", - "\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset();\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " next.style.pointerEvents='auto';\n", - " container.style.pointerEvents='auto';\n", - " /* container.tabIndex= 0; */\n", - " /* container.focus(); */\n", - " next.classList.remove('hide');\n", - " container.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(container.id);\n", - " }, {once: true });\n", - "\n", - "\n", - "}\n", - "\n", - "\n", - "function createOneCard (mydiv, frontCard, cards, cardnum) {\n", - " var colors=[\n", - " '--asparagus',\n", - " '--terra-cotta',\n", - " '--cyan-process'\n", - " ]\n", - "\n", - " var flipper = document.createElement('div');\n", - " if (frontCard){\n", - " flipper.className=\"flipper frontcard\"; \n", - " }\n", - " else {\n", - " flipper.className=\"flipper backcard\"; \n", - " }\n", - "\n", - " var front = document.createElement('div');\n", - " front.className='front flashcard';\n", - "\n", - " var frontSpan= document.createElement('span');\n", - " frontSpan.className='flashcardtext';\n", - " frontSpan.innerHTML=jaxify(cards[cardnum]['front']);\n", - " //frontSpan.textContent=jaxify(cards[cardnum]['front']);\n", - " front.style.background='var(' + colors[cardnum % colors.length] + ')';\n", - "\n", - "\n", - " front.append(frontSpan);\n", - " flipper.append(front);\n", - "\n", - " var back = document.createElement('div');\n", - " back.className='back flashcard';\n", - "\n", - " var backSpan= document.createElement('span');\n", - " backSpan.className='flashcardtext';\n", - " backSpan.innerHTML=jaxify(cards[cardnum]['back']);\n", - " back.append(backSpan);\n", - "\n", - " flipper.append(back);\n", - "\n", - " return flipper;\n", - "\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "function createCards(id, keyControl) {\n", - " console.log(id);\n", - " \n", - " var mydiv=document.getElementById(id);\n", - " /*mydiv.onclick = window.flipCard(mydiv);*/\n", - " /*\n", - " mydiv.addEventListener('click', function(){window.flipCard(mydiv);}, false);\n", - " mydiv.addEventListener('keydown', function(event){window.checkKey(mydiv,event);}, true);\n", - " */\n", - " mydiv.onclick = function(){window.flipCard(mydiv);};\n", - " console.log(keyControl);\n", - " if (keyControl == \"True\"){\n", - " mydiv.onkeydown = function(event){window.checkKey(mydiv,event);};\n", - " }\n", - " /* mydiv.addEventListener('keydown', function(event){event.stopPropagation(); console.log(event); event.preventDefault();}, true); */\n", - " /*mydiv.onkeypress = function(event){console.log(event); event.preventDefault();};*/\n", - "\n", - " console.log(mydiv);\n", - " \n", - " var cards=eval('cards'+id);\n", - " mydiv.dataset.cardnum=0;\n", - " mydiv.dataset.numCards=cards.length;\n", - " mydiv.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(id);\n", - " }, {once: true});\n", - "\n", - " var cardnum=0;\n", - " \n", - " for (var i=0; i<2; i++) {\n", - " \n", - " var flipper;\n", - " if (i==0){\n", - " flipper=createOneCard(mydiv, true, cards, cardnum);\n", - " }\n", - " else {\n", - " flipper=createOneCard(mydiv, false, cards, cardnum);\n", - " }\n", - "\n", - " mydiv.append(flipper);\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " if (typeof version == 'undefined') {\n", - " setTimeout(function(){\n", - " var version = MathJax.version;\n", - " console.log('After sleep, MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }, 500);\n", - " } else{\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " cardnum = (cardnum + 1) % mydiv.dataset.numCards;\n", - " }\n", - " mydiv.dataset.cardnum = cardnum;\n", - "\n", - " var next=document.getElementById(id+'-next');\n", - " if (cards.length==1) {\n", - " // Don't show next if no other cards!\n", - " next.style.pointerEvents='none';\n", - " next.classList.add('hide');\n", - " } else {\n", - " next.innerHTML=\"Next >\";\n", - " }\n", - "\n", - " mydiv.focus();\n", - "\n", - " return flipper;\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "var cardscBpXoRtWJBdJ=[\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \"zcat gcp_research_workflow/SRR1039508_1.chr20.fastq.gz | sed -n '4~4p' | head -n 10000 | grep -o .| grep -c \\\"#\\\" \"\n", - " }\n", - "];\n", - " \n", - " createCards(\"cBpXoRtWJBdJ\", \"True\");\n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from jupytercards import display_flashcards\n", "cards='/home/jupyter/flashcards/'\n", @@ -659,31 +13,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "tf2-gpu.2-8.m102", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/tf2-gpu.2-8:m102" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/GoogleCloud/quiz_files/quiz4-1.ipynb b/GoogleCloud/quiz_files/quiz4-1.ipynb index a23a430..61af203 100644 --- a/GoogleCloud/quiz_files/quiz4-1.ipynb +++ b/GoogleCloud/quiz_files/quiz4-1.ipynb @@ -2,656 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "113fb089-7d61-481e-9473-f72bf2ed5371", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "/*!\n", - " * swiped-events.js - v1.1.4\n", - " * Pure JavaScript swipe events\n", - " * https://github.com/john-doherty/swiped-events\n", - " * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element\n", - " * @author John Doherty \n", - " * @license MIT\n", - " */\n", - "!function(t,e){\"use strict\";\"function\"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=e.createEvent(\"CustomEvent\");return a.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),a},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener(\"touchstart\",function(t){if(\"true\"===t.target.getAttribute(\"data-swipe-ignore\"))return;s=t.target,r=Date.now(),n=t.touches[0].clientX,a=t.touches[0].clientY,u=0,i=0},!1),e.addEventListener(\"touchmove\",function(t){if(!n||!a)return;var e=t.touches[0].clientX,r=t.touches[0].clientY;u=n-e,i=a-r},!1),e.addEventListener(\"touchend\",function(t){if(s!==t.target)return;var e=parseInt(l(s,\"data-swipe-threshold\",\"20\"),10),o=parseInt(l(s,\"data-swipe-timeout\",\"500\"),10),c=Date.now()-r,d=\"\",p=t.changedTouches||t.touches||[];Math.abs(u)>Math.abs(i)?Math.abs(u)>e&&c0?\"swiped-left\":\"swiped-right\"):Math.abs(i)>e&&c0?\"swiped-up\":\"swiped-down\");if(\"\"!==d){var b={dir:d.replace(/swiped-/,\"\"),xStart:parseInt(n,10),xEnd:parseInt((p[0]||{}).clientX||-1,10),yStart:parseInt(a,10),yEnd:parseInt((p[0]||{}).clientY||-1,10)};s.dispatchEvent(new CustomEvent(\"swiped\",{bubbles:!0,cancelable:!0,detail:b})),s.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:b}))}n=null,a=null,r=null},!1);var n=null,a=null,u=null,i=null,r=null,s=null;function l(t,n,a){for(;t&&t!==e.documentElement;){var u=t.getAttribute(n);if(u)return u;t=t.parentNode}return a}}(window,document);\n", - "\n", - "function jaxify(string) {\n", - " var mystring = string;\n", - " console.log(mystring);\n", - "\n", - " var count = 0;\n", - " var loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - "\n", - " var count2 = 0;\n", - " var loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - "\n", - " //console.log(loc);\n", - "\n", - " while ((loc >= 0) || (loc2 >= 0)) {\n", - "\n", - " /* Have to replace all the double $$ first with current implementation */\n", - " if (loc2 >= 0) {\n", - " if (count2 % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\[\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\]\");\n", - " }\n", - " count2++;\n", - " } else {\n", - " if (count % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\(\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\)\");\n", - " }\n", - " count++;\n", - " }\n", - " loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - " loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - " //console.log(mystring,\", loc:\",loc,\", loc2:\",loc2);\n", - " }\n", - "\n", - " //console.log(mystring);\n", - " return mystring;\n", - "}\n", - "\n", - "window.flipCard = function flipCard(ths) {\n", - " console.log(ths);\n", - " console.log(ths.id);\n", - " ths.classList.toggle(\"flip\"); \n", - " var next=document.getElementById(ths.id+'-next');\n", - " next.style.pointerEvents='none';\n", - " /* ths.blur(); */\n", - " next.classList.add('flipped');\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([ths]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " setTimeout(reenableNext, 600, ths, next);\n", - "}\n", - "\n", - "window.checkKey = function checkKey(container, event) {\n", - " event.stopPropagation();\n", - " /*\n", - " console.log(container);\n", - " console.log(event.key);\n", - " console.log(event.code);\n", - " */\n", - " /* JMS: Working here*/\n", - " var next=document.getElementById(container.id+'-next');\n", - " /* Only react if not already sliding */\n", - " if (! next.classList.contains(\"hide\")) {\n", - " if ((event.key == \"j\") || (event.key == \"Enter\") || (event.key == \"ArrowRight\")) {\n", - " window.checkFlip(container.id);\n", - " }\n", - " if (event.key == \" \") {\n", - " window.flipCard(container);\n", - " }\n", - " }\n", - " event.preventDefault();\n", - "}\n", - "\n", - "\n", - "function reenableNext(ths, next) {\n", - " next.style.pointerEvents='auto';\n", - " /* ths.tabIndex= 0;*/\n", - " /* ths.focus(); */\n", - "}\n", - "\n", - "\n", - "\n", - "function slide2(containerId) {\n", - " var container = document.getElementById(containerId);\n", - " var next=document.getElementById(containerId+'-next');\n", - " var frontcard = container.children[0];\n", - " var backcard = container.children[1];\n", - " container.style.pointerEvents='none';\n", - " /* container.removeAttribute(\"tabindex\");*/\n", - " /* container.blur(); */\n", - " //backcard.style.pointerEvents='none';\n", - " next.style.pointerEvents='none';\n", - " next.classList.remove('flipped');\n", - " next.classList.add('hide');\n", - "\n", - " //container.classList.add(\"prepare\");\n", - " \n", - " container.className=\"flip-container slide\";\n", - " backcard.parentElement.removeChild(frontcard);\n", - " backcard.parentElement.appendChild(frontcard);\n", - " setTimeout(slideback, 600, container, frontcard, backcard, next);\n", - " \n", - "}\n", - "\n", - "\n", - "window.checkFlip = function checkFlip(containerId) {\n", - " var container = document.getElementById(containerId);\n", - "\n", - "\n", - " if (container.classList.contains('flip')) {\n", - " container.classList.remove('flip');\n", - " setTimeout(slide2, 600, containerId);\n", - " } \n", - " else {\n", - " slide2(containerId);\n", - " }\n", - "}\n", - "\n", - "\n", - "function slideback(container, frontcard, backcard, next) {\n", - " container.className=\"flip-container slideback\";\n", - " setTimeout(cleanup, 550, container, frontcard, backcard, next);\n", - "}\n", - "\n", - "function cleanup(container, frontcard, backcard, next) {\n", - " container.removeChild(frontcard);\n", - " backcard.className=\"flipper frontcard\";\n", - " container.className=\"flip-container\";\n", - "\n", - " var cardnum=parseInt(container.dataset.cardnum);\n", - " var cards=eval('cards'+container.id);\n", - " var flipper=createOneCard(container, false, cards, cardnum);\n", - " container.append(flipper);\n", - " cardnum= (cardnum+1) % parseInt(container.dataset.numCards);\n", - " container.dataset.cardnum=cardnum;\n", - " if (cardnum != 1){\n", - " next.innerHTML=\"Next >\";\n", - " } else {\n", - " //next.innerHTML=\"Reload \\\\(\\\\circlearrowleft\\\\) \";\n", - " next.innerHTML='Reload '\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([next]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " }\n", - "\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset();\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " next.style.pointerEvents='auto';\n", - " container.style.pointerEvents='auto';\n", - " /* container.tabIndex= 0; */\n", - " /* container.focus(); */\n", - " next.classList.remove('hide');\n", - " container.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(container.id);\n", - " }, {once: true });\n", - "\n", - "\n", - "}\n", - "\n", - "\n", - "function createOneCard (mydiv, frontCard, cards, cardnum) {\n", - " var colors=[\n", - " '--asparagus',\n", - " '--terra-cotta',\n", - " '--cyan-process'\n", - " ]\n", - "\n", - " var flipper = document.createElement('div');\n", - " if (frontCard){\n", - " flipper.className=\"flipper frontcard\"; \n", - " }\n", - " else {\n", - " flipper.className=\"flipper backcard\"; \n", - " }\n", - "\n", - " var front = document.createElement('div');\n", - " front.className='front flashcard';\n", - "\n", - " var frontSpan= document.createElement('span');\n", - " frontSpan.className='flashcardtext';\n", - " frontSpan.innerHTML=jaxify(cards[cardnum]['front']);\n", - " //frontSpan.textContent=jaxify(cards[cardnum]['front']);\n", - " front.style.background='var(' + colors[cardnum % colors.length] + ')';\n", - "\n", - "\n", - " front.append(frontSpan);\n", - " flipper.append(front);\n", - "\n", - " var back = document.createElement('div');\n", - " back.className='back flashcard';\n", - "\n", - " var backSpan= document.createElement('span');\n", - " backSpan.className='flashcardtext';\n", - " backSpan.innerHTML=jaxify(cards[cardnum]['back']);\n", - " back.append(backSpan);\n", - "\n", - " flipper.append(back);\n", - "\n", - " return flipper;\n", - "\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "function createCards(id, keyControl) {\n", - " console.log(id);\n", - " \n", - " var mydiv=document.getElementById(id);\n", - " /*mydiv.onclick = window.flipCard(mydiv);*/\n", - " /*\n", - " mydiv.addEventListener('click', function(){window.flipCard(mydiv);}, false);\n", - " mydiv.addEventListener('keydown', function(event){window.checkKey(mydiv,event);}, true);\n", - " */\n", - " mydiv.onclick = function(){window.flipCard(mydiv);};\n", - " console.log(keyControl);\n", - " if (keyControl == \"True\"){\n", - " mydiv.onkeydown = function(event){window.checkKey(mydiv,event);};\n", - " }\n", - " /* mydiv.addEventListener('keydown', function(event){event.stopPropagation(); console.log(event); event.preventDefault();}, true); */\n", - " /*mydiv.onkeypress = function(event){console.log(event); event.preventDefault();};*/\n", - "\n", - " console.log(mydiv);\n", - " \n", - " var cards=eval('cards'+id);\n", - " mydiv.dataset.cardnum=0;\n", - " mydiv.dataset.numCards=cards.length;\n", - " mydiv.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(id);\n", - " }, {once: true});\n", - "\n", - " var cardnum=0;\n", - " \n", - " for (var i=0; i<2; i++) {\n", - " \n", - " var flipper;\n", - " if (i==0){\n", - " flipper=createOneCard(mydiv, true, cards, cardnum);\n", - " }\n", - " else {\n", - " flipper=createOneCard(mydiv, false, cards, cardnum);\n", - " }\n", - "\n", - " mydiv.append(flipper);\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " if (typeof version == 'undefined') {\n", - " setTimeout(function(){\n", - " var version = MathJax.version;\n", - " console.log('After sleep, MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }, 500);\n", - " } else{\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " cardnum = (cardnum + 1) % mydiv.dataset.numCards;\n", - " }\n", - " mydiv.dataset.cardnum = cardnum;\n", - "\n", - " var next=document.getElementById(id+'-next');\n", - " if (cards.length==1) {\n", - " // Don't show next if no other cards!\n", - " next.style.pointerEvents='none';\n", - " next.classList.add('hide');\n", - " } else {\n", - " next.innerHTML=\"Next >\";\n", - " }\n", - "\n", - " mydiv.focus();\n", - "\n", - " return flipper;\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "var cardszqWGSgJDQtPI=[\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \"for i in \\{1..25\\}
do echo $i
done
\"\n", - " }\n", - "];\n", - " \n", - " createCards(\"zqWGSgJDQtPI\", \"True\");\n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from jupytercards import display_flashcards\n", "cards='/home/jupyter/flashcards/'\n", @@ -667,31 +21,7 @@ "source": [] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "tf2-gpu.2-8.m102", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/tf2-gpu.2-8:m102" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/GoogleCloud/quiz_files/quiz4-2.ipynb b/GoogleCloud/quiz_files/quiz4-2.ipynb index eb168de..a23a449 100644 --- a/GoogleCloud/quiz_files/quiz4-2.ipynb +++ b/GoogleCloud/quiz_files/quiz4-2.ipynb @@ -2,656 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "113fb089-7d61-481e-9473-f72bf2ed5371", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "/*!\n", - " * swiped-events.js - v1.1.4\n", - " * Pure JavaScript swipe events\n", - " * https://github.com/john-doherty/swiped-events\n", - " * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element\n", - " * @author John Doherty \n", - " * @license MIT\n", - " */\n", - "!function(t,e){\"use strict\";\"function\"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=e.createEvent(\"CustomEvent\");return a.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),a},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener(\"touchstart\",function(t){if(\"true\"===t.target.getAttribute(\"data-swipe-ignore\"))return;s=t.target,r=Date.now(),n=t.touches[0].clientX,a=t.touches[0].clientY,u=0,i=0},!1),e.addEventListener(\"touchmove\",function(t){if(!n||!a)return;var e=t.touches[0].clientX,r=t.touches[0].clientY;u=n-e,i=a-r},!1),e.addEventListener(\"touchend\",function(t){if(s!==t.target)return;var e=parseInt(l(s,\"data-swipe-threshold\",\"20\"),10),o=parseInt(l(s,\"data-swipe-timeout\",\"500\"),10),c=Date.now()-r,d=\"\",p=t.changedTouches||t.touches||[];Math.abs(u)>Math.abs(i)?Math.abs(u)>e&&c0?\"swiped-left\":\"swiped-right\"):Math.abs(i)>e&&c0?\"swiped-up\":\"swiped-down\");if(\"\"!==d){var b={dir:d.replace(/swiped-/,\"\"),xStart:parseInt(n,10),xEnd:parseInt((p[0]||{}).clientX||-1,10),yStart:parseInt(a,10),yEnd:parseInt((p[0]||{}).clientY||-1,10)};s.dispatchEvent(new CustomEvent(\"swiped\",{bubbles:!0,cancelable:!0,detail:b})),s.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:b}))}n=null,a=null,r=null},!1);var n=null,a=null,u=null,i=null,r=null,s=null;function l(t,n,a){for(;t&&t!==e.documentElement;){var u=t.getAttribute(n);if(u)return u;t=t.parentNode}return a}}(window,document);\n", - "\n", - "function jaxify(string) {\n", - " var mystring = string;\n", - " console.log(mystring);\n", - "\n", - " var count = 0;\n", - " var loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - "\n", - " var count2 = 0;\n", - " var loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - "\n", - " //console.log(loc);\n", - "\n", - " while ((loc >= 0) || (loc2 >= 0)) {\n", - "\n", - " /* Have to replace all the double $$ first with current implementation */\n", - " if (loc2 >= 0) {\n", - " if (count2 % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\[\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\]\");\n", - " }\n", - " count2++;\n", - " } else {\n", - " if (count % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\(\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\)\");\n", - " }\n", - " count++;\n", - " }\n", - " loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - " loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - " //console.log(mystring,\", loc:\",loc,\", loc2:\",loc2);\n", - " }\n", - "\n", - " //console.log(mystring);\n", - " return mystring;\n", - "}\n", - "\n", - "window.flipCard = function flipCard(ths) {\n", - " console.log(ths);\n", - " console.log(ths.id);\n", - " ths.classList.toggle(\"flip\"); \n", - " var next=document.getElementById(ths.id+'-next');\n", - " next.style.pointerEvents='none';\n", - " /* ths.blur(); */\n", - " next.classList.add('flipped');\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([ths]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " setTimeout(reenableNext, 600, ths, next);\n", - "}\n", - "\n", - "window.checkKey = function checkKey(container, event) {\n", - " event.stopPropagation();\n", - " /*\n", - " console.log(container);\n", - " console.log(event.key);\n", - " console.log(event.code);\n", - " */\n", - " /* JMS: Working here*/\n", - " var next=document.getElementById(container.id+'-next');\n", - " /* Only react if not already sliding */\n", - " if (! next.classList.contains(\"hide\")) {\n", - " if ((event.key == \"j\") || (event.key == \"Enter\") || (event.key == \"ArrowRight\")) {\n", - " window.checkFlip(container.id);\n", - " }\n", - " if (event.key == \" \") {\n", - " window.flipCard(container);\n", - " }\n", - " }\n", - " event.preventDefault();\n", - "}\n", - "\n", - "\n", - "function reenableNext(ths, next) {\n", - " next.style.pointerEvents='auto';\n", - " /* ths.tabIndex= 0;*/\n", - " /* ths.focus(); */\n", - "}\n", - "\n", - "\n", - "\n", - "function slide2(containerId) {\n", - " var container = document.getElementById(containerId);\n", - " var next=document.getElementById(containerId+'-next');\n", - " var frontcard = container.children[0];\n", - " var backcard = container.children[1];\n", - " container.style.pointerEvents='none';\n", - " /* container.removeAttribute(\"tabindex\");*/\n", - " /* container.blur(); */\n", - " //backcard.style.pointerEvents='none';\n", - " next.style.pointerEvents='none';\n", - " next.classList.remove('flipped');\n", - " next.classList.add('hide');\n", - "\n", - " //container.classList.add(\"prepare\");\n", - " \n", - " container.className=\"flip-container slide\";\n", - " backcard.parentElement.removeChild(frontcard);\n", - " backcard.parentElement.appendChild(frontcard);\n", - " setTimeout(slideback, 600, container, frontcard, backcard, next);\n", - " \n", - "}\n", - "\n", - "\n", - "window.checkFlip = function checkFlip(containerId) {\n", - " var container = document.getElementById(containerId);\n", - "\n", - "\n", - " if (container.classList.contains('flip')) {\n", - " container.classList.remove('flip');\n", - " setTimeout(slide2, 600, containerId);\n", - " } \n", - " else {\n", - " slide2(containerId);\n", - " }\n", - "}\n", - "\n", - "\n", - "function slideback(container, frontcard, backcard, next) {\n", - " container.className=\"flip-container slideback\";\n", - " setTimeout(cleanup, 550, container, frontcard, backcard, next);\n", - "}\n", - "\n", - "function cleanup(container, frontcard, backcard, next) {\n", - " container.removeChild(frontcard);\n", - " backcard.className=\"flipper frontcard\";\n", - " container.className=\"flip-container\";\n", - "\n", - " var cardnum=parseInt(container.dataset.cardnum);\n", - " var cards=eval('cards'+container.id);\n", - " var flipper=createOneCard(container, false, cards, cardnum);\n", - " container.append(flipper);\n", - " cardnum= (cardnum+1) % parseInt(container.dataset.numCards);\n", - " container.dataset.cardnum=cardnum;\n", - " if (cardnum != 1){\n", - " next.innerHTML=\"Next >\";\n", - " } else {\n", - " //next.innerHTML=\"Reload \\\\(\\\\circlearrowleft\\\\) \";\n", - " next.innerHTML='Reload '\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([next]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " }\n", - "\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset();\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " next.style.pointerEvents='auto';\n", - " container.style.pointerEvents='auto';\n", - " /* container.tabIndex= 0; */\n", - " /* container.focus(); */\n", - " next.classList.remove('hide');\n", - " container.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(container.id);\n", - " }, {once: true });\n", - "\n", - "\n", - "}\n", - "\n", - "\n", - "function createOneCard (mydiv, frontCard, cards, cardnum) {\n", - " var colors=[\n", - " '--asparagus',\n", - " '--terra-cotta',\n", - " '--cyan-process'\n", - " ]\n", - "\n", - " var flipper = document.createElement('div');\n", - " if (frontCard){\n", - " flipper.className=\"flipper frontcard\"; \n", - " }\n", - " else {\n", - " flipper.className=\"flipper backcard\"; \n", - " }\n", - "\n", - " var front = document.createElement('div');\n", - " front.className='front flashcard';\n", - "\n", - " var frontSpan= document.createElement('span');\n", - " frontSpan.className='flashcardtext';\n", - " frontSpan.innerHTML=jaxify(cards[cardnum]['front']);\n", - " //frontSpan.textContent=jaxify(cards[cardnum]['front']);\n", - " front.style.background='var(' + colors[cardnum % colors.length] + ')';\n", - "\n", - "\n", - " front.append(frontSpan);\n", - " flipper.append(front);\n", - "\n", - " var back = document.createElement('div');\n", - " back.className='back flashcard';\n", - "\n", - " var backSpan= document.createElement('span');\n", - " backSpan.className='flashcardtext';\n", - " backSpan.innerHTML=jaxify(cards[cardnum]['back']);\n", - " back.append(backSpan);\n", - "\n", - " flipper.append(back);\n", - "\n", - " return flipper;\n", - "\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "function createCards(id, keyControl) {\n", - " console.log(id);\n", - " \n", - " var mydiv=document.getElementById(id);\n", - " /*mydiv.onclick = window.flipCard(mydiv);*/\n", - " /*\n", - " mydiv.addEventListener('click', function(){window.flipCard(mydiv);}, false);\n", - " mydiv.addEventListener('keydown', function(event){window.checkKey(mydiv,event);}, true);\n", - " */\n", - " mydiv.onclick = function(){window.flipCard(mydiv);};\n", - " console.log(keyControl);\n", - " if (keyControl == \"True\"){\n", - " mydiv.onkeydown = function(event){window.checkKey(mydiv,event);};\n", - " }\n", - " /* mydiv.addEventListener('keydown', function(event){event.stopPropagation(); console.log(event); event.preventDefault();}, true); */\n", - " /*mydiv.onkeypress = function(event){console.log(event); event.preventDefault();};*/\n", - "\n", - " console.log(mydiv);\n", - " \n", - " var cards=eval('cards'+id);\n", - " mydiv.dataset.cardnum=0;\n", - " mydiv.dataset.numCards=cards.length;\n", - " mydiv.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(id);\n", - " }, {once: true});\n", - "\n", - " var cardnum=0;\n", - " \n", - " for (var i=0; i<2; i++) {\n", - " \n", - " var flipper;\n", - " if (i==0){\n", - " flipper=createOneCard(mydiv, true, cards, cardnum);\n", - " }\n", - " else {\n", - " flipper=createOneCard(mydiv, false, cards, cardnum);\n", - " }\n", - "\n", - " mydiv.append(flipper);\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " if (typeof version == 'undefined') {\n", - " setTimeout(function(){\n", - " var version = MathJax.version;\n", - " console.log('After sleep, MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }, 500);\n", - " } else{\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " cardnum = (cardnum + 1) % mydiv.dataset.numCards;\n", - " }\n", - " mydiv.dataset.cardnum = cardnum;\n", - "\n", - " var next=document.getElementById(id+'-next');\n", - " if (cards.length==1) {\n", - " // Don't show next if no other cards!\n", - " next.style.pointerEvents='none';\n", - " next.classList.add('hide');\n", - " } else {\n", - " next.innerHTML=\"Next >\";\n", - " }\n", - "\n", - " mydiv.focus();\n", - "\n", - " return flipper;\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "var cardsIXBZndvaGdYK=[\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \"The redirect command will replace the result each time the loop is run and the final file will have only a single result.\"\n", - " }\n", - "];\n", - " \n", - " createCards(\"IXBZndvaGdYK\", \"True\");\n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from jupytercards import display_flashcards\n", "cards='/home/jupyter/flashcards/'\n", @@ -659,31 +13,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "tf2-gpu.2-8.m102", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/tf2-gpu.2-8:m102" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/GoogleCloud/quiz_files/quiz5-1.ipynb b/GoogleCloud/quiz_files/quiz5-1.ipynb index eba1688..cf9d6fc 100644 --- a/GoogleCloud/quiz_files/quiz5-1.ipynb +++ b/GoogleCloud/quiz_files/quiz5-1.ipynb @@ -2,660 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "113fb089-7d61-481e-9473-f72bf2ed5371", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "/*!\n", - " * swiped-events.js - v1.1.4\n", - " * Pure JavaScript swipe events\n", - " * https://github.com/john-doherty/swiped-events\n", - " * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element\n", - " * @author John Doherty \n", - " * @license MIT\n", - " */\n", - "!function(t,e){\"use strict\";\"function\"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=e.createEvent(\"CustomEvent\");return a.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),a},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener(\"touchstart\",function(t){if(\"true\"===t.target.getAttribute(\"data-swipe-ignore\"))return;s=t.target,r=Date.now(),n=t.touches[0].clientX,a=t.touches[0].clientY,u=0,i=0},!1),e.addEventListener(\"touchmove\",function(t){if(!n||!a)return;var e=t.touches[0].clientX,r=t.touches[0].clientY;u=n-e,i=a-r},!1),e.addEventListener(\"touchend\",function(t){if(s!==t.target)return;var e=parseInt(l(s,\"data-swipe-threshold\",\"20\"),10),o=parseInt(l(s,\"data-swipe-timeout\",\"500\"),10),c=Date.now()-r,d=\"\",p=t.changedTouches||t.touches||[];Math.abs(u)>Math.abs(i)?Math.abs(u)>e&&c0?\"swiped-left\":\"swiped-right\"):Math.abs(i)>e&&c0?\"swiped-up\":\"swiped-down\");if(\"\"!==d){var b={dir:d.replace(/swiped-/,\"\"),xStart:parseInt(n,10),xEnd:parseInt((p[0]||{}).clientX||-1,10),yStart:parseInt(a,10),yEnd:parseInt((p[0]||{}).clientY||-1,10)};s.dispatchEvent(new CustomEvent(\"swiped\",{bubbles:!0,cancelable:!0,detail:b})),s.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:b}))}n=null,a=null,r=null},!1);var n=null,a=null,u=null,i=null,r=null,s=null;function l(t,n,a){for(;t&&t!==e.documentElement;){var u=t.getAttribute(n);if(u)return u;t=t.parentNode}return a}}(window,document);\n", - "\n", - "function jaxify(string) {\n", - " var mystring = string;\n", - " console.log(mystring);\n", - "\n", - " var count = 0;\n", - " var loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - "\n", - " var count2 = 0;\n", - " var loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - "\n", - " //console.log(loc);\n", - "\n", - " while ((loc >= 0) || (loc2 >= 0)) {\n", - "\n", - " /* Have to replace all the double $$ first with current implementation */\n", - " if (loc2 >= 0) {\n", - " if (count2 % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\[\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\]\");\n", - " }\n", - " count2++;\n", - " } else {\n", - " if (count % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\(\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\)\");\n", - " }\n", - " count++;\n", - " }\n", - " loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - " loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - " //console.log(mystring,\", loc:\",loc,\", loc2:\",loc2);\n", - " }\n", - "\n", - " //console.log(mystring);\n", - " return mystring;\n", - "}\n", - "\n", - "window.flipCard = function flipCard(ths) {\n", - " console.log(ths);\n", - " console.log(ths.id);\n", - " ths.classList.toggle(\"flip\"); \n", - " var next=document.getElementById(ths.id+'-next');\n", - " next.style.pointerEvents='none';\n", - " /* ths.blur(); */\n", - " next.classList.add('flipped');\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([ths]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " setTimeout(reenableNext, 600, ths, next);\n", - "}\n", - "\n", - "window.checkKey = function checkKey(container, event) {\n", - " event.stopPropagation();\n", - " /*\n", - " console.log(container);\n", - " console.log(event.key);\n", - " console.log(event.code);\n", - " */\n", - " /* JMS: Working here*/\n", - " var next=document.getElementById(container.id+'-next');\n", - " /* Only react if not already sliding */\n", - " if (! next.classList.contains(\"hide\")) {\n", - " if ((event.key == \"j\") || (event.key == \"Enter\") || (event.key == \"ArrowRight\")) {\n", - " window.checkFlip(container.id);\n", - " }\n", - " if (event.key == \" \") {\n", - " window.flipCard(container);\n", - " }\n", - " }\n", - " event.preventDefault();\n", - "}\n", - "\n", - "\n", - "function reenableNext(ths, next) {\n", - " next.style.pointerEvents='auto';\n", - " /* ths.tabIndex= 0;*/\n", - " /* ths.focus(); */\n", - "}\n", - "\n", - "\n", - "\n", - "function slide2(containerId) {\n", - " var container = document.getElementById(containerId);\n", - " var next=document.getElementById(containerId+'-next');\n", - " var frontcard = container.children[0];\n", - " var backcard = container.children[1];\n", - " container.style.pointerEvents='none';\n", - " /* container.removeAttribute(\"tabindex\");*/\n", - " /* container.blur(); */\n", - " //backcard.style.pointerEvents='none';\n", - " next.style.pointerEvents='none';\n", - " next.classList.remove('flipped');\n", - " next.classList.add('hide');\n", - "\n", - " //container.classList.add(\"prepare\");\n", - " \n", - " container.className=\"flip-container slide\";\n", - " backcard.parentElement.removeChild(frontcard);\n", - " backcard.parentElement.appendChild(frontcard);\n", - " setTimeout(slideback, 600, container, frontcard, backcard, next);\n", - " \n", - "}\n", - "\n", - "\n", - "window.checkFlip = function checkFlip(containerId) {\n", - " var container = document.getElementById(containerId);\n", - "\n", - "\n", - " if (container.classList.contains('flip')) {\n", - " container.classList.remove('flip');\n", - " setTimeout(slide2, 600, containerId);\n", - " } \n", - " else {\n", - " slide2(containerId);\n", - " }\n", - "}\n", - "\n", - "\n", - "function slideback(container, frontcard, backcard, next) {\n", - " container.className=\"flip-container slideback\";\n", - " setTimeout(cleanup, 550, container, frontcard, backcard, next);\n", - "}\n", - "\n", - "function cleanup(container, frontcard, backcard, next) {\n", - " container.removeChild(frontcard);\n", - " backcard.className=\"flipper frontcard\";\n", - " container.className=\"flip-container\";\n", - "\n", - " var cardnum=parseInt(container.dataset.cardnum);\n", - " var cards=eval('cards'+container.id);\n", - " var flipper=createOneCard(container, false, cards, cardnum);\n", - " container.append(flipper);\n", - " cardnum= (cardnum+1) % parseInt(container.dataset.numCards);\n", - " container.dataset.cardnum=cardnum;\n", - " if (cardnum != 1){\n", - " next.innerHTML=\"Next >\";\n", - " } else {\n", - " //next.innerHTML=\"Reload \\\\(\\\\circlearrowleft\\\\) \";\n", - " next.innerHTML='Reload '\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([next]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " }\n", - "\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset();\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " next.style.pointerEvents='auto';\n", - " container.style.pointerEvents='auto';\n", - " /* container.tabIndex= 0; */\n", - " /* container.focus(); */\n", - " next.classList.remove('hide');\n", - " container.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(container.id);\n", - " }, {once: true });\n", - "\n", - "\n", - "}\n", - "\n", - "\n", - "function createOneCard (mydiv, frontCard, cards, cardnum) {\n", - " var colors=[\n", - " '--asparagus',\n", - " '--terra-cotta',\n", - " '--cyan-process'\n", - " ]\n", - "\n", - " var flipper = document.createElement('div');\n", - " if (frontCard){\n", - " flipper.className=\"flipper frontcard\"; \n", - " }\n", - " else {\n", - " flipper.className=\"flipper backcard\"; \n", - " }\n", - "\n", - " var front = document.createElement('div');\n", - " front.className='front flashcard';\n", - "\n", - " var frontSpan= document.createElement('span');\n", - " frontSpan.className='flashcardtext';\n", - " frontSpan.innerHTML=jaxify(cards[cardnum]['front']);\n", - " //frontSpan.textContent=jaxify(cards[cardnum]['front']);\n", - " front.style.background='var(' + colors[cardnum % colors.length] + ')';\n", - "\n", - "\n", - " front.append(frontSpan);\n", - " flipper.append(front);\n", - "\n", - " var back = document.createElement('div');\n", - " back.className='back flashcard';\n", - "\n", - " var backSpan= document.createElement('span');\n", - " backSpan.className='flashcardtext';\n", - " backSpan.innerHTML=jaxify(cards[cardnum]['back']);\n", - " back.append(backSpan);\n", - "\n", - " flipper.append(back);\n", - "\n", - " return flipper;\n", - "\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "function createCards(id, keyControl) {\n", - " console.log(id);\n", - " \n", - " var mydiv=document.getElementById(id);\n", - " /*mydiv.onclick = window.flipCard(mydiv);*/\n", - " /*\n", - " mydiv.addEventListener('click', function(){window.flipCard(mydiv);}, false);\n", - " mydiv.addEventListener('keydown', function(event){window.checkKey(mydiv,event);}, true);\n", - " */\n", - " mydiv.onclick = function(){window.flipCard(mydiv);};\n", - " console.log(keyControl);\n", - " if (keyControl == \"True\"){\n", - " mydiv.onkeydown = function(event){window.checkKey(mydiv,event);};\n", - " }\n", - " /* mydiv.addEventListener('keydown', function(event){event.stopPropagation(); console.log(event); event.preventDefault();}, true); */\n", - " /*mydiv.onkeypress = function(event){console.log(event); event.preventDefault();};*/\n", - "\n", - " console.log(mydiv);\n", - " \n", - " var cards=eval('cards'+id);\n", - " mydiv.dataset.cardnum=0;\n", - " mydiv.dataset.numCards=cards.length;\n", - " mydiv.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(id);\n", - " }, {once: true});\n", - "\n", - " var cardnum=0;\n", - " \n", - " for (var i=0; i<2; i++) {\n", - " \n", - " var flipper;\n", - " if (i==0){\n", - " flipper=createOneCard(mydiv, true, cards, cardnum);\n", - " }\n", - " else {\n", - " flipper=createOneCard(mydiv, false, cards, cardnum);\n", - " }\n", - "\n", - " mydiv.append(flipper);\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " if (typeof version == 'undefined') {\n", - " setTimeout(function(){\n", - " var version = MathJax.version;\n", - " console.log('After sleep, MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }, 500);\n", - " } else{\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " cardnum = (cardnum + 1) % mydiv.dataset.numCards;\n", - " }\n", - " mydiv.dataset.cardnum = cardnum;\n", - "\n", - " var next=document.getElementById(id+'-next');\n", - " if (cards.length==1) {\n", - " // Don't show next if no other cards!\n", - " next.style.pointerEvents='none';\n", - " next.classList.add('hide');\n", - " } else {\n", - " next.innerHTML=\"Next >\";\n", - " }\n", - "\n", - " mydiv.focus();\n", - "\n", - " return flipper;\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "var cardsXukImPnoZdMs=[\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \"ls gcp_research_workflow/*.fastq.gz | while read x
do fastqc -t 4 -o fastqc $x
done\"\n", - " },\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \"Multithreading within the loop doesn't speed up the analysis because only one file is considered in each cycle of the loop.\"\n", - " }\n", - "];\n", - " \n", - " createCards(\"XukImPnoZdMs\", \"True\");\n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from jupytercards import display_flashcards\n", "cards='/home/jupyter/flashcards/'\n", @@ -663,31 +13,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "tf2-gpu.2-8.m102", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/tf2-gpu.2-8:m102" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/GoogleCloud/quiz_files/quiz6-1.ipynb b/GoogleCloud/quiz_files/quiz6-1.ipynb index ecaa904..c05b243 100644 --- a/GoogleCloud/quiz_files/quiz6-1.ipynb +++ b/GoogleCloud/quiz_files/quiz6-1.ipynb @@ -2,656 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "113fb089-7d61-481e-9473-f72bf2ed5371", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "/*!\n", - " * swiped-events.js - v1.1.4\n", - " * Pure JavaScript swipe events\n", - " * https://github.com/john-doherty/swiped-events\n", - " * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element\n", - " * @author John Doherty \n", - " * @license MIT\n", - " */\n", - "!function(t,e){\"use strict\";\"function\"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=e.createEvent(\"CustomEvent\");return a.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),a},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener(\"touchstart\",function(t){if(\"true\"===t.target.getAttribute(\"data-swipe-ignore\"))return;s=t.target,r=Date.now(),n=t.touches[0].clientX,a=t.touches[0].clientY,u=0,i=0},!1),e.addEventListener(\"touchmove\",function(t){if(!n||!a)return;var e=t.touches[0].clientX,r=t.touches[0].clientY;u=n-e,i=a-r},!1),e.addEventListener(\"touchend\",function(t){if(s!==t.target)return;var e=parseInt(l(s,\"data-swipe-threshold\",\"20\"),10),o=parseInt(l(s,\"data-swipe-timeout\",\"500\"),10),c=Date.now()-r,d=\"\",p=t.changedTouches||t.touches||[];Math.abs(u)>Math.abs(i)?Math.abs(u)>e&&c0?\"swiped-left\":\"swiped-right\"):Math.abs(i)>e&&c0?\"swiped-up\":\"swiped-down\");if(\"\"!==d){var b={dir:d.replace(/swiped-/,\"\"),xStart:parseInt(n,10),xEnd:parseInt((p[0]||{}).clientX||-1,10),yStart:parseInt(a,10),yEnd:parseInt((p[0]||{}).clientY||-1,10)};s.dispatchEvent(new CustomEvent(\"swiped\",{bubbles:!0,cancelable:!0,detail:b})),s.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:b}))}n=null,a=null,r=null},!1);var n=null,a=null,u=null,i=null,r=null,s=null;function l(t,n,a){for(;t&&t!==e.documentElement;){var u=t.getAttribute(n);if(u)return u;t=t.parentNode}return a}}(window,document);\n", - "\n", - "function jaxify(string) {\n", - " var mystring = string;\n", - " console.log(mystring);\n", - "\n", - " var count = 0;\n", - " var loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - "\n", - " var count2 = 0;\n", - " var loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - "\n", - " //console.log(loc);\n", - "\n", - " while ((loc >= 0) || (loc2 >= 0)) {\n", - "\n", - " /* Have to replace all the double $$ first with current implementation */\n", - " if (loc2 >= 0) {\n", - " if (count2 % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\[\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\]\");\n", - " }\n", - " count2++;\n", - " } else {\n", - " if (count % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\(\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\)\");\n", - " }\n", - " count++;\n", - " }\n", - " loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - " loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - " //console.log(mystring,\", loc:\",loc,\", loc2:\",loc2);\n", - " }\n", - "\n", - " //console.log(mystring);\n", - " return mystring;\n", - "}\n", - "\n", - "window.flipCard = function flipCard(ths) {\n", - " console.log(ths);\n", - " console.log(ths.id);\n", - " ths.classList.toggle(\"flip\"); \n", - " var next=document.getElementById(ths.id+'-next');\n", - " next.style.pointerEvents='none';\n", - " /* ths.blur(); */\n", - " next.classList.add('flipped');\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([ths]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " setTimeout(reenableNext, 600, ths, next);\n", - "}\n", - "\n", - "window.checkKey = function checkKey(container, event) {\n", - " event.stopPropagation();\n", - " /*\n", - " console.log(container);\n", - " console.log(event.key);\n", - " console.log(event.code);\n", - " */\n", - " /* JMS: Working here*/\n", - " var next=document.getElementById(container.id+'-next');\n", - " /* Only react if not already sliding */\n", - " if (! next.classList.contains(\"hide\")) {\n", - " if ((event.key == \"j\") || (event.key == \"Enter\") || (event.key == \"ArrowRight\")) {\n", - " window.checkFlip(container.id);\n", - " }\n", - " if (event.key == \" \") {\n", - " window.flipCard(container);\n", - " }\n", - " }\n", - " event.preventDefault();\n", - "}\n", - "\n", - "\n", - "function reenableNext(ths, next) {\n", - " next.style.pointerEvents='auto';\n", - " /* ths.tabIndex= 0;*/\n", - " /* ths.focus(); */\n", - "}\n", - "\n", - "\n", - "\n", - "function slide2(containerId) {\n", - " var container = document.getElementById(containerId);\n", - " var next=document.getElementById(containerId+'-next');\n", - " var frontcard = container.children[0];\n", - " var backcard = container.children[1];\n", - " container.style.pointerEvents='none';\n", - " /* container.removeAttribute(\"tabindex\");*/\n", - " /* container.blur(); */\n", - " //backcard.style.pointerEvents='none';\n", - " next.style.pointerEvents='none';\n", - " next.classList.remove('flipped');\n", - " next.classList.add('hide');\n", - "\n", - " //container.classList.add(\"prepare\");\n", - " \n", - " container.className=\"flip-container slide\";\n", - " backcard.parentElement.removeChild(frontcard);\n", - " backcard.parentElement.appendChild(frontcard);\n", - " setTimeout(slideback, 600, container, frontcard, backcard, next);\n", - " \n", - "}\n", - "\n", - "\n", - "window.checkFlip = function checkFlip(containerId) {\n", - " var container = document.getElementById(containerId);\n", - "\n", - "\n", - " if (container.classList.contains('flip')) {\n", - " container.classList.remove('flip');\n", - " setTimeout(slide2, 600, containerId);\n", - " } \n", - " else {\n", - " slide2(containerId);\n", - " }\n", - "}\n", - "\n", - "\n", - "function slideback(container, frontcard, backcard, next) {\n", - " container.className=\"flip-container slideback\";\n", - " setTimeout(cleanup, 550, container, frontcard, backcard, next);\n", - "}\n", - "\n", - "function cleanup(container, frontcard, backcard, next) {\n", - " container.removeChild(frontcard);\n", - " backcard.className=\"flipper frontcard\";\n", - " container.className=\"flip-container\";\n", - "\n", - " var cardnum=parseInt(container.dataset.cardnum);\n", - " var cards=eval('cards'+container.id);\n", - " var flipper=createOneCard(container, false, cards, cardnum);\n", - " container.append(flipper);\n", - " cardnum= (cardnum+1) % parseInt(container.dataset.numCards);\n", - " container.dataset.cardnum=cardnum;\n", - " if (cardnum != 1){\n", - " next.innerHTML=\"Next >\";\n", - " } else {\n", - " //next.innerHTML=\"Reload \\\\(\\\\circlearrowleft\\\\) \";\n", - " next.innerHTML='Reload '\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([next]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " }\n", - "\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset();\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " next.style.pointerEvents='auto';\n", - " container.style.pointerEvents='auto';\n", - " /* container.tabIndex= 0; */\n", - " /* container.focus(); */\n", - " next.classList.remove('hide');\n", - " container.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(container.id);\n", - " }, {once: true });\n", - "\n", - "\n", - "}\n", - "\n", - "\n", - "function createOneCard (mydiv, frontCard, cards, cardnum) {\n", - " var colors=[\n", - " '--asparagus',\n", - " '--terra-cotta',\n", - " '--cyan-process'\n", - " ]\n", - "\n", - " var flipper = document.createElement('div');\n", - " if (frontCard){\n", - " flipper.className=\"flipper frontcard\"; \n", - " }\n", - " else {\n", - " flipper.className=\"flipper backcard\"; \n", - " }\n", - "\n", - " var front = document.createElement('div');\n", - " front.className='front flashcard';\n", - "\n", - " var frontSpan= document.createElement('span');\n", - " frontSpan.className='flashcardtext';\n", - " frontSpan.innerHTML=jaxify(cards[cardnum]['front']);\n", - " //frontSpan.textContent=jaxify(cards[cardnum]['front']);\n", - " front.style.background='var(' + colors[cardnum % colors.length] + ')';\n", - "\n", - "\n", - " front.append(frontSpan);\n", - " flipper.append(front);\n", - "\n", - " var back = document.createElement('div');\n", - " back.className='back flashcard';\n", - "\n", - " var backSpan= document.createElement('span');\n", - " backSpan.className='flashcardtext';\n", - " backSpan.innerHTML=jaxify(cards[cardnum]['back']);\n", - " back.append(backSpan);\n", - "\n", - " flipper.append(back);\n", - "\n", - " return flipper;\n", - "\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "function createCards(id, keyControl) {\n", - " console.log(id);\n", - " \n", - " var mydiv=document.getElementById(id);\n", - " /*mydiv.onclick = window.flipCard(mydiv);*/\n", - " /*\n", - " mydiv.addEventListener('click', function(){window.flipCard(mydiv);}, false);\n", - " mydiv.addEventListener('keydown', function(event){window.checkKey(mydiv,event);}, true);\n", - " */\n", - " mydiv.onclick = function(){window.flipCard(mydiv);};\n", - " console.log(keyControl);\n", - " if (keyControl == \"True\"){\n", - " mydiv.onkeydown = function(event){window.checkKey(mydiv,event);};\n", - " }\n", - " /* mydiv.addEventListener('keydown', function(event){event.stopPropagation(); console.log(event); event.preventDefault();}, true); */\n", - " /*mydiv.onkeypress = function(event){console.log(event); event.preventDefault();};*/\n", - "\n", - " console.log(mydiv);\n", - " \n", - " var cards=eval('cards'+id);\n", - " mydiv.dataset.cardnum=0;\n", - " mydiv.dataset.numCards=cards.length;\n", - " mydiv.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(id);\n", - " }, {once: true});\n", - "\n", - " var cardnum=0;\n", - " \n", - " for (var i=0; i<2; i++) {\n", - " \n", - " var flipper;\n", - " if (i==0){\n", - " flipper=createOneCard(mydiv, true, cards, cardnum);\n", - " }\n", - " else {\n", - " flipper=createOneCard(mydiv, false, cards, cardnum);\n", - " }\n", - "\n", - " mydiv.append(flipper);\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " if (typeof version == 'undefined') {\n", - " setTimeout(function(){\n", - " var version = MathJax.version;\n", - " console.log('After sleep, MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }, 500);\n", - " } else{\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " cardnum = (cardnum + 1) % mydiv.dataset.numCards;\n", - " }\n", - " mydiv.dataset.cardnum = cardnum;\n", - "\n", - " var next=document.getElementById(id+'-next');\n", - " if (cards.length==1) {\n", - " // Don't show next if no other cards!\n", - " next.style.pointerEvents='none';\n", - " next.classList.add('hide');\n", - " } else {\n", - " next.innerHTML=\"Next >\";\n", - " }\n", - "\n", - " mydiv.focus();\n", - "\n", - " return flipper;\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "var cardsUoSThogulCCq=[\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \"ls assembly_test/*.fastq | while read x
do fastqc -o assembly_test $x
done\"\n", - " }\n", - "];\n", - " \n", - " createCards(\"UoSThogulCCq\", \"True\");\n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from jupytercards import display_flashcards\n", "cards='/home/jupyter/flashcards/'\n", @@ -659,31 +13,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "tf2-gpu.2-8.m102", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/tf2-gpu.2-8:m102" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/GoogleCloud/quiz_files/quiz6-2.ipynb b/GoogleCloud/quiz_files/quiz6-2.ipynb index 30861c0..0b8e9f8 100644 --- a/GoogleCloud/quiz_files/quiz6-2.ipynb +++ b/GoogleCloud/quiz_files/quiz6-2.ipynb @@ -2,656 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "113fb089-7d61-481e-9473-f72bf2ed5371", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "/*!\n", - " * swiped-events.js - v1.1.4\n", - " * Pure JavaScript swipe events\n", - " * https://github.com/john-doherty/swiped-events\n", - " * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element\n", - " * @author John Doherty \n", - " * @license MIT\n", - " */\n", - "!function(t,e){\"use strict\";\"function\"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=e.createEvent(\"CustomEvent\");return a.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),a},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener(\"touchstart\",function(t){if(\"true\"===t.target.getAttribute(\"data-swipe-ignore\"))return;s=t.target,r=Date.now(),n=t.touches[0].clientX,a=t.touches[0].clientY,u=0,i=0},!1),e.addEventListener(\"touchmove\",function(t){if(!n||!a)return;var e=t.touches[0].clientX,r=t.touches[0].clientY;u=n-e,i=a-r},!1),e.addEventListener(\"touchend\",function(t){if(s!==t.target)return;var e=parseInt(l(s,\"data-swipe-threshold\",\"20\"),10),o=parseInt(l(s,\"data-swipe-timeout\",\"500\"),10),c=Date.now()-r,d=\"\",p=t.changedTouches||t.touches||[];Math.abs(u)>Math.abs(i)?Math.abs(u)>e&&c0?\"swiped-left\":\"swiped-right\"):Math.abs(i)>e&&c0?\"swiped-up\":\"swiped-down\");if(\"\"!==d){var b={dir:d.replace(/swiped-/,\"\"),xStart:parseInt(n,10),xEnd:parseInt((p[0]||{}).clientX||-1,10),yStart:parseInt(a,10),yEnd:parseInt((p[0]||{}).clientY||-1,10)};s.dispatchEvent(new CustomEvent(\"swiped\",{bubbles:!0,cancelable:!0,detail:b})),s.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:b}))}n=null,a=null,r=null},!1);var n=null,a=null,u=null,i=null,r=null,s=null;function l(t,n,a){for(;t&&t!==e.documentElement;){var u=t.getAttribute(n);if(u)return u;t=t.parentNode}return a}}(window,document);\n", - "\n", - "function jaxify(string) {\n", - " var mystring = string;\n", - " console.log(mystring);\n", - "\n", - " var count = 0;\n", - " var loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - "\n", - " var count2 = 0;\n", - " var loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - "\n", - " //console.log(loc);\n", - "\n", - " while ((loc >= 0) || (loc2 >= 0)) {\n", - "\n", - " /* Have to replace all the double $$ first with current implementation */\n", - " if (loc2 >= 0) {\n", - " if (count2 % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\[\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\]\");\n", - " }\n", - " count2++;\n", - " } else {\n", - " if (count % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\(\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\)\");\n", - " }\n", - " count++;\n", - " }\n", - " loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - " loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - " //console.log(mystring,\", loc:\",loc,\", loc2:\",loc2);\n", - " }\n", - "\n", - " //console.log(mystring);\n", - " return mystring;\n", - "}\n", - "\n", - "window.flipCard = function flipCard(ths) {\n", - " console.log(ths);\n", - " console.log(ths.id);\n", - " ths.classList.toggle(\"flip\"); \n", - " var next=document.getElementById(ths.id+'-next');\n", - " next.style.pointerEvents='none';\n", - " /* ths.blur(); */\n", - " next.classList.add('flipped');\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([ths]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " setTimeout(reenableNext, 600, ths, next);\n", - "}\n", - "\n", - "window.checkKey = function checkKey(container, event) {\n", - " event.stopPropagation();\n", - " /*\n", - " console.log(container);\n", - " console.log(event.key);\n", - " console.log(event.code);\n", - " */\n", - " /* JMS: Working here*/\n", - " var next=document.getElementById(container.id+'-next');\n", - " /* Only react if not already sliding */\n", - " if (! next.classList.contains(\"hide\")) {\n", - " if ((event.key == \"j\") || (event.key == \"Enter\") || (event.key == \"ArrowRight\")) {\n", - " window.checkFlip(container.id);\n", - " }\n", - " if (event.key == \" \") {\n", - " window.flipCard(container);\n", - " }\n", - " }\n", - " event.preventDefault();\n", - "}\n", - "\n", - "\n", - "function reenableNext(ths, next) {\n", - " next.style.pointerEvents='auto';\n", - " /* ths.tabIndex= 0;*/\n", - " /* ths.focus(); */\n", - "}\n", - "\n", - "\n", - "\n", - "function slide2(containerId) {\n", - " var container = document.getElementById(containerId);\n", - " var next=document.getElementById(containerId+'-next');\n", - " var frontcard = container.children[0];\n", - " var backcard = container.children[1];\n", - " container.style.pointerEvents='none';\n", - " /* container.removeAttribute(\"tabindex\");*/\n", - " /* container.blur(); */\n", - " //backcard.style.pointerEvents='none';\n", - " next.style.pointerEvents='none';\n", - " next.classList.remove('flipped');\n", - " next.classList.add('hide');\n", - "\n", - " //container.classList.add(\"prepare\");\n", - " \n", - " container.className=\"flip-container slide\";\n", - " backcard.parentElement.removeChild(frontcard);\n", - " backcard.parentElement.appendChild(frontcard);\n", - " setTimeout(slideback, 600, container, frontcard, backcard, next);\n", - " \n", - "}\n", - "\n", - "\n", - "window.checkFlip = function checkFlip(containerId) {\n", - " var container = document.getElementById(containerId);\n", - "\n", - "\n", - " if (container.classList.contains('flip')) {\n", - " container.classList.remove('flip');\n", - " setTimeout(slide2, 600, containerId);\n", - " } \n", - " else {\n", - " slide2(containerId);\n", - " }\n", - "}\n", - "\n", - "\n", - "function slideback(container, frontcard, backcard, next) {\n", - " container.className=\"flip-container slideback\";\n", - " setTimeout(cleanup, 550, container, frontcard, backcard, next);\n", - "}\n", - "\n", - "function cleanup(container, frontcard, backcard, next) {\n", - " container.removeChild(frontcard);\n", - " backcard.className=\"flipper frontcard\";\n", - " container.className=\"flip-container\";\n", - "\n", - " var cardnum=parseInt(container.dataset.cardnum);\n", - " var cards=eval('cards'+container.id);\n", - " var flipper=createOneCard(container, false, cards, cardnum);\n", - " container.append(flipper);\n", - " cardnum= (cardnum+1) % parseInt(container.dataset.numCards);\n", - " container.dataset.cardnum=cardnum;\n", - " if (cardnum != 1){\n", - " next.innerHTML=\"Next >\";\n", - " } else {\n", - " //next.innerHTML=\"Reload \\\\(\\\\circlearrowleft\\\\) \";\n", - " next.innerHTML='Reload '\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([next]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " }\n", - "\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset();\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " next.style.pointerEvents='auto';\n", - " container.style.pointerEvents='auto';\n", - " /* container.tabIndex= 0; */\n", - " /* container.focus(); */\n", - " next.classList.remove('hide');\n", - " container.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(container.id);\n", - " }, {once: true });\n", - "\n", - "\n", - "}\n", - "\n", - "\n", - "function createOneCard (mydiv, frontCard, cards, cardnum) {\n", - " var colors=[\n", - " '--asparagus',\n", - " '--terra-cotta',\n", - " '--cyan-process'\n", - " ]\n", - "\n", - " var flipper = document.createElement('div');\n", - " if (frontCard){\n", - " flipper.className=\"flipper frontcard\"; \n", - " }\n", - " else {\n", - " flipper.className=\"flipper backcard\"; \n", - " }\n", - "\n", - " var front = document.createElement('div');\n", - " front.className='front flashcard';\n", - "\n", - " var frontSpan= document.createElement('span');\n", - " frontSpan.className='flashcardtext';\n", - " frontSpan.innerHTML=jaxify(cards[cardnum]['front']);\n", - " //frontSpan.textContent=jaxify(cards[cardnum]['front']);\n", - " front.style.background='var(' + colors[cardnum % colors.length] + ')';\n", - "\n", - "\n", - " front.append(frontSpan);\n", - " flipper.append(front);\n", - "\n", - " var back = document.createElement('div');\n", - " back.className='back flashcard';\n", - "\n", - " var backSpan= document.createElement('span');\n", - " backSpan.className='flashcardtext';\n", - " backSpan.innerHTML=jaxify(cards[cardnum]['back']);\n", - " back.append(backSpan);\n", - "\n", - " flipper.append(back);\n", - "\n", - " return flipper;\n", - "\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "function createCards(id, keyControl) {\n", - " console.log(id);\n", - " \n", - " var mydiv=document.getElementById(id);\n", - " /*mydiv.onclick = window.flipCard(mydiv);*/\n", - " /*\n", - " mydiv.addEventListener('click', function(){window.flipCard(mydiv);}, false);\n", - " mydiv.addEventListener('keydown', function(event){window.checkKey(mydiv,event);}, true);\n", - " */\n", - " mydiv.onclick = function(){window.flipCard(mydiv);};\n", - " console.log(keyControl);\n", - " if (keyControl == \"True\"){\n", - " mydiv.onkeydown = function(event){window.checkKey(mydiv,event);};\n", - " }\n", - " /* mydiv.addEventListener('keydown', function(event){event.stopPropagation(); console.log(event); event.preventDefault();}, true); */\n", - " /*mydiv.onkeypress = function(event){console.log(event); event.preventDefault();};*/\n", - "\n", - " console.log(mydiv);\n", - " \n", - " var cards=eval('cards'+id);\n", - " mydiv.dataset.cardnum=0;\n", - " mydiv.dataset.numCards=cards.length;\n", - " mydiv.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(id);\n", - " }, {once: true});\n", - "\n", - " var cardnum=0;\n", - " \n", - " for (var i=0; i<2; i++) {\n", - " \n", - " var flipper;\n", - " if (i==0){\n", - " flipper=createOneCard(mydiv, true, cards, cardnum);\n", - " }\n", - " else {\n", - " flipper=createOneCard(mydiv, false, cards, cardnum);\n", - " }\n", - "\n", - " mydiv.append(flipper);\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " if (typeof version == 'undefined') {\n", - " setTimeout(function(){\n", - " var version = MathJax.version;\n", - " console.log('After sleep, MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }, 500);\n", - " } else{\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " cardnum = (cardnum + 1) % mydiv.dataset.numCards;\n", - " }\n", - " mydiv.dataset.cardnum = cardnum;\n", - "\n", - " var next=document.getElementById(id+'-next');\n", - " if (cards.length==1) {\n", - " // Don't show next if no other cards!\n", - " next.style.pointerEvents='none';\n", - " next.classList.add('hide');\n", - " } else {\n", - " next.innerHTML=\"Next >\";\n", - " }\n", - "\n", - " mydiv.focus();\n", - "\n", - " return flipper;\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "var cardsiXXrkDxAbeBZ=[\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \"prokka assembly_test/scaffolds.fasta --outdir assembly_test --force --prefix SRR18241034 --centre test --compliant\"\n", - " }\n", - "];\n", - " \n", - " createCards(\"iXXrkDxAbeBZ\", \"True\");\n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from jupytercards import display_flashcards\n", "cards='../flashcards/'\n", @@ -667,31 +21,7 @@ "source": [] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "common-cpu.m102", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/base-cpu:m102" - }, - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/GoogleCloud/quiz_files/quiz6-3.ipynb b/GoogleCloud/quiz_files/quiz6-3.ipynb index ea5326b..0c3ffd4 100644 --- a/GoogleCloud/quiz_files/quiz6-3.ipynb +++ b/GoogleCloud/quiz_files/quiz6-3.ipynb @@ -2,656 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "113fb089-7d61-481e-9473-f72bf2ed5371", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "/*!\n", - " * swiped-events.js - v1.1.4\n", - " * Pure JavaScript swipe events\n", - " * https://github.com/john-doherty/swiped-events\n", - " * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element\n", - " * @author John Doherty \n", - " * @license MIT\n", - " */\n", - "!function(t,e){\"use strict\";\"function\"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=e.createEvent(\"CustomEvent\");return a.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),a},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener(\"touchstart\",function(t){if(\"true\"===t.target.getAttribute(\"data-swipe-ignore\"))return;s=t.target,r=Date.now(),n=t.touches[0].clientX,a=t.touches[0].clientY,u=0,i=0},!1),e.addEventListener(\"touchmove\",function(t){if(!n||!a)return;var e=t.touches[0].clientX,r=t.touches[0].clientY;u=n-e,i=a-r},!1),e.addEventListener(\"touchend\",function(t){if(s!==t.target)return;var e=parseInt(l(s,\"data-swipe-threshold\",\"20\"),10),o=parseInt(l(s,\"data-swipe-timeout\",\"500\"),10),c=Date.now()-r,d=\"\",p=t.changedTouches||t.touches||[];Math.abs(u)>Math.abs(i)?Math.abs(u)>e&&c0?\"swiped-left\":\"swiped-right\"):Math.abs(i)>e&&c0?\"swiped-up\":\"swiped-down\");if(\"\"!==d){var b={dir:d.replace(/swiped-/,\"\"),xStart:parseInt(n,10),xEnd:parseInt((p[0]||{}).clientX||-1,10),yStart:parseInt(a,10),yEnd:parseInt((p[0]||{}).clientY||-1,10)};s.dispatchEvent(new CustomEvent(\"swiped\",{bubbles:!0,cancelable:!0,detail:b})),s.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:b}))}n=null,a=null,r=null},!1);var n=null,a=null,u=null,i=null,r=null,s=null;function l(t,n,a){for(;t&&t!==e.documentElement;){var u=t.getAttribute(n);if(u)return u;t=t.parentNode}return a}}(window,document);\n", - "\n", - "function jaxify(string) {\n", - " var mystring = string;\n", - " console.log(mystring);\n", - "\n", - " var count = 0;\n", - " var loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - "\n", - " var count2 = 0;\n", - " var loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - "\n", - " //console.log(loc);\n", - "\n", - " while ((loc >= 0) || (loc2 >= 0)) {\n", - "\n", - " /* Have to replace all the double $$ first with current implementation */\n", - " if (loc2 >= 0) {\n", - " if (count2 % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\[\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\]\");\n", - " }\n", - " count2++;\n", - " } else {\n", - " if (count % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\(\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\)\");\n", - " }\n", - " count++;\n", - " }\n", - " loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - " loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - " //console.log(mystring,\", loc:\",loc,\", loc2:\",loc2);\n", - " }\n", - "\n", - " //console.log(mystring);\n", - " return mystring;\n", - "}\n", - "\n", - "window.flipCard = function flipCard(ths) {\n", - " console.log(ths);\n", - " console.log(ths.id);\n", - " ths.classList.toggle(\"flip\"); \n", - " var next=document.getElementById(ths.id+'-next');\n", - " next.style.pointerEvents='none';\n", - " /* ths.blur(); */\n", - " next.classList.add('flipped');\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([ths]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " setTimeout(reenableNext, 600, ths, next);\n", - "}\n", - "\n", - "window.checkKey = function checkKey(container, event) {\n", - " event.stopPropagation();\n", - " /*\n", - " console.log(container);\n", - " console.log(event.key);\n", - " console.log(event.code);\n", - " */\n", - " /* JMS: Working here*/\n", - " var next=document.getElementById(container.id+'-next');\n", - " /* Only react if not already sliding */\n", - " if (! next.classList.contains(\"hide\")) {\n", - " if ((event.key == \"j\") || (event.key == \"Enter\") || (event.key == \"ArrowRight\")) {\n", - " window.checkFlip(container.id);\n", - " }\n", - " if (event.key == \" \") {\n", - " window.flipCard(container);\n", - " }\n", - " }\n", - " event.preventDefault();\n", - "}\n", - "\n", - "\n", - "function reenableNext(ths, next) {\n", - " next.style.pointerEvents='auto';\n", - " /* ths.tabIndex= 0;*/\n", - " /* ths.focus(); */\n", - "}\n", - "\n", - "\n", - "\n", - "function slide2(containerId) {\n", - " var container = document.getElementById(containerId);\n", - " var next=document.getElementById(containerId+'-next');\n", - " var frontcard = container.children[0];\n", - " var backcard = container.children[1];\n", - " container.style.pointerEvents='none';\n", - " /* container.removeAttribute(\"tabindex\");*/\n", - " /* container.blur(); */\n", - " //backcard.style.pointerEvents='none';\n", - " next.style.pointerEvents='none';\n", - " next.classList.remove('flipped');\n", - " next.classList.add('hide');\n", - "\n", - " //container.classList.add(\"prepare\");\n", - " \n", - " container.className=\"flip-container slide\";\n", - " backcard.parentElement.removeChild(frontcard);\n", - " backcard.parentElement.appendChild(frontcard);\n", - " setTimeout(slideback, 600, container, frontcard, backcard, next);\n", - " \n", - "}\n", - "\n", - "\n", - "window.checkFlip = function checkFlip(containerId) {\n", - " var container = document.getElementById(containerId);\n", - "\n", - "\n", - " if (container.classList.contains('flip')) {\n", - " container.classList.remove('flip');\n", - " setTimeout(slide2, 600, containerId);\n", - " } \n", - " else {\n", - " slide2(containerId);\n", - " }\n", - "}\n", - "\n", - "\n", - "function slideback(container, frontcard, backcard, next) {\n", - " container.className=\"flip-container slideback\";\n", - " setTimeout(cleanup, 550, container, frontcard, backcard, next);\n", - "}\n", - "\n", - "function cleanup(container, frontcard, backcard, next) {\n", - " container.removeChild(frontcard);\n", - " backcard.className=\"flipper frontcard\";\n", - " container.className=\"flip-container\";\n", - "\n", - " var cardnum=parseInt(container.dataset.cardnum);\n", - " var cards=eval('cards'+container.id);\n", - " var flipper=createOneCard(container, false, cards, cardnum);\n", - " container.append(flipper);\n", - " cardnum= (cardnum+1) % parseInt(container.dataset.numCards);\n", - " container.dataset.cardnum=cardnum;\n", - " if (cardnum != 1){\n", - " next.innerHTML=\"Next >\";\n", - " } else {\n", - " //next.innerHTML=\"Reload \\\\(\\\\circlearrowleft\\\\) \";\n", - " next.innerHTML='Reload '\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([next]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " }\n", - "\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset();\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " next.style.pointerEvents='auto';\n", - " container.style.pointerEvents='auto';\n", - " /* container.tabIndex= 0; */\n", - " /* container.focus(); */\n", - " next.classList.remove('hide');\n", - " container.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(container.id);\n", - " }, {once: true });\n", - "\n", - "\n", - "}\n", - "\n", - "\n", - "function createOneCard (mydiv, frontCard, cards, cardnum) {\n", - " var colors=[\n", - " '--asparagus',\n", - " '--terra-cotta',\n", - " '--cyan-process'\n", - " ]\n", - "\n", - " var flipper = document.createElement('div');\n", - " if (frontCard){\n", - " flipper.className=\"flipper frontcard\"; \n", - " }\n", - " else {\n", - " flipper.className=\"flipper backcard\"; \n", - " }\n", - "\n", - " var front = document.createElement('div');\n", - " front.className='front flashcard';\n", - "\n", - " var frontSpan= document.createElement('span');\n", - " frontSpan.className='flashcardtext';\n", - " frontSpan.innerHTML=jaxify(cards[cardnum]['front']);\n", - " //frontSpan.textContent=jaxify(cards[cardnum]['front']);\n", - " front.style.background='var(' + colors[cardnum % colors.length] + ')';\n", - "\n", - "\n", - " front.append(frontSpan);\n", - " flipper.append(front);\n", - "\n", - " var back = document.createElement('div');\n", - " back.className='back flashcard';\n", - "\n", - " var backSpan= document.createElement('span');\n", - " backSpan.className='flashcardtext';\n", - " backSpan.innerHTML=jaxify(cards[cardnum]['back']);\n", - " back.append(backSpan);\n", - "\n", - " flipper.append(back);\n", - "\n", - " return flipper;\n", - "\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "function createCards(id, keyControl) {\n", - " console.log(id);\n", - " \n", - " var mydiv=document.getElementById(id);\n", - " /*mydiv.onclick = window.flipCard(mydiv);*/\n", - " /*\n", - " mydiv.addEventListener('click', function(){window.flipCard(mydiv);}, false);\n", - " mydiv.addEventListener('keydown', function(event){window.checkKey(mydiv,event);}, true);\n", - " */\n", - " mydiv.onclick = function(){window.flipCard(mydiv);};\n", - " console.log(keyControl);\n", - " if (keyControl == \"True\"){\n", - " mydiv.onkeydown = function(event){window.checkKey(mydiv,event);};\n", - " }\n", - " /* mydiv.addEventListener('keydown', function(event){event.stopPropagation(); console.log(event); event.preventDefault();}, true); */\n", - " /*mydiv.onkeypress = function(event){console.log(event); event.preventDefault();};*/\n", - "\n", - " console.log(mydiv);\n", - " \n", - " var cards=eval('cards'+id);\n", - " mydiv.dataset.cardnum=0;\n", - " mydiv.dataset.numCards=cards.length;\n", - " mydiv.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(id);\n", - " }, {once: true});\n", - "\n", - " var cardnum=0;\n", - " \n", - " for (var i=0; i<2; i++) {\n", - " \n", - " var flipper;\n", - " if (i==0){\n", - " flipper=createOneCard(mydiv, true, cards, cardnum);\n", - " }\n", - " else {\n", - " flipper=createOneCard(mydiv, false, cards, cardnum);\n", - " }\n", - "\n", - " mydiv.append(flipper);\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " if (typeof version == 'undefined') {\n", - " setTimeout(function(){\n", - " var version = MathJax.version;\n", - " console.log('After sleep, MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }, 500);\n", - " } else{\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " cardnum = (cardnum + 1) % mydiv.dataset.numCards;\n", - " }\n", - " mydiv.dataset.cardnum = cardnum;\n", - "\n", - " var next=document.getElementById(id+'-next');\n", - " if (cards.length==1) {\n", - " // Don't show next if no other cards!\n", - " next.style.pointerEvents='none';\n", - " next.classList.add('hide');\n", - " } else {\n", - " next.innerHTML=\"Next >\";\n", - " }\n", - "\n", - " mydiv.focus();\n", - "\n", - " return flipper;\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "var cardsttnhQuOfaeEJ=[\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \" gsutil cp assembly_test/*.html gs://$BUCKET\"\n", - " }\n", - "];\n", - " \n", - " createCards(\"ttnhQuOfaeEJ\", \"True\");\n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from jupytercards import display_flashcards\n", "cards='/home/jupyter/flashcards/'\n", @@ -659,31 +13,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "tf2-gpu.2-8.m102", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/tf2-gpu.2-8:m102" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/GoogleCloud/quiz_files/quiz6-4.ipynb b/GoogleCloud/quiz_files/quiz6-4.ipynb index 9f43905..da2e157 100644 --- a/GoogleCloud/quiz_files/quiz6-4.ipynb +++ b/GoogleCloud/quiz_files/quiz6-4.ipynb @@ -2,656 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "113fb089-7d61-481e-9473-f72bf2ed5371", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "/*!\n", - " * swiped-events.js - v1.1.4\n", - " * Pure JavaScript swipe events\n", - " * https://github.com/john-doherty/swiped-events\n", - " * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element\n", - " * @author John Doherty \n", - " * @license MIT\n", - " */\n", - "!function(t,e){\"use strict\";\"function\"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=e.createEvent(\"CustomEvent\");return a.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),a},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener(\"touchstart\",function(t){if(\"true\"===t.target.getAttribute(\"data-swipe-ignore\"))return;s=t.target,r=Date.now(),n=t.touches[0].clientX,a=t.touches[0].clientY,u=0,i=0},!1),e.addEventListener(\"touchmove\",function(t){if(!n||!a)return;var e=t.touches[0].clientX,r=t.touches[0].clientY;u=n-e,i=a-r},!1),e.addEventListener(\"touchend\",function(t){if(s!==t.target)return;var e=parseInt(l(s,\"data-swipe-threshold\",\"20\"),10),o=parseInt(l(s,\"data-swipe-timeout\",\"500\"),10),c=Date.now()-r,d=\"\",p=t.changedTouches||t.touches||[];Math.abs(u)>Math.abs(i)?Math.abs(u)>e&&c0?\"swiped-left\":\"swiped-right\"):Math.abs(i)>e&&c0?\"swiped-up\":\"swiped-down\");if(\"\"!==d){var b={dir:d.replace(/swiped-/,\"\"),xStart:parseInt(n,10),xEnd:parseInt((p[0]||{}).clientX||-1,10),yStart:parseInt(a,10),yEnd:parseInt((p[0]||{}).clientY||-1,10)};s.dispatchEvent(new CustomEvent(\"swiped\",{bubbles:!0,cancelable:!0,detail:b})),s.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:b}))}n=null,a=null,r=null},!1);var n=null,a=null,u=null,i=null,r=null,s=null;function l(t,n,a){for(;t&&t!==e.documentElement;){var u=t.getAttribute(n);if(u)return u;t=t.parentNode}return a}}(window,document);\n", - "\n", - "function jaxify(string) {\n", - " var mystring = string;\n", - " console.log(mystring);\n", - "\n", - " var count = 0;\n", - " var loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - "\n", - " var count2 = 0;\n", - " var loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - "\n", - " //console.log(loc);\n", - "\n", - " while ((loc >= 0) || (loc2 >= 0)) {\n", - "\n", - " /* Have to replace all the double $$ first with current implementation */\n", - " if (loc2 >= 0) {\n", - " if (count2 % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\[\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\]\");\n", - " }\n", - " count2++;\n", - " } else {\n", - " if (count % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\(\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\)\");\n", - " }\n", - " count++;\n", - " }\n", - " loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - " loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - " //console.log(mystring,\", loc:\",loc,\", loc2:\",loc2);\n", - " }\n", - "\n", - " //console.log(mystring);\n", - " return mystring;\n", - "}\n", - "\n", - "window.flipCard = function flipCard(ths) {\n", - " console.log(ths);\n", - " console.log(ths.id);\n", - " ths.classList.toggle(\"flip\"); \n", - " var next=document.getElementById(ths.id+'-next');\n", - " next.style.pointerEvents='none';\n", - " /* ths.blur(); */\n", - " next.classList.add('flipped');\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([ths]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " setTimeout(reenableNext, 600, ths, next);\n", - "}\n", - "\n", - "window.checkKey = function checkKey(container, event) {\n", - " event.stopPropagation();\n", - " /*\n", - " console.log(container);\n", - " console.log(event.key);\n", - " console.log(event.code);\n", - " */\n", - " /* JMS: Working here*/\n", - " var next=document.getElementById(container.id+'-next');\n", - " /* Only react if not already sliding */\n", - " if (! next.classList.contains(\"hide\")) {\n", - " if ((event.key == \"j\") || (event.key == \"Enter\") || (event.key == \"ArrowRight\")) {\n", - " window.checkFlip(container.id);\n", - " }\n", - " if (event.key == \" \") {\n", - " window.flipCard(container);\n", - " }\n", - " }\n", - " event.preventDefault();\n", - "}\n", - "\n", - "\n", - "function reenableNext(ths, next) {\n", - " next.style.pointerEvents='auto';\n", - " /* ths.tabIndex= 0;*/\n", - " /* ths.focus(); */\n", - "}\n", - "\n", - "\n", - "\n", - "function slide2(containerId) {\n", - " var container = document.getElementById(containerId);\n", - " var next=document.getElementById(containerId+'-next');\n", - " var frontcard = container.children[0];\n", - " var backcard = container.children[1];\n", - " container.style.pointerEvents='none';\n", - " /* container.removeAttribute(\"tabindex\");*/\n", - " /* container.blur(); */\n", - " //backcard.style.pointerEvents='none';\n", - " next.style.pointerEvents='none';\n", - " next.classList.remove('flipped');\n", - " next.classList.add('hide');\n", - "\n", - " //container.classList.add(\"prepare\");\n", - " \n", - " container.className=\"flip-container slide\";\n", - " backcard.parentElement.removeChild(frontcard);\n", - " backcard.parentElement.appendChild(frontcard);\n", - " setTimeout(slideback, 600, container, frontcard, backcard, next);\n", - " \n", - "}\n", - "\n", - "\n", - "window.checkFlip = function checkFlip(containerId) {\n", - " var container = document.getElementById(containerId);\n", - "\n", - "\n", - " if (container.classList.contains('flip')) {\n", - " container.classList.remove('flip');\n", - " setTimeout(slide2, 600, containerId);\n", - " } \n", - " else {\n", - " slide2(containerId);\n", - " }\n", - "}\n", - "\n", - "\n", - "function slideback(container, frontcard, backcard, next) {\n", - " container.className=\"flip-container slideback\";\n", - " setTimeout(cleanup, 550, container, frontcard, backcard, next);\n", - "}\n", - "\n", - "function cleanup(container, frontcard, backcard, next) {\n", - " container.removeChild(frontcard);\n", - " backcard.className=\"flipper frontcard\";\n", - " container.className=\"flip-container\";\n", - "\n", - " var cardnum=parseInt(container.dataset.cardnum);\n", - " var cards=eval('cards'+container.id);\n", - " var flipper=createOneCard(container, false, cards, cardnum);\n", - " container.append(flipper);\n", - " cardnum= (cardnum+1) % parseInt(container.dataset.numCards);\n", - " container.dataset.cardnum=cardnum;\n", - " if (cardnum != 1){\n", - " next.innerHTML=\"Next >\";\n", - " } else {\n", - " //next.innerHTML=\"Reload \\\\(\\\\circlearrowleft\\\\) \";\n", - " next.innerHTML='Reload '\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([next]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " }\n", - "\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset();\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " next.style.pointerEvents='auto';\n", - " container.style.pointerEvents='auto';\n", - " /* container.tabIndex= 0; */\n", - " /* container.focus(); */\n", - " next.classList.remove('hide');\n", - " container.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(container.id);\n", - " }, {once: true });\n", - "\n", - "\n", - "}\n", - "\n", - "\n", - "function createOneCard (mydiv, frontCard, cards, cardnum) {\n", - " var colors=[\n", - " '--asparagus',\n", - " '--terra-cotta',\n", - " '--cyan-process'\n", - " ]\n", - "\n", - " var flipper = document.createElement('div');\n", - " if (frontCard){\n", - " flipper.className=\"flipper frontcard\"; \n", - " }\n", - " else {\n", - " flipper.className=\"flipper backcard\"; \n", - " }\n", - "\n", - " var front = document.createElement('div');\n", - " front.className='front flashcard';\n", - "\n", - " var frontSpan= document.createElement('span');\n", - " frontSpan.className='flashcardtext';\n", - " frontSpan.innerHTML=jaxify(cards[cardnum]['front']);\n", - " //frontSpan.textContent=jaxify(cards[cardnum]['front']);\n", - " front.style.background='var(' + colors[cardnum % colors.length] + ')';\n", - "\n", - "\n", - " front.append(frontSpan);\n", - " flipper.append(front);\n", - "\n", - " var back = document.createElement('div');\n", - " back.className='back flashcard';\n", - "\n", - " var backSpan= document.createElement('span');\n", - " backSpan.className='flashcardtext';\n", - " backSpan.innerHTML=jaxify(cards[cardnum]['back']);\n", - " back.append(backSpan);\n", - "\n", - " flipper.append(back);\n", - "\n", - " return flipper;\n", - "\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "function createCards(id, keyControl) {\n", - " console.log(id);\n", - " \n", - " var mydiv=document.getElementById(id);\n", - " /*mydiv.onclick = window.flipCard(mydiv);*/\n", - " /*\n", - " mydiv.addEventListener('click', function(){window.flipCard(mydiv);}, false);\n", - " mydiv.addEventListener('keydown', function(event){window.checkKey(mydiv,event);}, true);\n", - " */\n", - " mydiv.onclick = function(){window.flipCard(mydiv);};\n", - " console.log(keyControl);\n", - " if (keyControl == \"True\"){\n", - " mydiv.onkeydown = function(event){window.checkKey(mydiv,event);};\n", - " }\n", - " /* mydiv.addEventListener('keydown', function(event){event.stopPropagation(); console.log(event); event.preventDefault();}, true); */\n", - " /*mydiv.onkeypress = function(event){console.log(event); event.preventDefault();};*/\n", - "\n", - " console.log(mydiv);\n", - " \n", - " var cards=eval('cards'+id);\n", - " mydiv.dataset.cardnum=0;\n", - " mydiv.dataset.numCards=cards.length;\n", - " mydiv.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(id);\n", - " }, {once: true});\n", - "\n", - " var cardnum=0;\n", - " \n", - " for (var i=0; i<2; i++) {\n", - " \n", - " var flipper;\n", - " if (i==0){\n", - " flipper=createOneCard(mydiv, true, cards, cardnum);\n", - " }\n", - " else {\n", - " flipper=createOneCard(mydiv, false, cards, cardnum);\n", - " }\n", - "\n", - " mydiv.append(flipper);\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " if (typeof version == 'undefined') {\n", - " setTimeout(function(){\n", - " var version = MathJax.version;\n", - " console.log('After sleep, MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }, 500);\n", - " } else{\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " cardnum = (cardnum + 1) % mydiv.dataset.numCards;\n", - " }\n", - " mydiv.dataset.cardnum = cardnum;\n", - "\n", - " var next=document.getElementById(id+'-next');\n", - " if (cards.length==1) {\n", - " // Don't show next if no other cards!\n", - " next.style.pointerEvents='none';\n", - " next.classList.add('hide');\n", - " } else {\n", - " next.innerHTML=\"Next >\";\n", - " }\n", - "\n", - " mydiv.focus();\n", - "\n", - " return flipper;\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "var cardsJDatXLVXOEST=[\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \" gsutil cp assembly_test/*.gff gs://$BUCKET\"\n", - " }\n", - "];\n", - " \n", - " createCards(\"JDatXLVXOEST\", \"True\");\n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from jupytercards import display_flashcards\n", "cards='/home/jupyter/flashcards/'\n", @@ -659,31 +13,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "tf2-gpu.2-8.m102", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/tf2-gpu.2-8:m102" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/GoogleCloud/quiz_files/quiz7-1.ipynb b/GoogleCloud/quiz_files/quiz7-1.ipynb index ea4e75c..195560d 100644 --- a/GoogleCloud/quiz_files/quiz7-1.ipynb +++ b/GoogleCloud/quiz_files/quiz7-1.ipynb @@ -2,656 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "113fb089-7d61-481e-9473-f72bf2ed5371", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "/*!\n", - " * swiped-events.js - v1.1.4\n", - " * Pure JavaScript swipe events\n", - " * https://github.com/john-doherty/swiped-events\n", - " * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element\n", - " * @author John Doherty \n", - " * @license MIT\n", - " */\n", - "!function(t,e){\"use strict\";\"function\"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=e.createEvent(\"CustomEvent\");return a.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),a},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener(\"touchstart\",function(t){if(\"true\"===t.target.getAttribute(\"data-swipe-ignore\"))return;s=t.target,r=Date.now(),n=t.touches[0].clientX,a=t.touches[0].clientY,u=0,i=0},!1),e.addEventListener(\"touchmove\",function(t){if(!n||!a)return;var e=t.touches[0].clientX,r=t.touches[0].clientY;u=n-e,i=a-r},!1),e.addEventListener(\"touchend\",function(t){if(s!==t.target)return;var e=parseInt(l(s,\"data-swipe-threshold\",\"20\"),10),o=parseInt(l(s,\"data-swipe-timeout\",\"500\"),10),c=Date.now()-r,d=\"\",p=t.changedTouches||t.touches||[];Math.abs(u)>Math.abs(i)?Math.abs(u)>e&&c0?\"swiped-left\":\"swiped-right\"):Math.abs(i)>e&&c0?\"swiped-up\":\"swiped-down\");if(\"\"!==d){var b={dir:d.replace(/swiped-/,\"\"),xStart:parseInt(n,10),xEnd:parseInt((p[0]||{}).clientX||-1,10),yStart:parseInt(a,10),yEnd:parseInt((p[0]||{}).clientY||-1,10)};s.dispatchEvent(new CustomEvent(\"swiped\",{bubbles:!0,cancelable:!0,detail:b})),s.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:b}))}n=null,a=null,r=null},!1);var n=null,a=null,u=null,i=null,r=null,s=null;function l(t,n,a){for(;t&&t!==e.documentElement;){var u=t.getAttribute(n);if(u)return u;t=t.parentNode}return a}}(window,document);\n", - "\n", - "function jaxify(string) {\n", - " var mystring = string;\n", - " console.log(mystring);\n", - "\n", - " var count = 0;\n", - " var loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - "\n", - " var count2 = 0;\n", - " var loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - "\n", - " //console.log(loc);\n", - "\n", - " while ((loc >= 0) || (loc2 >= 0)) {\n", - "\n", - " /* Have to replace all the double $$ first with current implementation */\n", - " if (loc2 >= 0) {\n", - " if (count2 % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\[\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\]\");\n", - " }\n", - " count2++;\n", - " } else {\n", - " if (count % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\(\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\)\");\n", - " }\n", - " count++;\n", - " }\n", - " loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - " loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - " //console.log(mystring,\", loc:\",loc,\", loc2:\",loc2);\n", - " }\n", - "\n", - " //console.log(mystring);\n", - " return mystring;\n", - "}\n", - "\n", - "window.flipCard = function flipCard(ths) {\n", - " console.log(ths);\n", - " console.log(ths.id);\n", - " ths.classList.toggle(\"flip\"); \n", - " var next=document.getElementById(ths.id+'-next');\n", - " next.style.pointerEvents='none';\n", - " /* ths.blur(); */\n", - " next.classList.add('flipped');\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([ths]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " setTimeout(reenableNext, 600, ths, next);\n", - "}\n", - "\n", - "window.checkKey = function checkKey(container, event) {\n", - " event.stopPropagation();\n", - " /*\n", - " console.log(container);\n", - " console.log(event.key);\n", - " console.log(event.code);\n", - " */\n", - " /* JMS: Working here*/\n", - " var next=document.getElementById(container.id+'-next');\n", - " /* Only react if not already sliding */\n", - " if (! next.classList.contains(\"hide\")) {\n", - " if ((event.key == \"j\") || (event.key == \"Enter\") || (event.key == \"ArrowRight\")) {\n", - " window.checkFlip(container.id);\n", - " }\n", - " if (event.key == \" \") {\n", - " window.flipCard(container);\n", - " }\n", - " }\n", - " event.preventDefault();\n", - "}\n", - "\n", - "\n", - "function reenableNext(ths, next) {\n", - " next.style.pointerEvents='auto';\n", - " /* ths.tabIndex= 0;*/\n", - " /* ths.focus(); */\n", - "}\n", - "\n", - "\n", - "\n", - "function slide2(containerId) {\n", - " var container = document.getElementById(containerId);\n", - " var next=document.getElementById(containerId+'-next');\n", - " var frontcard = container.children[0];\n", - " var backcard = container.children[1];\n", - " container.style.pointerEvents='none';\n", - " /* container.removeAttribute(\"tabindex\");*/\n", - " /* container.blur(); */\n", - " //backcard.style.pointerEvents='none';\n", - " next.style.pointerEvents='none';\n", - " next.classList.remove('flipped');\n", - " next.classList.add('hide');\n", - "\n", - " //container.classList.add(\"prepare\");\n", - " \n", - " container.className=\"flip-container slide\";\n", - " backcard.parentElement.removeChild(frontcard);\n", - " backcard.parentElement.appendChild(frontcard);\n", - " setTimeout(slideback, 600, container, frontcard, backcard, next);\n", - " \n", - "}\n", - "\n", - "\n", - "window.checkFlip = function checkFlip(containerId) {\n", - " var container = document.getElementById(containerId);\n", - "\n", - "\n", - " if (container.classList.contains('flip')) {\n", - " container.classList.remove('flip');\n", - " setTimeout(slide2, 600, containerId);\n", - " } \n", - " else {\n", - " slide2(containerId);\n", - " }\n", - "}\n", - "\n", - "\n", - "function slideback(container, frontcard, backcard, next) {\n", - " container.className=\"flip-container slideback\";\n", - " setTimeout(cleanup, 550, container, frontcard, backcard, next);\n", - "}\n", - "\n", - "function cleanup(container, frontcard, backcard, next) {\n", - " container.removeChild(frontcard);\n", - " backcard.className=\"flipper frontcard\";\n", - " container.className=\"flip-container\";\n", - "\n", - " var cardnum=parseInt(container.dataset.cardnum);\n", - " var cards=eval('cards'+container.id);\n", - " var flipper=createOneCard(container, false, cards, cardnum);\n", - " container.append(flipper);\n", - " cardnum= (cardnum+1) % parseInt(container.dataset.numCards);\n", - " container.dataset.cardnum=cardnum;\n", - " if (cardnum != 1){\n", - " next.innerHTML=\"Next >\";\n", - " } else {\n", - " //next.innerHTML=\"Reload \\\\(\\\\circlearrowleft\\\\) \";\n", - " next.innerHTML='Reload '\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([next]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " }\n", - "\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset();\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " next.style.pointerEvents='auto';\n", - " container.style.pointerEvents='auto';\n", - " /* container.tabIndex= 0; */\n", - " /* container.focus(); */\n", - " next.classList.remove('hide');\n", - " container.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(container.id);\n", - " }, {once: true });\n", - "\n", - "\n", - "}\n", - "\n", - "\n", - "function createOneCard (mydiv, frontCard, cards, cardnum) {\n", - " var colors=[\n", - " '--asparagus',\n", - " '--terra-cotta',\n", - " '--cyan-process'\n", - " ]\n", - "\n", - " var flipper = document.createElement('div');\n", - " if (frontCard){\n", - " flipper.className=\"flipper frontcard\"; \n", - " }\n", - " else {\n", - " flipper.className=\"flipper backcard\"; \n", - " }\n", - "\n", - " var front = document.createElement('div');\n", - " front.className='front flashcard';\n", - "\n", - " var frontSpan= document.createElement('span');\n", - " frontSpan.className='flashcardtext';\n", - " frontSpan.innerHTML=jaxify(cards[cardnum]['front']);\n", - " //frontSpan.textContent=jaxify(cards[cardnum]['front']);\n", - " front.style.background='var(' + colors[cardnum % colors.length] + ')';\n", - "\n", - "\n", - " front.append(frontSpan);\n", - " flipper.append(front);\n", - "\n", - " var back = document.createElement('div');\n", - " back.className='back flashcard';\n", - "\n", - " var backSpan= document.createElement('span');\n", - " backSpan.className='flashcardtext';\n", - " backSpan.innerHTML=jaxify(cards[cardnum]['back']);\n", - " back.append(backSpan);\n", - "\n", - " flipper.append(back);\n", - "\n", - " return flipper;\n", - "\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "function createCards(id, keyControl) {\n", - " console.log(id);\n", - " \n", - " var mydiv=document.getElementById(id);\n", - " /*mydiv.onclick = window.flipCard(mydiv);*/\n", - " /*\n", - " mydiv.addEventListener('click', function(){window.flipCard(mydiv);}, false);\n", - " mydiv.addEventListener('keydown', function(event){window.checkKey(mydiv,event);}, true);\n", - " */\n", - " mydiv.onclick = function(){window.flipCard(mydiv);};\n", - " console.log(keyControl);\n", - " if (keyControl == \"True\"){\n", - " mydiv.onkeydown = function(event){window.checkKey(mydiv,event);};\n", - " }\n", - " /* mydiv.addEventListener('keydown', function(event){event.stopPropagation(); console.log(event); event.preventDefault();}, true); */\n", - " /*mydiv.onkeypress = function(event){console.log(event); event.preventDefault();};*/\n", - "\n", - " console.log(mydiv);\n", - " \n", - " var cards=eval('cards'+id);\n", - " mydiv.dataset.cardnum=0;\n", - " mydiv.dataset.numCards=cards.length;\n", - " mydiv.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(id);\n", - " }, {once: true});\n", - "\n", - " var cardnum=0;\n", - " \n", - " for (var i=0; i<2; i++) {\n", - " \n", - " var flipper;\n", - " if (i==0){\n", - " flipper=createOneCard(mydiv, true, cards, cardnum);\n", - " }\n", - " else {\n", - " flipper=createOneCard(mydiv, false, cards, cardnum);\n", - " }\n", - "\n", - " mydiv.append(flipper);\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " if (typeof version == 'undefined') {\n", - " setTimeout(function(){\n", - " var version = MathJax.version;\n", - " console.log('After sleep, MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }, 500);\n", - " } else{\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " cardnum = (cardnum + 1) % mydiv.dataset.numCards;\n", - " }\n", - " mydiv.dataset.cardnum = cardnum;\n", - "\n", - " var next=document.getElementById(id+'-next');\n", - " if (cards.length==1) {\n", - " // Don't show next if no other cards!\n", - " next.style.pointerEvents='none';\n", - " next.classList.add('hide');\n", - " } else {\n", - " next.innerHTML=\"Next >\";\n", - " }\n", - "\n", - " mydiv.focus();\n", - "\n", - " return flipper;\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "var cardsziCoVVJXaXfq=[\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \"The second grep command in the pipe is looking for a lowercase n rather than an uppercase N.\"\n", - " }\n", - "];\n", - " \n", - " createCards(\"ziCoVVJXaXfq\", \"True\");\n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from jupytercards import display_flashcards\n", "cards='/home/jupyter/flashcards/'\n", @@ -659,31 +13,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "tf2-gpu.2-8.m102", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/tf2-gpu.2-8:m102" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/GoogleCloud/quiz_files/quiz7-2.ipynb b/GoogleCloud/quiz_files/quiz7-2.ipynb index 678e2c5..1ed6384 100644 --- a/GoogleCloud/quiz_files/quiz7-2.ipynb +++ b/GoogleCloud/quiz_files/quiz7-2.ipynb @@ -2,656 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "113fb089-7d61-481e-9473-f72bf2ed5371", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/javascript": [ - "/*!\n", - " * swiped-events.js - v1.1.4\n", - " * Pure JavaScript swipe events\n", - " * https://github.com/john-doherty/swiped-events\n", - " * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element\n", - " * @author John Doherty \n", - " * @license MIT\n", - " */\n", - "!function(t,e){\"use strict\";\"function\"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=e.createEvent(\"CustomEvent\");return a.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),a},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener(\"touchstart\",function(t){if(\"true\"===t.target.getAttribute(\"data-swipe-ignore\"))return;s=t.target,r=Date.now(),n=t.touches[0].clientX,a=t.touches[0].clientY,u=0,i=0},!1),e.addEventListener(\"touchmove\",function(t){if(!n||!a)return;var e=t.touches[0].clientX,r=t.touches[0].clientY;u=n-e,i=a-r},!1),e.addEventListener(\"touchend\",function(t){if(s!==t.target)return;var e=parseInt(l(s,\"data-swipe-threshold\",\"20\"),10),o=parseInt(l(s,\"data-swipe-timeout\",\"500\"),10),c=Date.now()-r,d=\"\",p=t.changedTouches||t.touches||[];Math.abs(u)>Math.abs(i)?Math.abs(u)>e&&c0?\"swiped-left\":\"swiped-right\"):Math.abs(i)>e&&c0?\"swiped-up\":\"swiped-down\");if(\"\"!==d){var b={dir:d.replace(/swiped-/,\"\"),xStart:parseInt(n,10),xEnd:parseInt((p[0]||{}).clientX||-1,10),yStart:parseInt(a,10),yEnd:parseInt((p[0]||{}).clientY||-1,10)};s.dispatchEvent(new CustomEvent(\"swiped\",{bubbles:!0,cancelable:!0,detail:b})),s.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:b}))}n=null,a=null,r=null},!1);var n=null,a=null,u=null,i=null,r=null,s=null;function l(t,n,a){for(;t&&t!==e.documentElement;){var u=t.getAttribute(n);if(u)return u;t=t.parentNode}return a}}(window,document);\n", - "\n", - "function jaxify(string) {\n", - " var mystring = string;\n", - " console.log(mystring);\n", - "\n", - " var count = 0;\n", - " var loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - "\n", - " var count2 = 0;\n", - " var loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - "\n", - " //console.log(loc);\n", - "\n", - " while ((loc >= 0) || (loc2 >= 0)) {\n", - "\n", - " /* Have to replace all the double $$ first with current implementation */\n", - " if (loc2 >= 0) {\n", - " if (count2 % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\[\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$\\$)/, \"$1\\\\]\");\n", - " }\n", - " count2++;\n", - " } else {\n", - " if (count % 2 == 0) {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\(\");\n", - " } else {\n", - " mystring = mystring.replace(/([^\\\\]|^)(\\$)/, \"$1\\\\)\");\n", - " }\n", - " count++;\n", - " }\n", - " loc = mystring.search(/([^\\\\]|^)(\\$)/);\n", - " loc2 = mystring.search(/([^\\\\]|^)(\\$\\$)/);\n", - " //console.log(mystring,\", loc:\",loc,\", loc2:\",loc2);\n", - " }\n", - "\n", - " //console.log(mystring);\n", - " return mystring;\n", - "}\n", - "\n", - "window.flipCard = function flipCard(ths) {\n", - " console.log(ths);\n", - " console.log(ths.id);\n", - " ths.classList.toggle(\"flip\"); \n", - " var next=document.getElementById(ths.id+'-next');\n", - " next.style.pointerEvents='none';\n", - " /* ths.blur(); */\n", - " next.classList.add('flipped');\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([ths]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " setTimeout(reenableNext, 600, ths, next);\n", - "}\n", - "\n", - "window.checkKey = function checkKey(container, event) {\n", - " event.stopPropagation();\n", - " /*\n", - " console.log(container);\n", - " console.log(event.key);\n", - " console.log(event.code);\n", - " */\n", - " /* JMS: Working here*/\n", - " var next=document.getElementById(container.id+'-next');\n", - " /* Only react if not already sliding */\n", - " if (! next.classList.contains(\"hide\")) {\n", - " if ((event.key == \"j\") || (event.key == \"Enter\") || (event.key == \"ArrowRight\")) {\n", - " window.checkFlip(container.id);\n", - " }\n", - " if (event.key == \" \") {\n", - " window.flipCard(container);\n", - " }\n", - " }\n", - " event.preventDefault();\n", - "}\n", - "\n", - "\n", - "function reenableNext(ths, next) {\n", - " next.style.pointerEvents='auto';\n", - " /* ths.tabIndex= 0;*/\n", - " /* ths.focus(); */\n", - "}\n", - "\n", - "\n", - "\n", - "function slide2(containerId) {\n", - " var container = document.getElementById(containerId);\n", - " var next=document.getElementById(containerId+'-next');\n", - " var frontcard = container.children[0];\n", - " var backcard = container.children[1];\n", - " container.style.pointerEvents='none';\n", - " /* container.removeAttribute(\"tabindex\");*/\n", - " /* container.blur(); */\n", - " //backcard.style.pointerEvents='none';\n", - " next.style.pointerEvents='none';\n", - " next.classList.remove('flipped');\n", - " next.classList.add('hide');\n", - "\n", - " //container.classList.add(\"prepare\");\n", - " \n", - " container.className=\"flip-container slide\";\n", - " backcard.parentElement.removeChild(frontcard);\n", - " backcard.parentElement.appendChild(frontcard);\n", - " setTimeout(slideback, 600, container, frontcard, backcard, next);\n", - " \n", - "}\n", - "\n", - "\n", - "window.checkFlip = function checkFlip(containerId) {\n", - " var container = document.getElementById(containerId);\n", - "\n", - "\n", - " if (container.classList.contains('flip')) {\n", - " container.classList.remove('flip');\n", - " setTimeout(slide2, 600, containerId);\n", - " } \n", - " else {\n", - " slide2(containerId);\n", - " }\n", - "}\n", - "\n", - "\n", - "function slideback(container, frontcard, backcard, next) {\n", - " container.className=\"flip-container slideback\";\n", - " setTimeout(cleanup, 550, container, frontcard, backcard, next);\n", - "}\n", - "\n", - "function cleanup(container, frontcard, backcard, next) {\n", - " container.removeChild(frontcard);\n", - " backcard.className=\"flipper frontcard\";\n", - " container.className=\"flip-container\";\n", - "\n", - " var cardnum=parseInt(container.dataset.cardnum);\n", - " var cards=eval('cards'+container.id);\n", - " var flipper=createOneCard(container, false, cards, cardnum);\n", - " container.append(flipper);\n", - " cardnum= (cardnum+1) % parseInt(container.dataset.numCards);\n", - " container.dataset.cardnum=cardnum;\n", - " if (cardnum != 1){\n", - " next.innerHTML=\"Next >\";\n", - " } else {\n", - " //next.innerHTML=\"Reload \\\\(\\\\circlearrowleft\\\\) \";\n", - " next.innerHTML='Reload '\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([next]);\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " }\n", - "\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset();\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " next.style.pointerEvents='auto';\n", - " container.style.pointerEvents='auto';\n", - " /* container.tabIndex= 0; */\n", - " /* container.focus(); */\n", - " next.classList.remove('hide');\n", - " container.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(container.id);\n", - " }, {once: true });\n", - "\n", - "\n", - "}\n", - "\n", - "\n", - "function createOneCard (mydiv, frontCard, cards, cardnum) {\n", - " var colors=[\n", - " '--asparagus',\n", - " '--terra-cotta',\n", - " '--cyan-process'\n", - " ]\n", - "\n", - " var flipper = document.createElement('div');\n", - " if (frontCard){\n", - " flipper.className=\"flipper frontcard\"; \n", - " }\n", - " else {\n", - " flipper.className=\"flipper backcard\"; \n", - " }\n", - "\n", - " var front = document.createElement('div');\n", - " front.className='front flashcard';\n", - "\n", - " var frontSpan= document.createElement('span');\n", - " frontSpan.className='flashcardtext';\n", - " frontSpan.innerHTML=jaxify(cards[cardnum]['front']);\n", - " //frontSpan.textContent=jaxify(cards[cardnum]['front']);\n", - " front.style.background='var(' + colors[cardnum % colors.length] + ')';\n", - "\n", - "\n", - " front.append(frontSpan);\n", - " flipper.append(front);\n", - "\n", - " var back = document.createElement('div');\n", - " back.className='back flashcard';\n", - "\n", - " var backSpan= document.createElement('span');\n", - " backSpan.className='flashcardtext';\n", - " backSpan.innerHTML=jaxify(cards[cardnum]['back']);\n", - " back.append(backSpan);\n", - "\n", - " flipper.append(back);\n", - "\n", - " return flipper;\n", - "\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "function createCards(id, keyControl) {\n", - " console.log(id);\n", - " \n", - " var mydiv=document.getElementById(id);\n", - " /*mydiv.onclick = window.flipCard(mydiv);*/\n", - " /*\n", - " mydiv.addEventListener('click', function(){window.flipCard(mydiv);}, false);\n", - " mydiv.addEventListener('keydown', function(event){window.checkKey(mydiv,event);}, true);\n", - " */\n", - " mydiv.onclick = function(){window.flipCard(mydiv);};\n", - " console.log(keyControl);\n", - " if (keyControl == \"True\"){\n", - " mydiv.onkeydown = function(event){window.checkKey(mydiv,event);};\n", - " }\n", - " /* mydiv.addEventListener('keydown', function(event){event.stopPropagation(); console.log(event); event.preventDefault();}, true); */\n", - " /*mydiv.onkeypress = function(event){console.log(event); event.preventDefault();};*/\n", - "\n", - " console.log(mydiv);\n", - " \n", - " var cards=eval('cards'+id);\n", - " mydiv.dataset.cardnum=0;\n", - " mydiv.dataset.numCards=cards.length;\n", - " mydiv.addEventListener('swiped-left', function(e) {\n", - " /*\n", - " console.log(e.detail);\n", - " console.log(id);\n", - " */\n", - " checkFlip(id);\n", - " }, {once: true});\n", - "\n", - " var cardnum=0;\n", - " \n", - " for (var i=0; i<2; i++) {\n", - " \n", - " var flipper;\n", - " if (i==0){\n", - " flipper=createOneCard(mydiv, true, cards, cardnum);\n", - " }\n", - " else {\n", - " flipper=createOneCard(mydiv, false, cards, cardnum);\n", - " }\n", - "\n", - " mydiv.append(flipper);\n", - " if (typeof MathJax != 'undefined') {\n", - " var version = MathJax.version;\n", - " if (typeof version == 'undefined') {\n", - " setTimeout(function(){\n", - " var version = MathJax.version;\n", - " console.log('After sleep, MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }, 500);\n", - " } else{\n", - " console.log('MathJax version', version);\n", - " if (version[0] == \"2\") {\n", - " MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n", - " } else if (version[0] == \"3\") {\n", - " MathJax.typeset([flipper]);\n", - " }\n", - " }\n", - " } else {\n", - " console.log('MathJax not detected');\n", - " }\n", - "\n", - "\n", - " cardnum = (cardnum + 1) % mydiv.dataset.numCards;\n", - " }\n", - " mydiv.dataset.cardnum = cardnum;\n", - "\n", - " var next=document.getElementById(id+'-next');\n", - " if (cards.length==1) {\n", - " // Don't show next if no other cards!\n", - " next.style.pointerEvents='none';\n", - " next.classList.add('hide');\n", - " } else {\n", - " next.innerHTML=\"Next >\";\n", - " }\n", - "\n", - " mydiv.focus();\n", - "\n", - " return flipper;\n", - "}\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "var cardswrmiNMQoBInQ=[\n", - " {\n", - " \"front\": \"answer\",\n", - " \"back\": \"The variable in the loop set up is i but the variable in the body of the loop is x. If you change these variables so they match the loop will run.\"\n", - " }\n", - "];\n", - " \n", - " createCards(\"wrmiNMQoBInQ\", \"True\");\n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from jupytercards import display_flashcards\n", "cards='/home/jupyter/flashcards/'\n", @@ -659,31 +13,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "tf2-gpu.2-8.m102", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/tf2-gpu.2-8:m102" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/GoogleCloud/submodule01_Intro_to_terminal.ipynb b/GoogleCloud/submodule01_Intro_to_terminal.ipynb index 948eea1..a0602cd 100644 --- a/GoogleCloud/submodule01_Intro_to_terminal.ipynb +++ b/GoogleCloud/submodule01_Intro_to_terminal.ipynb @@ -29,9 +29,7 @@ { "cell_type": "markdown", "id": "bf672094-38a4-4e24-87de-598a0befd5d1", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "\n", "## Jupyter Notebook Basics\n", @@ -57,9 +55,7 @@ "cell_type": "code", "execution_count": null, "id": "37a3c9e6-9725-41eb-a284-774efe841bcf", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -71,9 +67,7 @@ { "cell_type": "markdown", "id": "54959383-4605-42ad-bd55-fe2c09d4d498", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "
\n", " \n", @@ -88,9 +82,7 @@ "cell_type": "code", "execution_count": null, "id": "b94461dd-996b-4419-9822-127a46967918", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -106,33 +98,10 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "dd071114-5301-4650-8f0a-15b99e65b230", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "execution_count": 2, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "# FLASHCARDS\n", "\n", @@ -143,10 +112,7 @@ { "cell_type": "markdown", "id": "a26ac6a7-05e0-4c99-ad3a-32f2829d2b14", - "metadata": { - "jp-MarkdownHeadingCollapsed": true, - "tags": [] - }, + "metadata": {}, "source": [ "\n", "You may notice that each cell has a vertical line to the left of it when the cell has been selected, you can click on the vertical line and collapse the cell. The same is true for the output of the code cell. Collapsing cells comes in pretty handy when the results of the code cell are long! Another way to manage commands with lengthy results is by enabling scrolling. To do this right click anywhere within the notebook and select the option for `Enable Scrolling for Outputs`.\n", @@ -207,9 +173,7 @@ { "cell_type": "markdown", "id": "ffdf8adf-ce9e-462d-94d4-3d44b850c0ee", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "\n", "### Getting Started in the Terminal Environment\n", @@ -241,9 +205,7 @@ "cell_type": "code", "execution_count": null, "id": "054614c2-3eb0-46bc-91a1-2578593f3687", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -255,9 +217,7 @@ { "cell_type": "markdown", "id": "7353d25e-9eed-4ff7-9176-502a0b3b9773", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "Notice that in the terminal window to exit out of the manual we had to use the `q` to get the prompt to return. Another way of looking at a summary of the information in the manual page is with the `--help` flag. Try typing `mkdir --help` in the terminal window. The information in the manual pages tends to be more clearly laid out and better organized, but the `--help` flag is a quick and easy way to remind yourself of the flags available.\n", "\n", @@ -339,9 +299,7 @@ "cell_type": "code", "execution_count": null, "id": "f49506c2-6c72-449e-9197-542f50d14678", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -359,9 +317,7 @@ { "cell_type": "markdown", "id": "2cda9c8c-d2d0-4380-b332-4ff1a644ea51", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "## Paths, Where Is Your Data Stored?\n", "-------------------\n", @@ -383,9 +339,7 @@ "cell_type": "code", "execution_count": null, "id": "f4dc07da-3f1f-4c3e-bc97-b61c25451c72", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -410,9 +364,7 @@ { "cell_type": "markdown", "id": "e71c89cd-0c6a-4da2-915c-46ec1f975ae6", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "You can see that we are in the `jupyter` directory and this directory is inside a directory called `home`. \n", "\n", @@ -423,9 +375,7 @@ "cell_type": "code", "execution_count": null, "id": "e520676d-3e75-4d54-b488-2944e5478b1f", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -548,33 +498,10 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "bfccc937-62e7-48c8-9745-1e03236f3e2c", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "# FLASHCARD\n", "from IPython.display import IFrame\n", @@ -584,9 +511,7 @@ { "cell_type": "markdown", "id": "3ae4b9a0-4eff-427e-bc7e-a292dc42f76d", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "## File Naming Considerations\n", "---------\n", @@ -661,31 +586,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "common-cpu.m104", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/base-cpu:m104" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.12.4" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/GoogleCloud/submodule02_Intro_to_cloud_computing.ipynb b/GoogleCloud/submodule02_Intro_to_cloud_computing.ipynb index 87bff20..dc88f3d 100644 --- a/GoogleCloud/submodule02_Intro_to_cloud_computing.ipynb +++ b/GoogleCloud/submodule02_Intro_to_cloud_computing.ipynb @@ -3,13 +3,7 @@ { "cell_type": "markdown", "id": "40ee29a5-94d5-4a06-9e45-40f95df8a650", - "metadata": { - "editable": true, - "slideshow": { - "slide_type": "" - }, - "tags": [] - }, + "metadata": {}, "source": [ "# Cloud computing\n", "\n", @@ -113,9 +107,7 @@ { "cell_type": "markdown", "id": "415ae2bc-59f1-4a01-afc1-cc4b1c9f3f4c", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "## Google Cloud Storage Buckets, One Option for Long Term Data Storage\n", "--------\n", @@ -152,9 +144,7 @@ "cell_type": "code", "execution_count": null, "id": "ffcb317d-d2b7-4d11-b08c-da6840ef24f0", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -166,31 +156,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "common-cpu.m104", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/base-cpu:m104" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.12.4" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/GoogleCloud/submodule03_genomics_file_format.ipynb b/GoogleCloud/submodule03_genomics_file_format.ipynb index bd790a3..21426f3 100644 --- a/GoogleCloud/submodule03_genomics_file_format.ipynb +++ b/GoogleCloud/submodule03_genomics_file_format.ipynb @@ -23,9 +23,7 @@ { "cell_type": "markdown", "id": "1cbeaea5-8155-4ed4-b951-e641f533be7b", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "## Genomic Annotation Data, GFF/GTF file Format\n", "------\n", @@ -322,9 +320,7 @@ "cell_type": "code", "execution_count": null, "id": "9fc00331-2d69-49ba-8e49-047cb81566d2", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -341,9 +337,7 @@ { "cell_type": "markdown", "id": "ed33c67a-1ef0-4491-b59d-776dfff623a6", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "## Genomic Sequence Data, Fasta Files\n", "----------------\n", @@ -396,9 +390,7 @@ "cell_type": "code", "execution_count": null, "id": "a5754551-bf07-4025-8d8e-ac5cbbfd95a9", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -452,9 +444,7 @@ "cell_type": "code", "execution_count": null, "id": "0991d53a-cefb-40b9-8807-f819434d7afd", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -507,9 +497,7 @@ "cell_type": "code", "execution_count": null, "id": "fbde4a80-e24b-46e0-ae0e-e003315d1256", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -536,9 +524,7 @@ { "cell_type": "markdown", "id": "55c6610f-52db-4d00-a354-81c2fddada07", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "The sequence alphabet of this file indicates that these are protein sequences and you'll notice that each sequences is about the same length. There isn't a lot of information in the headers, but we can see that each sequence comes from a different species and we know that there are the same number of headers and sequence lines. Together this information indicates that these sequences are from a protein alignment. To be sure we can use NCBI's [BLAST tool](https://blast.ncbi.nlm.nih.gov/Blast.cgi?PROGRAM=blastp&PAGE_TYPE=BlastSearch&LINK_LOC=blasthome) to check the identity of some of these sequences. \n", "\n", @@ -659,9 +645,7 @@ { "cell_type": "markdown", "id": "49b4c02a-b675-4f96-85c8-fc54c3329480", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "## Raw Sequencing Data, FASTQ Files\n", "------------------------------\n", @@ -908,31 +892,7 @@ "source": [] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "common-cpu.m104", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/base-cpu:m104" - }, - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/GoogleCloud/submodule04_beyond_basic_bash.ipynb b/GoogleCloud/submodule04_beyond_basic_bash.ipynb index d0f1871..5455952 100644 --- a/GoogleCloud/submodule04_beyond_basic_bash.ipynb +++ b/GoogleCloud/submodule04_beyond_basic_bash.ipynb @@ -3,9 +3,7 @@ { "cell_type": "markdown", "id": "6963dbcc-0794-4f51-b589-5c3bf1ff4103", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "# Beyond Basic BASH Coding\n", "------\n", @@ -104,9 +102,7 @@ { "cell_type": "markdown", "id": "f1c37b72-36be-4141-a692-caa954d9e8ad", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "## For & While Loops\n", "-------\n", @@ -128,9 +124,7 @@ "cell_type": "code", "execution_count": null, "id": "cbcae554-f686-4114-b129-b1f636988495", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -184,9 +178,7 @@ { "cell_type": "markdown", "id": "32debf32-ce7c-4b4b-88e8-0d55fb7d5810", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "### For Loop\n", "\n", @@ -197,9 +189,7 @@ "cell_type": "code", "execution_count": null, "id": "a9046c97-b8dc-4b55-af3b-e875fade21b2", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -238,9 +228,7 @@ "cell_type": "code", "execution_count": null, "id": "474b7da7-b213-4874-ab65-3b06ea3562ad", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -256,9 +244,7 @@ { "cell_type": "markdown", "id": "e58ab4a4-c787-4939-adb3-146b95585eb8", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "Now let's use variations on some of the complex code we wrote in the earlier lesson **Genomic File Formats** to write a loop to check how many reads contain the start codon `ATG`. We can do this by searching for matches with `grep` and counting how many times it was found with `wc -l` (literally how many lines are returned), and repeating this process for each sample using a while loop.\n" ] @@ -267,9 +253,7 @@ "cell_type": "code", "execution_count": null, "id": "6705dc4f-a7d3-4fb4-9189-bc4af0e78891", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -347,9 +331,7 @@ "cell_type": "code", "execution_count": null, "id": "100a2f16-c778-4b08-a6b7-c2460b4ab219", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -370,9 +352,7 @@ "cell_type": "code", "execution_count": null, "id": "65fa9ddd-5c35-4c9f-8728-e19b7ad4b41e", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -395,9 +375,7 @@ "cell_type": "code", "execution_count": null, "id": "2f8185c6-b059-4023-b654-182199dc625f", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -482,9 +460,7 @@ "cell_type": "code", "execution_count": null, "id": "729b493c-8971-4d2c-a74e-4ffd930506cb", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -502,31 +478,7 @@ "source": [] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "common-cpu.m104", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/base-cpu:m104" - }, - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.12" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/GoogleCloud/submodule05_software_management.ipynb b/GoogleCloud/submodule05_software_management.ipynb index 8defd84..383217f 100644 --- a/GoogleCloud/submodule05_software_management.ipynb +++ b/GoogleCloud/submodule05_software_management.ipynb @@ -3,9 +3,7 @@ { "cell_type": "markdown", "id": "1553273d-c130-4398-8256-2d3d7b2aa66a", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "# Installing and Managing Bioinformatic Software\n", "\n", @@ -189,9 +187,7 @@ { "cell_type": "markdown", "id": "21e21a1b-c662-4d9c-856b-a800bbf1f853", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "## Creating a Conda Environment\n", "--------\n", @@ -279,9 +275,7 @@ "cell_type": "code", "execution_count": null, "id": "b9642a1e-5154-44b9-990f-5dc5209ae0f3", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -304,9 +298,7 @@ "cell_type": "code", "execution_count": null, "id": "61c54ef1-6cf6-4d53-af7d-8d37cbe1bd20", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -357,9 +349,7 @@ "cell_type": "code", "execution_count": null, "id": "c149e564-2bfc-4b2e-99f9-ac3f2b6a499c", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -459,9 +449,7 @@ "cell_type": "code", "execution_count": null, "id": "39a3979a-2147-4237-973b-7ddfd40e7585", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -486,9 +474,7 @@ "cell_type": "code", "execution_count": null, "id": "8f1b018a-9538-4cce-885f-aeaf4add3a2a", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -521,9 +507,7 @@ "cell_type": "code", "execution_count": null, "id": "195d98c4-5cf0-4c78-8f78-443dd4524e43", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -535,9 +519,7 @@ { "cell_type": "markdown", "id": "9e0a5c00-f5fe-49cf-8331-931d469685af", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "You will notice that in the first run where we only used one thread the output indicated that the analysis analyzed each file sequentially, whereas when we used two threads the files were analyzed in parallel and finished at almost the same time. The parellelization in this case uses one thread per file so using more than two threads would not have sped up the analysis time.\n", "\n", @@ -562,9 +544,7 @@ "cell_type": "code", "execution_count": null, "id": "86432f8c-0cb7-4807-ae09-a69d4c6293f2", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -604,9 +584,7 @@ "cell_type": "code", "execution_count": null, "id": "0d1e9ef6-f108-486b-9dab-926a6f5be466", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -632,9 +610,7 @@ "cell_type": "code", "execution_count": null, "id": "48625ab6-243c-4491-ba5d-66d258a86bcd", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -674,31 +650,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "python3", - "name": "common-cpu.m104", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/base-cpu:m104" - }, - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.12.4" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/GoogleCloud/submodule06_putting_it_all_together.ipynb b/GoogleCloud/submodule06_putting_it_all_together.ipynb index 3181ed0..4d21928 100644 --- a/GoogleCloud/submodule06_putting_it_all_together.ipynb +++ b/GoogleCloud/submodule06_putting_it_all_together.ipynb @@ -23,9 +23,7 @@ "cell_type": "code", "execution_count": null, "id": "ac12ca19-ef6a-4554-92b2-9b4489a4b107", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -116,9 +114,7 @@ "cell_type": "code", "execution_count": null, "id": "9199a45e-5711-464f-8ff5-0dc9708c1f3b", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -185,9 +181,7 @@ { "cell_type": "markdown", "id": "dd70fe01-c2a7-4978-a655-8b94c41c76a3", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "## Assembling the Genome (Spades)\n", "----------\n", @@ -219,10 +213,7 @@ "cell_type": "code", "execution_count": null, "id": "fcf66e46-7861-43d5-b2d5-3105229c7dd3", - "metadata": { - "scrolled": true, - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -478,31 +469,7 @@ "source": [] } ], - "metadata": { - "environment": { - "kernel": "conda-env-annotation-py", - "name": "common-cpu.m104", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/base-cpu:m104" - }, - "kernelspec": { - "display_name": "Python [conda env:annotation]", - "language": "python", - "name": "conda-env-annotation-py" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.9.16" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/GoogleCloud/submodule07_error_mitigation.ipynb b/GoogleCloud/submodule07_error_mitigation.ipynb index a5a1335..2fee556 100644 --- a/GoogleCloud/submodule07_error_mitigation.ipynb +++ b/GoogleCloud/submodule07_error_mitigation.ipynb @@ -34,9 +34,7 @@ "cell_type": "code", "execution_count": null, "id": "0fdcc3f2-47f0-48f1-91c4-7a04992e96fc", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -62,9 +60,7 @@ "cell_type": "code", "execution_count": null, "id": "fc6dfb9c-9426-4c93-954f-06fdb3a85c37", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -77,9 +73,7 @@ "cell_type": "code", "execution_count": null, "id": "548c4ed9-8c75-4020-a69a-d376a42f6ec0", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -93,9 +87,7 @@ "cell_type": "code", "execution_count": null, "id": "aa1eb263-207e-4645-8c5c-f0138ba9c5da", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -109,9 +101,7 @@ "cell_type": "code", "execution_count": null, "id": "61e2398c-17b7-4211-9c82-588f745b94e4", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -147,9 +137,7 @@ "cell_type": "code", "execution_count": null, "id": "9e42dd93-8400-46bf-bca0-6a9ee18136d0", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -175,9 +163,7 @@ "cell_type": "code", "execution_count": null, "id": "58f4370f-27c5-4dc9-b17b-26528029e35f", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -223,9 +209,7 @@ { "cell_type": "markdown", "id": "f925eb00-3958-40d4-9ef6-0bd704b8347e", - "metadata": { - "tags": [] - }, + "metadata": {}, "source": [ "We started with typos because these are the most common mistakes we diagnose in our workshops, especially with regard to case. \n", "\n", @@ -244,9 +228,7 @@ "cell_type": "code", "execution_count": null, "id": "455892b0-5d8c-4b62-ae95-231fff74909d", - "metadata": { - "tags": [] - }, + "metadata": {}, "outputs": [], "source": [ "%%bash\n", @@ -338,31 +320,7 @@ ] } ], - "metadata": { - "environment": { - "kernel": "conda-env-annotation-py", - "name": "common-cpu.m104", - "type": "gcloud", - "uri": "gcr.io/deeplearning-platform-release/base-cpu:m104" - }, - "kernelspec": { - "display_name": "Python [conda env:annotation]", - "language": "python", - "name": "conda-env-annotation-py" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.9.16" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 } diff --git a/reusable-workflow-repo b/reusable-workflow-repo deleted file mode 160000 index 3237900..0000000 --- a/reusable-workflow-repo +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3237900c16e854cf76b24e58b3543dbb63e1a2eb