Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import plotly.express as px | |
df = pd.read_html('https://en.wikipedia.org/wiki/List_of_generating_stations_in_Alberta') | |
categories = ['coal','natural gas','dual fuel','biomass','geothermal','hydroelectric','wind','solar'] | |
values = [] | |
for i, c in enumerate(categories): | |
total = int(pd.to_numeric(df[i+1]['Capacity (MW)'], errors='coerce').sum()) | |
values.append(total) | |
px.pie(names=categories, values=values) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Return Halo Infinite stats for a gamertag as a json string | |
// instructions for creating your own endpoint at https://docs.autocode.com/getting-started/creating-your-first-project/creating-an-endpoint/ | |
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN}); | |
module.exports = async (context) => { | |
const gamertag = context.params.gamertag; | |
// if no gamertag is passed return an error | |
if (!gamertag) { | |
return { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# python -m pip install PyMuPDF Pillow | |
import os # for files and directories | |
import io # for bytes | |
import fitz #PyMuPDF | |
from PIL import Image #Pillow | |
for root, dirs, files in os.walk("."): | |
for filename in files: | |
if filename.endswith('.pdf'): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// schedule this Google Apps Script function to run at a certain time to change a YouTube video's privacy status | |
function updateVideoPrivacy() { // enable the YouTube Data API under "Services" | |
var channels = YouTube.Channels.list('contentDetails', {mine: true}); | |
for (var i=0; i<channels.items.length; i++) { | |
var uploadsPlaylistId = channels.items[i].contentDetails.relatedPlaylists.uploads; | |
var playlistResponse = YouTube.PlaylistItems.list('snippet', {playlistId: uploadsPlaylistId, maxResults: 1}); // or more than 1 if needed | |
var video = playlistResponse.items[0]; // the first video in the list we retrieved | |
var metadata = { | |
status: {'privacyStatus': 'private'}, // public, unlisted, private | |
id: video.snippet.resourceId.videoId}; // we need to include the video ID from the playlist response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function test() { | |
return "this works"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<link rel="icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEACABoBQAAFgAAACgAAAAQAAAAIAAAAAEACAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAAAAPD4/AC0vMADd3+AAWFpbAFlaWwC8vb0AOjw9AERHRwCSlJUAk5SVAJ6fnwD39/cAW1xeAGVnaAC0t7YAgYOEAI2OjgDk5uYA9fX1AFhaXABzdHUA5ubmAG5wcAA6PD4Ax8jIAEVHSAA2ODkAqaqqAPLz8wB7fX0AQ0VGADQ2NwB6e3sAs7W1AJqbnAAjJSYAi4yNAP7+/gDu7+8A7+/vAHZ5eQDf4OAAtbe4ANHR0QBPUFEAwsLCAKioqQCjpKQA/Pz8AO3t7QBrbG0AvcDAAExOTwDJy8oAlpeYAC4wMQDe4OEAkZOTAPr6+gBoamsAWVtcANzc3ABkZmYAKy4vAK6vrwAsLi8A/fz9AJCRkQDe3t8AZmhpANna2gDa2toAYmRkAJGTlADr6+wA9vb2AH6AgABlZmcAYGJiAMjJyQBGSEkAr6+wAIGCgwC3uLgAqKmpANTU1ABSU1QAqqusAEJERQC1trYAlpiYAC8xMQD///8AfX5/AH5+fwBtb3AA8PDwAODh4QB6enoAuLi5ALO0tAA8Pj4A/f39AHt8fQDu7u4Ad3h4AExPUADFxcYA0NDQAMDBwQBOT1AAPkBBAPn7+wDq7OwAeXp7ANvd3QDc3d0AdHZ2AEtNTgBMTU4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Teensy 2 Videoconference Buttons Controller | |
// Choose Keyboard from the "Tools > USB Type" menu | |
// buttons connected to 6 pins, and a switch for different programs | |
#include <Bounce.h> | |
Bounce button0 = Bounce(2, 50); | |
Bounce button1 = Bounce(1, 100); // this button was too sensitive | |
Bounce button2 = Bounce(0, 50); | |
Bounce button3 = Bounce(3, 50); | |
Bounce button4 = Bounce(14, 50); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
number_of_rounds = 50 | |
player1 = 'Steven' | |
player2 = 'Edward' | |
choices = { | |
'Steven':['Rock','Paper','Scissors'], | |
'Bart':['Rock'], | |
'Edward':['Scissors','Scissors','Scissors','Scissors','Paper','Paper'], | |
'Freddie':['Paper','Paper','Rock','Paper','Paper','Rock']} | |
# create a dataframe of rock beats scissors etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import pdfplumber | |
from spellchecker import SpellChecker | |
spell = SpellChecker() | |
for path, directories, files in os.walk('.'): | |
for filename in files: | |
if filename.endswith('.pdf'): | |
filepath = path + os.sep + filename | |
student = path.split('- ')[1].strip() # get the student name from the directory name |