tag:quandyfactory.com,2024-6-11:/2024611 2024-6-11T12:00:00Z Quandy Factory Newsfeed - Projects Quandy Factory is the personal website of Ryan McGreal in Hamilton, Ontario, Canada.. http://quandyfactory.com/projects/266/introducing_catgpt 2024-05-22T12:00:00Z Introducing CatGPT <script> catgpt_words = ['meow', 'meow', 'meow', 'maw', 'mee', 'yow', 'mom', 'now', 'neow', 'naw', 'wow', 'mah', 'nah', 'hiss', 'hiss', 'purr', 'purr', 'hiss', 'meow']; catgpt_seps = [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '? ', '. ', '. ', '. ', '! ']; function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } async function catgpt_generate_response() { prompt = $('#catgpt_prompt').val(); $('#catgpt_reponse').val(''); words = Math.floor(Math.random() * (100 - 20) + 20); response = []; for (var i = 0; i < words; i++) { this_word_index = Math.floor(Math.random() * (catgpt_words.length)); this_word = catgpt_words[this_word_index]; response.push(this_word) this_sep_index = Math.floor(Math.random() * (catgpt_seps.length)); this_sep = catgpt_seps[this_sep_index]; response.push(this_sep) response_string = response.join(''); console.log('response_string = ' + response_string); this_delay = Math.floor(Math.random() * 200 + 20); console.log('this_delay = ' + this_delay); await sleep(this_delay); $('#catgpt_response').val(response_string); } $('#catgpt_prompt').val(''); narrative = $('#catgpt_narrative').html(); narrative = narrative + '<p><strong>' + prompt + '</strong></p>'; narrative = narrative + '<p>' + response_string + '</p>' $('#catgpt_narrative').html(narrative); } </script> <div> <label for="catgpt_prompt" id="catgpt_prompt_label">Prompt:<br/> <textarea id="catgpt_prompt" name="catgpt_prompt" placeholder="Enter your prompt here:" style="height: 24px; max-width: 90%;"></textarea> </label> </div> <div><button id="catgpt_generate_response_button" name="catgpt_generate_response_button" onclick="catgpt_generate_response()">Generate Response</button><br/></div> <div> <label for="catgpt_response" id="catgpt_response_label">Response:<br/> <textarea id="catgpt_response" readonly="readonly" name="catgpt_response" style="height: 100px; max-width: 90%;"></textarea> </label> </div> <div id="catgpt_narrative"> </div> Ryan McGreal 2 http://quandyfactory.com/projects/244/vowels_to_oob 2021-03-10T12:00:00Z Vowels to Oob <p><textarea id="oob_text" name="oob_text" placeholder="Enter your text here" style="width: 100%; height: 4em !important"></textarea> <input id="vowel_to_oob_convert" style="width: 100%: height: 2em; line-height: 2em; font-size: 1.5em;" type="submit" value="Convert"/></p> <p><div id="oob_output"></p> Ryan McGreal 2 http://quandyfactory.com/projects/243/alternating_caps_generator 2021-03-05T12:00:00Z AlTeRnAtInG CaPs gEnErAtOr <p><textarea style="width: 100%; height: 4em !important" id="ac_text" name="ac_text" placeholder="Enter your text here"></textarea> <input style="width: 100%: height: 2em; line-height: 2em; font-size: 1.5em;" id="ac_convert" type="submit" value="Convert"/></p> <div id="ac_output"> </div> Ryan McGreal 2 http://quandyfactory.com/projects/241/hamilton_covid-19_outbreaks 2021-01-30T12:00:00Z Hamilton COVID-19 Outbreaks <p>I created a <a href="/covid/outbreaks?active_only=1">Hamilton COVID-19 Outbreaks page</a> to track active outbreaks and plot them on a map. Updated daily. </p> Ryan McGreal 2 http://quandyfactory.com/projects/240/ontario_covid-19_data 2021-01-30T12:00:00Z Ontario COVID-19 Data <p>The <a href="/covid">COVID-19 page</a> tracks daily test results from Ontario Public Health since the start of the pandemic, with various charts and related data tables. The information is also available in various open data formats. </p> Ryan McGreal 2 http://quandyfactory.com/projects/2/pyhtmledit 2020-05-27T12:00:00Z PyHtmlEdit <p>You can download pyhtmledit from its <a href="http://github.com/quandyfactory/PyHtmlEdit/tree/master">Github repository</a>. </p> <p class="image"> <img src="/static/images/pyhtmledit_editor_window.png" alt="PyHtmlEdit screenshot" title="PyHtmlEdit screenshot"><br> PyHtmlEdit screenshot </p> <ul> <li>Current Version: 3.1 (released 2020-05-27)</li> </ul> <p>Note: PyHtmlEdit has been completely updated as of Version 3. It now runs on Python 3.x, not Python 2.x, as the latter is obsolete and is no longer being supported.</p> <p>PyHtmlEdit 3 also runs using the Tkinter GUI library, which is built into Python installations, instead of the wxPython library, which turned out to be more hassle than it was worth.</p> <p>You also need to have the python-markdown2 and html2text libraries installed.</p> <p>The features include:</p> <ul> <li>Convert between Markdown and HTML.</li> <li>Search, Replace Next and Replace All.</li> <li>Undo and Redo.</li> <li>A Clean function that removes MS Word special characters.</li> <li>HTML element formatting, including converting a tab-delimited list to an html <code>table</code>.</li> <li>Lowercase, Proper Case and Uppercase functions.</li> </ul> <p>This software is released under the <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">GNU General Public Licence, Version 2</a>.</p> Ryan McGreal 2 http://quandyfactory.com/projects/229/some_handy_running_calculations 2019-11-08T12:00:00Z Some Handy Running Calculations <p>I've recently <a href="https://www.strava.com/athletes/47143600">signed up with Strava</a> after almost a decade using <a href="https://runkeeper.com/user/RyanMcGreal/profile">Runkeeper</a>, and I've also recently resumed a regular weekly running program after a very sketchy few months of barely getting any runs in. I decided that with Around the Bay 2020 just five months away, it would be a good idea to start tracking my runs in terms of an ATB training program, naming each run in terms of which week of training it falls in, and which consecutive run it is during that week. So the first run of the first week would be 1-1, and the third run of the second week would be 2-3, and so on.</p> <p>Strava gives you some pretty good information in its running analysis, but I'm also interested in increasing my cadence toward 180 steps per minute, since this seems to be the most fruitful opportunity to increase my cruising speed. Strava does not calculate steps (one point for Runkeeper), but my Fitbit does, and I can use that value in combination with distance and time to calculate cadence and stride length.</p> <p>This is a bit tedious to do manually, so I have created a form where you input your steps, distance and time (in hours, minutes and seconds) and it calculates the rest for you.</p> <script type="text/javascript"> function calculate_running() { var steps = parseInt($('#calc_steps').val()); logit('steps = ' + steps); var distance = parseFloat($('#calc_distance').val()); logit('distance = ' + distance); var distance_metres = distance * 1000; logit('distance_metres = ' + distance_metres); var hours = parseInt($('#calc_hours').val()); logit('hours = ' + hours); var minutes = parseInt($('#calc_minutes').val()); logit('minutes = ' + minutes); var seconds = parseInt($('#calc_seconds').val()); logit('seconds = ' + seconds); var time_hours = hours + minutes/60 + seconds/60/60; logit('time_hours = ' + time_hours); var time_minutes = hours*60 + minutes + seconds/60; logit('time_minutes = ' + time_minutes); var speed = distance/time_hours; logit('speed = ' + speed); var pace = time_minutes / distance; logit('pace = ' + pace); var pace_minutes = Math.floor(pace); logit('pace_minutes = ' + pace_minutes); var pace_seconds = Math.round((pace - pace_minutes)* 60) logit('pace_seconds = ' + pace_seconds); var pace_text = pace_minutes.toString() + ':' + padit(pace_seconds, 2); logit('pace_text = ' + pace_text); var cadence = Math.round(steps / time_minutes); logit('cadence = ' + cadence); var stride_length = (distance_metres / steps).toFixed(2); logit('stride_length = ' + stride_length); var statement = commas(steps).toString() + ' steps for a cadence of ' + cadence.toString() + ' steps/min and a stride length of ' + stride_length.toString() + ' m/step with a speed of ' + speed.toFixed(2) + ' km/h and a pace of ' + pace_text + ' min/km.'; logit('statement = ' + statement); $('#output_distance_m').html(distance_metres); $('#output_time_hours').html(time_hours.toFixed(2)); $('#output_time_minutes').html(time_minutes.toFixed(2)); $('#output_speed').html(speed.toFixed(2)); $('#output_pace').html(pace_text); $('#output_cadence').html(cadence); $('#output_stride_length').html(stride_length); $('#output_statement').html(statement); } function logit(val) { return false; } function padit(val, size) { var s = '00000000' + val; return s.substr(s.length-size); } function commas(x) { return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); } </script> <form> <table style="width: 400px"> <tr><th>Steps</th><td><input name="calc_steps" id="calc_steps" value="8331"></td></tr> <tr><th>Distance (km)</th><td><input name="calc_distance" id="calc_distance" value="9.5"></td></tr> <tr><th>Hours</th><td><input name="calc_hours" id="calc_hours" value="0"></td></tr> <tr><th>Minutes</th><td><input name="calc_minutes" id="calc_minutes" value="52"></td></tr> <tr><th>Seconds</th><td><input name="calc_seconds" id="calc_seconds" value="40"></td></tr> <tr><td colspan="2" style="text-align: center !important"><input type="button" name="calculate" id="calculate" value="Calculate" onclick="calculate_running(); return false" style="width: 90%; height: 2em"></td></tr> <tr><td colspan="2" style="font-weight: bold; text-align: centre !important">Calculations</td><tr> <tr><th>Dist (m)</th><td id="output_distance_m"></td></tr> <tr><th>Time (hours)</td><td id="output_time_hours"></td></tr> <tr><th>Time (mins)</th><td id="output_time_minutes"></td></tr> <tr><th>Speed (km/h)</th><td id="output_speed"></td></tr> <tr><th>Pace (min/km)</th><td id="output_pace"></td></tr> <tr><th>Cadence (steps/min)</th><td id="output_cadence"></td></tr> <tr><th>Stride Length (m)</th><td id="output_stride_length"></td></tr> <tr><td colspan="2" id="output_statement"></td></tr> </table> </form> Ryan McGreal 2 http://quandyfactory.com/projects/150/tracking_movement 2015-06-14T12:00:00Z Tracking Movement <p>I've been tracking my daily/weekly running and stepcounts. You can see the results here:</p> <ul> <li><p><a href="/running">Running</a></p></li> <li><p><a href="/biking">Biking</a></p></li> <li><p><a href="/stepcounts">Stepcounts</a></p></li> </ul> Ryan McGreal 2 http://quandyfactory.com/projects/151/recipes 2015-04-17T12:00:00Z Recipes <p>I've got a new section on the site for recipes I often use. You can find it here:</p> <ul> <li><a href="/recipes">Recipes</a></li> </ul> Ryan McGreal 2 http://quandyfactory.com/projects/74/solitaire 2013-05-08T12:00:00Z Solitaire <p>This is a version of solitaire I hacked up using HTML, CSS, javascript with <a href="http://jquery.com">jQuery</a>, <a href="http://jqueryui.com/">jQUery-UI</a> draggable, the <a href="https://github.com/DanielRapp/Noisy">Noisy</a> jQuery plugin, and only one small image. It's pretty nasty, but I wanted to get a feel for the draggable jquery-UI functionality. </p> <p><strong>Demo</strong>: <a href="http://quandyfactory.com/static/solitaire/solitaire.html">http://quandyfactory.com/static/solitaire/solitaire.html</a></p> <p><strong>Source</strong>: <a href="https://github.com/quandyfactory/Solitaire">https://github.com/quandyfactory/Solitaire</a></p> <p><strong>Update</strong>: You can play this game live, courtesy of PythonAnywhere:</p> <ul> <li><a href="https://www.pythonanywhere.com/gists/459573/rps.py/ipython2/">https://www.pythonanywhere.com/gists/459573/rps.py/ipython2/</a></li> </ul> Ryan McGreal 2